From d3920662d2aac315c421188346bf7822c275a856 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 20 Apr 2018 10:26:54 +0200 Subject: bin/modify-package-state: compare checksum for stabilizing and marking as faulty --- bin/modify-package-state | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'bin/modify-package-state') diff --git a/bin/modify-package-state b/bin/modify-package-state index 64be18c..7336b66 100755 --- a/bin/modify-package-state +++ b/bin/modify-package-state @@ -9,7 +9,7 @@ usage() { >&2 echo '' >&2 echo 'modify-package-state [options] packages-file:' - >&2 echo ' modify state (file) of package(s).' + >&2 echo ' modify state of package(s).' >&2 echo '' >&2 echo 'possible options:' >&2 echo ' -b|--block: Block package(s).' @@ -20,7 +20,7 @@ usage() { >&2 echo ' -u|--unblock: Unblock package(s).' >&2 echo ' -w|--wait: Wait for lock if necessary.' >&2 echo '' - >&2 echo 'Exactly one of -b|-t|-u is needed for actual operation.' + >&2 echo 'Exactly one of -b|-f|-t|-u is needed for actual operation.' [ -z "$1" ] && exit 1 || exit "$1" } @@ -140,10 +140,11 @@ if ! flock ${wait_for_lock} 8; then exit fi -while read -r package reason; do +while read -r a b; do case "${action}" in 'faulty'|'tested') - # we expect a binary package identifier (pkgname-epoch:pkgver-pkgrel.sub_pkgrel-arch[".pkg.tar.xz"]) + # we expect a sha512sum and binary package identifier + # (pkgname-epoch:pkgver-pkgrel.sub_pkgrel-arch[".pkg.tar.xz"]) # and we will only operate on packages in "testing" repositories # shellcheck disable=SC2016 combiner=$( @@ -154,14 +155,15 @@ while read -r package reason; do ) # shellcheck disable=SC2016,SC2031 selector=$( - extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name "${package}" + extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name "${b}" printf 'WHERE `repository_stabilities`.`name`="testing"' printf ' AND `binary_packages`.`%s`=from_base64("%s")' \ 'pkgname' "$(printf '%s' "${pkgname}" | base64 -w0)" \ 'epoch' "$(printf '%s' "${epoch}" | base64 -w0)" \ 'pkgver' "$(printf '%s' "${pkgver}" | base64 -w0)" \ 'pkgrel' "$(printf '%s' "${pkgrel}" | base64 -w0)" \ - 'sub_pkgrel' "$(printf '%s' "${sub_pkgrel}" | base64 -w0)" + 'sub_pkgrel' "$(printf '%s' "${sub_pkgrel}" | base64 -w0)" \ + 'sha512sum' "$(printf '%s' "${a}" | base64 -w0)" printf ' AND `architectures`.`name`=from_base64("%s")' \ "$(printf '%s' "${arch}" | base64 -w0)" ) @@ -180,8 +182,8 @@ while read -r package reason; do ) # shellcheck disable=SC2016 selector=$( - repository="${package##*.}" - pkgbase="${package%.*}" + repository="${a##*.}" + pkgbase="${a%.*}" mod_git_revision="${pkgbase##*.}" pkgbase="${pkgbase%.*}" git_revision="${pkgbase##*.}" @@ -202,15 +204,15 @@ while read -r package reason; do esac case "${action}" in 'block') - if [ -z "${reason}" ]; then - >&2 printf 'No reason is given for blocking package "%s".\n' "${package}" + if [ -z "${b}" ]; then + >&2 printf 'No reason is given for blocking package "%s".\n' "${a}" exit 2 fi tester='1' # shellcheck disable=SC2016 modifier=$( printf '`build_assignments`.`is_blocked`=from_base64("%s")' \ - "$(printf '%s' "${reason}" | base64 -w0)" + "$(printf '%s' "${b}" | base64 -w0)" ) ;; 'unblock') @@ -245,7 +247,7 @@ while read -r package reason; do printf ';\n' } | \ mysql_run_query - printf '%s %s\n' "${action}" "${package}" + printf '%s %s\n' "${action}" "${a}" fi done \ < "${input_file}" \ -- cgit v1.2.3