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 similarity index 93% 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 index 7299221c9..75a571f5a 100755 --- a/contrib/source-control-tools/patch-recipes/archive-release-notes.sh +++ b/contrib/source-control-tools/autogen-recipes/50-archive-release-notes.sh @@ -1,33 +1,32 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail TOPLEVEL=$(git rev-parse --show-toplevel) # shellcheck source=../../utils/compare-version.sh source "${TOPLEVEL}"/contrib/utils/compare-version.sh RELEASE_NOTES_FILE="${TOPLEVEL}/doc/release-notes.md" RELEASE_NOTES_VERSION=$(sed -n "1s/^Bitcoin ABC version \([0-9]\+\.[0-9]\+\.[0-9]\+\).\+$/\1/p" "${RELEASE_NOTES_FILE}") RELEASE_NOTES_ARCHIVE="${TOPLEVEL}/doc/release-notes/release-notes-${RELEASE_NOTES_VERSION}.md" CURRENT_VERSION="" get_current_version CURRENT_VERSION # Compare the versions. We only want to archive the release notes if the # current version is greater the our release notes version. if version_less_equal "${CURRENT_VERSION}" "${RELEASE_NOTES_VERSION}" then echo "Current version ${CURRENT_VERSION} <= release-notes version ${RELEASE_NOTES_VERSION}, skip the update" exit 0 fi # Archive the release notes cp "${RELEASE_NOTES_FILE}" "${RELEASE_NOTES_ARCHIVE}" # Generate a fresh blank release notes file for the new version 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 index 000000000..0c9f31a4b --- /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 index e0741ecbc..3e063350f 100755 --- a/contrib/source-control-tools/automated-commits.sh +++ b/contrib/source-control-tools/automated-commits.sh @@ -1,86 +1,102 @@ #!/usr/bin/env bash # Note: Any bot running this script must have the appropriate permissions to # push commits upstream. When running locally, this script will git push in a # dry run by default. export LC_ALL=C.UTF-8 set -euxo pipefail help_message() { cat < - -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}"