Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/automated-commits.sh
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
version_less_equal() { | version_less_equal() { | ||||
! version_greater "$1" "$2" | ! version_greater "$1" "$2" | ||||
} | } | ||||
version_less() { | version_less() { | ||||
! version_greater_equal "$1" "$2" | ! version_greater_equal "$1" "$2" | ||||
} | } | ||||
get_current_version() { | get_current_version() { | ||||
local -n CURRENT_VERSION=$1 | |||||
# Get the current version of the software | # Get the current version of the software | ||||
"${DEVTOOLS_DIR}"/build_cmake.sh --no-build | "${DEVTOOLS_DIR}"/build_cmake.sh --no-build | ||||
pushd "$BUILD_DIR" | pushd "$BUILD_DIR" | ||||
CURRENT_VERSION="$(ninja print-version | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" | CURRENT_VERSION="$(ninja print-version | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" | ||||
popd | popd | ||||
echo "${CURRENT_VERSION}" | |||||
} | } | ||||
# Common script to update the AUR packages. | # Common script to update the AUR packages. | ||||
# Usage: update-aur-version <package_name> | # Usage: update-aur-version <package_name> | ||||
update-aur-version() { | update-aur-version() { | ||||
PACKAGE="$1" | PACKAGE="$1" | ||||
CURRENT_VERSION="$(get_current_version)" | CURRENT_VERSION="" | ||||
get_current_version CURRENT_VERSION | |||||
# Get the current version of the AUR package | # Get the current version of the AUR package | ||||
PKGBUILD="${TOPLEVEL}"/contrib/aur/${PACKAGE}/PKGBUILD | PKGBUILD="${TOPLEVEL}"/contrib/aur/${PACKAGE}/PKGBUILD | ||||
# shellcheck source=../aur/bitcoin-abc/PKGBUILD | # shellcheck source=../aur/bitcoin-abc/PKGBUILD | ||||
source "${PKGBUILD}" | source "${PKGBUILD}" | ||||
# Compare the versions. We only want to update if | # Compare the versions. We only want to update if | ||||
# (software version > package version) to prevent downgrades. | # (software version > package version) to prevent downgrades. | ||||
Show All 15 Lines | |||||
} | } | ||||
case "${COMMIT_TYPE}" in | case "${COMMIT_TYPE}" in | ||||
archive-release-notes) | archive-release-notes) | ||||
RELEASE_NOTES_FILE="${TOPLEVEL}/doc/release-notes.md" | 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_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" | RELEASE_NOTES_ARCHIVE="${TOPLEVEL}/doc/release-notes/release-notes-${RELEASE_NOTES_VERSION}.md" | ||||
CURRENT_VERSION="$(get_current_version)" | CURRENT_VERSION="" | ||||
get_current_version CURRENT_VERSION | |||||
# Compare the versions. We only want to archive the release notes if the | # Compare the versions. We only want to archive the release notes if the | ||||
# current version is greater the our release notes version. | # current version is greater the our release notes version. | ||||
if version_less_equal "${CURRENT_VERSION}" "${RELEASE_NOTES_VERSION}" | if version_less_equal "${CURRENT_VERSION}" "${RELEASE_NOTES_VERSION}" | ||||
then | then | ||||
echo "Current version ${CURRENT_VERSION} <= release-notes version ${RELEASE_NOTES_VERSION}, skip the update" | echo "Current version ${CURRENT_VERSION} <= release-notes version ${RELEASE_NOTES_VERSION}, skip the update" | ||||
exit 0 | exit 0 | ||||
fi | fi | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |