From 54fed084ba0855d6fe6b223669d3ccff420fbf17 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 23 May 2023 15:31:58 +0200 Subject: clean up duplicate logic and unneeded options --- bin/seed-build-list | 115 +++------------------------------------------------- 1 file changed, 5 insertions(+), 110 deletions(-) (limited to 'bin/seed-build-list') diff --git a/bin/seed-build-list b/bin/seed-build-list index 3303416..d8018a4 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -44,18 +44,13 @@ usage() { >&2 echo ' Do not update the given package (for the given $arch).' >&2 echo ' -j|--jostle' >&2 echo ' Give new build assignments the highest priority.' - >&2 echo ' -m|--mirror $url:' - >&2 echo ' Schedule all packages, that are newer (this includes' - >&2 echo ' packages currently unavailable on archlinux32) on the' - >&2 echo ' given x86_64 mirror - except packages on the blacklist' - >&2 echo ' or in conf/seed-ignore-packages.' >&2 echo ' -n|--no-action:' >&2 echo ' Do not actually update build-list, just print it.' >&2 echo ' -p|--package $pkg_regex:' >&2 echo ' Reschedule packages with matching pkgname or pkgbase.' >&2 echo ' Note, that these packages must be known to the database.' >&2 echo ' -s|--skip-arch $arch:' - >&2 echo ' Ignore packages, that are outdated on $arch only (-a|-m).' + >&2 echo ' Ignore packages, that are outdated on $arch only (-a).' >&2 echo ' -w|--wait:' >&2 echo ' Wait for lock if necessary.' [ -z "$1" ] && exit 1 || exit "$1" @@ -66,13 +61,12 @@ tmp_dir=$(mktemp -d 'tmp.seed-build-list.XXXXXXXXXX' --tmpdir) trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT eval set -- "$( - getopt -o afhi:jm:np:s:w \ + getopt -o afhi:jnp:s:w \ --long auto \ --long force \ --long help \ --long ignore: \ --long jostle \ - --long mirror: \ --long no-action \ --long package: \ --long skip-arch: \ @@ -112,11 +106,6 @@ do -j|--jostle) jostle=true ;; - -m|--mirror) - shift - printf '%s\n' "$1" >> \ - "${tmp_dir}/mirrors" - ;; -n|--no-action) update=false ;; @@ -150,8 +139,7 @@ if [ $# -ne 0 ]; then usage 1 fi -if [ ! -s "${tmp_dir}/mirrors" ] && \ - [ ! -s "${tmp_dir}/package-regexes" ] && \ +if [ ! -s "${tmp_dir}/package-regexes" ] && \ ! ${auto}; then # nothing to do >&2 echo 'No options given to do anything.' @@ -160,9 +148,8 @@ if [ ! -s "${tmp_dir}/mirrors" ] && \ fi if [ -s "${tmp_dir}/skip-archs" ] && \ - ! ${auto} && \ - [ ! -s "${tmp_dir}/mirrors" ]; then - >&2 echo 'Invalid combination of options: -s|--skip-archs requires -m|--mirror or -a|--auto.' + ! ${auto}; then + >&2 echo 'Invalid combination of options: -s|--skip-archs requires -a|--auto.' usage 2 exit 2 fi @@ -184,19 +171,6 @@ if ${update}; then fi fi -# shellcheck disable=SC2016 -repos=$( - { - printf 'SELECT DISTINCT `repositories`.`name`' - printf ' FROM `repositories`' - # shellcheck disable=SC2154 - printf ' WHERE `repositories`.`stability`=%s;\n' \ - "${repository_stability_ids__stable}" - } | \ - mysql_run_query - printf '%s\n' 'multilib' -) - if [ -r "${base_dir}/conf/seed-ignore-packages" ]; then sed ' s@/@\t@ @@ -223,87 +197,8 @@ for list in 'ignore-packages' 'blacklist'; do | sponge "${tmp_dir}/${list}" done -# TODO: translate lib32-* packages instead of ignoring them for -m - touch "${tmp_dir}/skip-archs" -# harvest pkgnames from mirror delta -if [ -s "${tmp_dir}/mirrors" ]; then - { - # theirs - while read -r mirror; do - if [ -z "${mirror}" ]; then - continue - fi - for repo in ${repos}; do - curl -sS "${mirror}/${repo}/os/x86_64/${repo}.db.tar.gz" | \ - tar -Oxz --wildcards '*/desc' | \ - sed ' - /^%FILENAME%$/!d - N - s/^.*\n// - /^lib32-/d - s/^\(.*-\)x86_64\.pkg\.tar\.\(xz\|zst\)$/'"$( - # shellcheck disable=SC2086,SC2154 - printf '%s\n' ${architectures} \ - | grep -vxF 'any' \ - | grep -vxFf "${tmp_dir}/skip-archs" \ - | sed ' - s/^.*$/\\1\0/ - ' \ - | sed ' - :a - $! N - $! ba - s/\n/\\n/g - ' - )"'/ - s/^\(.*-any\)\.pkg\.tar\.\(xz\|zst\)$/\1/ - ' | \ - sed ' - s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)$/theirs \2 \3 \1/ - ' - done - done < \ - "${tmp_dir}/mirrors" - # ours - # shellcheck disable=SC2016 - { - printf 'SELECT ' - mysql_package_name_query - printf ' FROM `binary_packages`' - mysql_join_binary_packages_architectures - printf ' LEFT' - mysql_join_binary_packages_compressions - mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`is_on_master_mirror`' - printf ' OR `repositories`.`name`="build-list"' - } | \ - mysql_run_query | \ - sed ' - s/^\(.*\)-\([^-]\+-[^-.]\+\)\(\.[^-.]\+\)\?-\([^-]\+\)\.pkg\.tar\.\(xz\|zst\)$/ours \2 \4 \1/ - s/^\(.* \)any\( \S\+\)$/\0\n\1i486\2\n\1i686\2\n\1pentium4\2/ - ' - } | \ - expand_version 2 | \ - sort -k3,4 -k2Vr,2 -k1,1 | \ - shrink_version 2 | \ - uniq -f2 | \ - sed -n ' - s/^theirs \(\S\+ \)// - T - p - ' | \ - if [ -r "${tmp_dir}/ignore-packages" ]; then - grep -vxFf "${tmp_dir}/ignore-packages" - else - cat - fi | \ - sort -u >> \ - "${tmp_dir}/pkgnames" -fi - # harvest from the package-regexes if [ -s "${tmp_dir}/package-regexes" ]; then # shellcheck disable=SC2016 -- cgit v1.2.3-54-g00ecf