Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/check-upstream-bug-tracker78
1 files changed, 78 insertions, 0 deletions
diff --git a/bin/check-upstream-bug-tracker b/bin/check-upstream-bug-tracker
new file mode 100755
index 0000000..c6be40a
--- /dev/null
+++ b/bin/check-upstream-bug-tracker
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+# check archlinux' bug tracker for open bugs on packages that fail to build
+
+# shellcheck source=../lib/load-configuration
+. "${0%/*}/../lib/load-configuration"
+
+tmp_dir=$(mktemp -d 'tmp.check-upstream-bug-tracker.XXXXXXXXXX' --tmpdir)
+trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+>&2 printf 'receiving upstream bugs of broken packages '
+
+# shellcheck disable=SC2016
+{
+ printf 'SELECT DISTINCT'
+ printf '`package_sources`.`%s`,' \
+ 'pkgbase' \
+ 'git_revision' \
+ 'mod_git_revision'
+ printf '`upstream_repositories`.`name`'
+ printf ' FROM `package_sources`'
+ mysql_join_package_sources_upstream_repositories
+ mysql_join_package_sources_build_assignments
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_binary_packages_in_repositories
+ printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \
+ "${repository_ids__any_build_list}"
+ 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"
+
+>&2 printf ' done\n'
+
+while [ -s "${tmp_dir}/broken-packages" ]; do
+ identifier=$(
+ head -n1 "${tmp_dir}/broken-packages" | \
+ cut -f1
+ )
+ fs_ids=''
+ OIFS="${IFS}"
+ IFS=$(printf '\n')
+ # shellcheck disable=SC2013
+ for line in $(grep "^$(str_to_regex "${identifier}")\\s" "${tmp_dir}/broken-packages" | cut -f2,3); do
+ IFS="${OIFS}"
+ printf '> '
+ printf '%s\n' "${line}" | \
+ cut -f2
+ printf 'Should we wait (empty = "yes")? '
+ read -r w
+ if [ -z "${w}" ]; then
+ fs_ids="${fs_ids},FS#$(printf '%s\n' "${line}" | cut -f1)"
+ fi
+ done
+ IFS="${OIFS}"
+ if [ -n "${fs_ids}" ]; then
+ printf '%s.any wait for %s\n' \
+ "${identifier}" \
+ "${fs_ids#,}" >> \
+ "${tmp_dir}/block-list"
+ fi
+ sed -i '/^'"$(str_to_regex "${identifier}")"'\s/d' "${tmp_dir}/broken-packages"
+done
+
+if [ -s "${tmp_dir}/block-list" ]; then
+ "${base_dir}/bin/modify-package-state" -w -b "${tmp_dir}/block-list"
+fi