diff --git a/contrib/source-control-tools/patch-recipes/archive-release-notes.sh b/contrib/source-control-tools/autogen-recipes/50-archive-release-notes.sh rename from contrib/source-control-tools/patch-recipes/archive-release-notes.sh rename to contrib/source-control-tools/autogen-recipes/50-archive-release-notes.sh --- a/contrib/source-control-tools/patch-recipes/archive-release-notes.sh +++ b/contrib/source-control-tools/autogen-recipes/50-archive-release-notes.sh @@ -30,4 +30,3 @@ PROJECT_VERSION="${CURRENT_VERSION}" envsubst < "${TOPLEVEL}/doc/release-notes/release-notes.md.in" > "${RELEASE_NOTES_FILE}" git add "${RELEASE_NOTES_FILE}" "${RELEASE_NOTES_ARCHIVE}" -git commit -m "[Automated] Archive release notes for version ${RELEASE_NOTES_VERSION}" diff --git a/contrib/source-control-tools/autogen-recipes/51-update-aur-version.sh b/contrib/source-control-tools/autogen-recipes/51-update-aur-version.sh new file mode 100755 --- /dev/null +++ b/contrib/source-control-tools/autogen-recipes/51-update-aur-version.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +export LC_ALL=C.UTF-8 + +set -euxo pipefail + +# Common script to update the AUR packages. +# Usage: update-aur-version + +TOPLEVEL=$(git rev-parse --show-toplevel) +# shellcheck source=../../utils/compare-version.sh +source "${TOPLEVEL}"/contrib/utils/compare-version.sh + +CURRENT_VERSION="" +get_current_version CURRENT_VERSION + +update-aur-version() { + PACKAGE="$1" + + # Get the current version of the AUR package + PKGBUILD="${TOPLEVEL}"/contrib/aur/${PACKAGE}/PKGBUILD + # shellcheck source=../../aur/bitcoin-abc/PKGBUILD + source "${PKGBUILD}" + + # Compare the versions. We only want to update if + # (software version > package version) to prevent downgrades. + if version_less_equal "${CURRENT_VERSION}" "${pkgver}" + then + echo "Current version ${CURRENT_VERSION} <= ${PACKAGE} AUR package version ${pkgver}, skip the update" + return 0 + fi + + # Reset the release version to 0 and update the package version in the + # PKGBUILD file. + # Note that this pattern is very safe: because of the shell script syntax, + # no whitespace can occur and we have the original value as a variable. + sed -i "s/pkgrel=${pkgrel}/pkgrel=0/" "${PKGBUILD}" + sed -i "s/pkgver=${pkgver}/pkgver=${CURRENT_VERSION}/" "${PKGBUILD}" + + git add "${PKGBUILD}" +} + +update-aur-version "bitcoin-abc" +update-aur-version "bitcoin-abc-qt" diff --git a/contrib/source-control-tools/automated-commits.sh b/contrib/source-control-tools/automated-commits.sh --- a/contrib/source-control-tools/automated-commits.sh +++ b/contrib/source-control-tools/automated-commits.sh @@ -82,5 +82,21 @@ exit 0 fi +# Auto-generated changes. These are amended to the patch rather than landed as +# their own commit. +for AUTOGEN_SCRIPT in "${TOPLEVEL}"/contrib/source-control-tools/autogen-recipes/* ; do + "${AUTOGEN_SCRIPT}" +done + +echo "The following staged changes will be amended to your patch:" +git --no-pager diff --cached + +# Amend the commit, preserving committer info +GIT_COMMITTER_EMAIL="$(git show -s --format='%ce')" +GIT_COMMITTER_NAME="$(git show -s --format='%cn')" +export GIT_COMMITTER_EMAIL +export GIT_COMMITTER_NAME +git commit --amend --no-edit + # Land the generated commit "${TOPLEVEL}"/contrib/source-control-tools/land-patch.sh "${LAND_PATCH_ARGS[@]}" diff --git a/contrib/source-control-tools/land-patch.sh b/contrib/source-control-tools/land-patch.sh --- a/contrib/source-control-tools/land-patch.sh +++ b/contrib/source-control-tools/land-patch.sh @@ -48,7 +48,6 @@ fi TOPLEVEL=$(git rev-parse --show-toplevel) -# TODO: Autogen (update version numbers, copyright headers, etc.) # Sanity checks "${TOPLEVEL}"/contrib/devtools/smoke-tests.sh diff --git a/contrib/source-control-tools/patch-recipes/update-aur-version.sh b/contrib/source-control-tools/patch-recipes/update-aur-version.sh deleted file mode 100755 --- a/contrib/source-control-tools/patch-recipes/update-aur-version.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# Common script to update the AUR packages. -# Usage: update-aur-version - -TOPLEVEL=$(git rev-parse --show-toplevel) -# shellcheck source=../../utils/compare-version.sh -source "${TOPLEVEL}"/contrib/utils/compare-version.sh -PACKAGE="$1" - -CURRENT_VERSION="" -get_current_version CURRENT_VERSION - -# Get the current version of the AUR package -PKGBUILD="${TOPLEVEL}"/contrib/aur/${PACKAGE}/PKGBUILD -# shellcheck source=../../aur/bitcoin-abc/PKGBUILD -source "${PKGBUILD}" - -# Compare the versions. We only want to update if -# (software version > package version) to prevent downgrades. -if version_less_equal "${CURRENT_VERSION}" "${pkgver}" -then - echo "Current version ${CURRENT_VERSION} <= ${PACKAGE} AUR package version ${pkgver}, skip the update" - exit 0 -fi - -# Reset the release version to 0 and update the package version in the -# PKGBUILD file. -# Note that this pattern is very safe: because of the shell script syntax, -# no whitespace can occur and we have the original value as a variable. -sed -i "s/pkgrel=${pkgrel}/pkgrel=0/" "${PKGBUILD}" -sed -i "s/pkgver=${pkgver}/pkgver=${CURRENT_VERSION}/" "${PKGBUILD}" - -git add "${PKGBUILD}" -git commit -m "Bump ${PACKAGE} AUR package version to ${CURRENT_VERSION}"