diff --git a/.github/workflows/check-same-code-base.yml b/.github/workflows/check-same-code-base.yml index d4b0533b..55dc0ffe 100644 --- a/.github/workflows/check-same-code-base.yml +++ b/.github/workflows/check-same-code-base.yml @@ -46,9 +46,12 @@ jobs: - name: check-updater-phar run: | composer -V --ansi - ./vendor/bin/box info -lm flat updater.phar | LC_LOCALE=C sort | grep -Ev "^(Signature Hash| Version.php |Contents: | installed.php |Timestamp: )" > updater.old.txt - # Makes sure repository is clean so the version isn't generated with "dirty" suffix + ./vendor/bin/box info -lm flat updater.phar | LC_LOCALE=C sort | grep -Ev "^(Signature Hash| Version.php |Contents: | installed.php |Timestamp: )" > /tmp/updater.old.txt + # Current status + git status + # Clean modified files to avoid "dirty" version git restore . make updater.phar - ./vendor/bin/box info -lm flat updater.phar | LC_LOCALE=C sort | grep -Ev "^(Signature Hash| Version.php |Contents: | installed.php |Timestamp: )" > updater.txt - diff --suppress-common-lines -t --tabsize=4 -d -y --color=always updater.txt updater.old.txt + ./vendor/bin/box info -lm flat updater.phar | LC_LOCALE=C sort | grep -Ev "^(Signature Hash| Version.php |Contents: | installed.php |Timestamp: )" > /tmp/updater.txt + diff --suppress-common-lines -t --tabsize=4 -d -y --color=always /tmp/updater.txt /tmp/updater.old.txt + rm /tmp/updater.txt /tmp/updater.old.txt diff --git a/Makefile b/Makefile index 3978439a..316bc437 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,10 @@ # SPDX-License-Identifier: AGPL-3.0-or-later .PHONY: updater.phar -updater.phar: updater.php lib/*.php buildVersionFile.php - php buildVersionFile.php - composer dump-autoload - composer run box - chmod +x updater.phar - rm lib/Version.php +build: updater.phar index.php + +updater.phar: updater.php lib/*.php bin/compile + bin/compile clean: rm updater.phar index.php @@ -21,25 +19,25 @@ index.php: lib/UpdateException.php lib/LogException.php lib/Updater.php index.we test/vendor: composer bin tests install -test: updater.phar test/vendor +test: test/vendor cd tests && ../vendor/bin/behat -test-cli: updater.phar test/vendor +test-cli: test/vendor cd tests && ../vendor/bin/behat features/cli.feature -test-stable26: updater.phar test/vendor +test-stable26: test/vendor cd tests && ../vendor/bin/behat features/stable26.feature -test-stable27: updater.phar test/vendor +test-stable27: test/vendor cd tests && ../vendor/bin/behat features/stable27.feature -test-stable31: updater.phar test/vendor +test-stable31: test/vendor cd tests && ../vendor/bin/behat features/stable31.feature -test-master: updater.phar test/vendor +test-master: test/vendor cd tests && ../vendor/bin/behat features/master.feature -test-user.ini: updater.phar test/vendor +test-user.ini: test/vendor cd tests && ../vendor/bin/behat features/user.ini.feature check-same-code-base: diff --git a/bin/compile b/bin/compile new file mode 100755 index 00000000..4da7c722 --- /dev/null +++ b/bin/compile @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -Eeuo pipefail + +declare -r ROOT_DIRECTORY="$(readlink -f "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")" +declare -r COMPOSER_BIN="${COMPOSER_BIN:-$(which composer)}" +declare -r BOX_BIN="${ROOT_DIRECTORY}/vendor/bin/box" +declare -ri DEBUG="${DEBUG:-0}" +declare -ri ALLOW_DIRTY="${ALLOW_DIRTY:-0}" + +if [[ ${DEBUG} -gt 1 ]]; then + set -x +fi + +function debug() { + if [[ ${DEBUG} -lt 1 ]]; then + return + fi + printf "%s\n" "${*}" +} + +# Ignore changes on updater.phar +git restore updater.phar + +# Build information +declare -i BUILD_TIMESTAMP +BUILD_TIMESTAMP=$(git rev-list --no-commit-header -n1 --format=%ct HEAD) +declare BUILD_VERSION +BUILD_VERSION=$(git describe --tags) +declare -i DIRTY_BUILD +if [[ -z "$(git status --porcelain)" ]]; then + DIRTY_BUILD=0 +else + DIRTY_BUILD=1 + BUILD_VERSION="${BUILD_VERSION} dirty" +fi + +debug "Build version ${BUILD_VERSION} with timestamp ${BUILD_TIMESTAMP}" + +# Create version file +cat >lib/Version.php < $baseDir . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => $baseDir . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => $baseDir . '/lib/Updater.php', - 'NC\\Updater\\Version' => $baseDir . '/lib/Version.php', 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 173bf8d5..fe175374 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -103,7 +103,6 @@ class ComposerStaticInitcbbead1010db4afef500f7adc2b6cac3 'NC\\Updater\\UpdateCommand' => __DIR__ . '/../..' . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => __DIR__ . '/../..' . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => __DIR__ . '/../..' . '/lib/Updater.php', - 'NC\\Updater\\Version' => __DIR__ . '/../..' . '/lib/Version.php', 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index b00be49f..e0b86fd6 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'aa4d3f66efadf70396c0ab758da5d105bade36e2', + 'reference' => 'a8a4a7a3a2f3c5ad1b575b9b07979cbf662f894e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'aa4d3f66efadf70396c0ab758da5d105bade36e2', + 'reference' => 'a8a4a7a3a2f3c5ad1b575b9b07979cbf662f894e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),