Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2024-05-04 14:49:23 +0300
committerTasos Sahanidis <tasos@tasossah.com>2024-05-04 14:49:23 +0300
commitf247d7a4f8f6309058ea67ccc87300311ae7ade0 (patch)
tree062407005bfa6e749e8fd0cef342d117860181cc
parent63f20943f0fa9e884c13a4318ae6db1de75dc6a1 (diff)
bin/schedule-for-rebuild: Add --latest flag
-rwxr-xr-xbin/schedule-for-rebuild16
1 files 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