From 529bbc67fffd78a1e70c69fc91fb718c7ee3bce9 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 8 Jul 2023 15:05:19 -0400 Subject: [PATCH 1/2] ci: add step to verify the functionality of update-check --- .github/workflows/build.yaml | 9 +++++++++ common/travis/verify-update-check.sh | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 common/travis/verify-update-check.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 657712414657..2856661aca5e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -120,3 +120,12 @@ jobs: cd / "$here/common/travis/check-install.sh" "$BOOTSTRAP" "$ARCH" ) + + - name: Verify update-check + if: matrix.config.arch == 'x86_64' # no point in running this multiple times + run: | + ( + here="$(pwd)" + cd / + "$here/common/travis/verify-update-check.sh" + ) diff --git a/common/travis/verify-update-check.sh b/common/travis/verify-update-check.sh new file mode 100755 index 000000000000..b5624921306d --- /dev/null +++ b/common/travis/verify-update-check.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# runs update-check on all changed templates, then errors only if there was an +# issue with the update-check. does not error if further updates are available, +# as there may be a good reason not to update to those versions + +set -e + +xbps-install -Syu curl grep +export XBPS_UPDATE_CHECK_VERBOSE=yes +err=0 + +while read -r pkg; do + /bin/echo -e "\x1b[34mVerifying update-check of $pkg:\x1b[0m" + ./xbps-src update-check "$pkg" 2>&1 > /tmp/update-check.log || err=1 + cat /tmp/update-check.log + if grep -q 'NO VERSION' /tmp/update-check.log; then + echo "::warning file=srcpkgs/$pkg/template,line=1,title=update-check failed::verify and fix update-check for $pkg" + fi +done < /tmp/templates + +exit $err From c85e2aff6b2c3ac05405af53206282ad9affffc1 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 8 Jul 2023 15:34:58 -0400 Subject: [PATCH 2/2] common/xbps-src/shutils/update_check: add ability to disable update-check useful for cases where update checking does not make sense or is impossible --- Manual.md | 4 ++++ common/xbps-src/shutils/update_check.sh | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Manual.md b/Manual.md index 63f10f354582..56ded0559d49 100644 --- a/Manual.md +++ b/Manual.md @@ -905,6 +905,10 @@ in url. Defaults to `(|v|$pkgname)[-_.]*`. part that follows numeric part of version directory in url. Defaults to `(|\.x)`. +- `disabled` can be set to disable update checking for the package, +in cases where checking for updates is impossible or does not make sense. +This should be set to a string describing why it is disabled. + ### Handling patches diff --git a/common/xbps-src/shutils/update_check.sh b/common/xbps-src/shutils/update_check.sh index e656cf06fbcc..882764100577 100644 --- a/common/xbps-src/shutils/update_check.sh +++ b/common/xbps-src/shutils/update_check.sh @@ -13,6 +13,9 @@ update_check() { if [ "$XBPS_UPDATE_CHECK_VERBOSE" ]; then echo "using $XBPS_TARGET_PKG/update overrides" 1>&2 fi + if [ -n "$disabled" ]; then + echo "update-check DISABLED for $original_pkgname: $disabled" 1>&2 + fi elif [ -z "$distfiles" ]; then if [ "$XBPS_UPDATE_CHECK_VERBOSE" ]; then echo "NO DISTFILES found for $original_pkgname" 1>&2