Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/check-upstream-bug-tracker
diff options
context:
space:
mode:
Diffstat (limited to 'bin/check-upstream-bug-tracker')
-rwxr-xr-xbin/check-upstream-bug-tracker64
1 files changed, 62 insertions, 2 deletions
diff --git a/bin/check-upstream-bug-tracker b/bin/check-upstream-bug-tracker
index 71754d0..90d4145 100755
--- a/bin/check-upstream-bug-tracker
+++ b/bin/check-upstream-bug-tracker
@@ -1,10 +1,61 @@
#!/bin/sh
-# check archlinux' bug tracker for open bugs on packages that fail to build
-
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
+# shellcheck disable=SC2016
+usage() {
+ >&2 echo ''
+ >&2 echo 'check-upstrea-bug-tracker: check archlinux'"'"' bug tracker'
+ >&2 echo 'for open bugs on packages that fail to build'
+ >&2 echo ''
+ >&2 echo 'possible options:'
+ >&2 echo ' -h|--help: Show this help and exit.'
+ >&2 echo ' -f|--failure $identifier:'
+ >&2 echo ' only check packages which fail due to $identifier'
+ [ -z "$1" ] && exit 1 || exit "$1"
+}
+
+eval set -- "$(
+ getopt -o f:h \
+ --long failure: \
+ --long help \
+ -n "$(basename "$0")" -- "$@" || \
+ echo usage
+)"
+identifier=''
+
+while true
+do
+ case "$1" in
+ -f|--failure)
+ shift
+ if [ -n "${identifier}" ]; then
+ >&2 echo 'Option -i only allowed once.'
+ usage
+ fi
+ identifier="$1"
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ >&2 echo 'Whoops, forgot to implement option "'"$1"'" internally.'
+ exit 42
+ ;;
+ esac
+ shift
+done
+
+if [ $# -ne 0 ]; then
+ >&2 echo 'Too many arguments.'
+ usage
+fi
+
tmp_dir=$(mktemp -d 'tmp.check-upstream-bug-tracker.XXXXXXXXXX' --tmpdir)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
@@ -21,6 +72,15 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
printf ' FROM `package_sources`'
mysql_join_package_sources_upstream_repositories
mysql_join_package_sources_build_assignments
+ if [ -n "${identifier}" ]; then
+ mysql_join_build_assignments_failed_builds
+ mysql_join_failed_builds_fail_reasons
+ printf ' AND `fail_reasons`.`name`=from_base64("%s")' \
+ "$(
+ printf '%s' "${identifier}" | \
+ base64 -w0
+ )"
+ fi
mysql_join_build_assignments_binary_packages
mysql_join_binary_packages_binary_packages_in_repositories
printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \