From 02f0b8cd4f34b5ce9b375eae70a010a975edd07b Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 14 Sep 2019 09:17:44 +0200 Subject: check-upstream-bug-tracker: added -p option for specific package checks --- bin/check-upstream-bug-tracker | 45 ++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/bin/check-upstream-bug-tracker b/bin/check-upstream-bug-tracker index 95b6239..a82cc88 100755 --- a/bin/check-upstream-bug-tracker +++ b/bin/check-upstream-bug-tracker @@ -14,20 +14,24 @@ usage() { >&2 echo ' only check packages which fail on $arch' >&2 echo ' -f|--failure $identifier:' >&2 echo ' only check packages which fail due to $identifier' + >&2 echo ' -p|--package $package:' + >&2 echo ' only check package $package (can be given multiple times)' >&2 echo ' -h|--help: Show this help and exit.' [ -z "$1" ] && exit 1 || exit "$1" } eval set -- "$( - getopt -o a:f:h \ + getopt -o a:f:p:h \ --long architecture: \ --long failure: \ + --long package: \ --long help \ -n "$(basename "$0")" -- "$@" || \ echo usage )" architecture='' identifier='' +packages='' while true do @@ -48,6 +52,10 @@ do fi identifier="$1" ;; + -p|--package) + shift + packages="$packages $1" + ;; -h|--help) usage 0 ;; @@ -108,18 +116,29 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT printf ' AND `build_assignments`.`is_broken`' printf ' AND `build_assignments`.`is_blocked` IS NULL;\n' } | \ - mysql_run_query 'unimportant' | \ - while read -r pkgbase git_revision mod_git_revision repository; do - >&2 printf '.' - curl -Ssg 'https://bugs.archlinux.org/index.php?string=['"${pkgbase}"']&project=5&status[]=open' | \ - sed -n ' - s@^.*]\+>\(.*\).*$@\1\t\2@ - T - s/^/'"${pkgbase}.${git_revision}.${mod_git_revision}.${repository}"'\t/ - p - ' - done > \ - "${tmp_dir}/broken-packages" +mysql_run_query 'unimportant' \ +> "${tmp_dir}/broken-packages-candidates" + +# explicit package list overwrites select broken packages from database +if [ -n "${packages}" ]; then + for p in $packages; do + grep "$p" "${tmp_dir}/broken-packages-candidates" >> "${tmp_dir}/filtered-broken-packages-candidates" + done + mv "${tmp_dir}/filtered-broken-packages-candidates" "${tmp_dir}/broken-packages-candidates" +fi + +while read -r pkgbase git_revision mod_git_revision repository; do + >&2 printf '.' + curl -Ssg 'https://bugs.archlinux.org/index.php?string=['"${pkgbase}"']&project=5&status[]=open' | \ + sed -n ' + s@^.*]\+>\(.*\).*$@\1\t\2@ + T + s/^/'"${pkgbase}.${git_revision}.${mod_git_revision}.${repository}"'\t/ + p + ' +done > \ +"${tmp_dir}/broken-packages" \ +< "${tmp_dir}/broken-packages-candidates" >&2 printf ' done\n' -- cgit v1.2.3-70-g09d2