From f247d7a4f8f6309058ea67ccc87300311ae7ade0 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Sat, 4 May 2024 14:49:23 +0300 Subject: bin/schedule-for-rebuild: Add --latest flag --- bin/schedule-for-rebuild | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/schedule-for-rebuild b/bin/schedule-for-rebuild index 6c9bfbd..b6eb4f6 100755 --- a/bin/schedule-for-rebuild +++ b/bin/schedule-for-rebuild @@ -43,6 +43,9 @@ usage() { >&2 echo ' Never schedule the given package (for the given $arch).' >&2 echo ' -j|--jostle' >&2 echo ' Give new build assignments the highest priority.' + >&2 echo ' -l|--latest' + >&2 echo ' Only pick the latest version of each package.' + >&2 echo ' (Ignores the build support and community repos.)' >&2 echo ' -n|--no-action:' >&2 echo ' Do not actually schedule anything, just print it.' >&2 echo ' -p|--package $pkg_regex:' @@ -61,7 +64,7 @@ tmp_dir=$(mktemp -d 'tmp.schedule-for-rebuild.XXXXXXXXXX' --tmpdir) trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT eval set -- "$( - getopt -o afhi:jnp:s:tw \ + getopt -o afhi:jnp:s:tlw \ --long auto \ --long force \ --long help \ @@ -71,6 +74,7 @@ eval set -- "$( --long package: \ --long skip-arch: \ --long interactive \ + --long latest \ --long wait \ -n "$(basename "$0")" -- "$@" || \ echo usage @@ -81,6 +85,7 @@ ignore_mysql_generate_package_metadata_errors=false jostle=false update=true interactive=false +latest_package_only=false wait_for_lock='-n' while true @@ -124,6 +129,9 @@ do -t|--interactive) interactive=true ;; + -l|--latest) + latest_package_only=true + ;; -w|--wait) wait_for_lock='' ;; @@ -474,7 +482,11 @@ if [ ! -s "${tmp_dir}/pkgbases" ]; then exit fi -tac "${tmp_dir}/pkgbases" | awk '!seen[$0]++' | tac \ +awkcmd='!seen[$0]++' +if ${latest_package_only}; then + awkcmd='$5!="community" && $5!="build-support" && !seen[$2]++' +fi +tac "${tmp_dir}/pkgbases" | awk "${awkcmd}" | tac \ | sponge "${tmp_dir}/pkgbases" if ${interactive}; then -- cgit v1.2.3-70-g09d2