From 9b7f27cfc6405f753c66809c5b1bdb70b396a089 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 28 Sep 2018 10:59:06 +0200 Subject: bin/check-upstream-bug-tracker new for easily blocking packages that are broken upstream --- bin/check-upstream-bug-tracker | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 bin/check-upstream-bug-tracker 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@^.*]\+>\(.*\).*$@\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 -- cgit v1.2.3-70-g09d2