From 1fa894e8e9a35a68c7344949f68b50a8c8a1f224 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 12 Dec 2018 14:24:50 -0500 Subject: [PATCH] sync-pull: Find the chacra repo with the most packages This works around the known chacra issue where multiple repos get built using the same packages. Only one of the distro/version combinations will have *all* the built packages in it though. Signed-off-by: David Galloway --- scripts/sync-pull | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/sync-pull b/scripts/sync-pull index 2debfe00..f3b09759 100644 --- a/scripts/sync-pull +++ b/scripts/sync-pull @@ -11,7 +11,21 @@ sha1=${3} echo "sync for: $project $release" echo "********************************************" -deb_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/debian/jessie/flavors/default/* /opt/repos/$project/$release/debian/jessie/" + +# This ugly loop check all possible DEB combinations to see which repo has the most packages since that's likely the repo you want to sync. +current_highest_count=0 +for combo in debian/jessie debian/stretch ubuntu/trusty ubuntu/xenial ubuntu/bionic; do + combo_count=$(curl -s https://chacra.ceph.com/r/$project/$release/$sha1/${combo}/flavors/default/pool/main/c/ceph/ | wc -l) + if [ $combo_count -gt $current_highest_count ]; then + current_highest_count=$combo_count + highest_combo=$combo + fi +done + +echo "Found the most packages ($current_highest_count) in $highest_combo." + +# Replace $highest_combo with your own DISTRO/VERSION if you don't want to sync from the repo with the most packages. +deb_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/$highest_combo/flavors/default/* /opt/repos/$project/$release/debian/jessie/" echo $deb_cmd echo "--------------------------------------------" rsync -Lavh -e 'ssh -p 2222' --progress $deb_cmd -- 2.39.5