diff options
-rwxr-xr-x | bin/check-upstream-bug-tracker | 45 |
1 files 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@^.*<td class='"'"'task_id'"'"'><a href="https://bugs\.archlinux\.org/task/\([0-9]\+\)?.*<td class='"'"'task_summary'"'"'><a href=[^>]\+>\(.*\)</a></td>.*$@\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@^.*<td class='"'"'task_id'"'"'><a href="https://bugs\.archlinux\.org/task/\([0-9]\+\)?.*<td class='"'"'task_summary'"'"'><a href=[^>]\+>\(.*\)</a></td>.*$@\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' |