]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts: Fix sync-pull so it still supports older than Octopus 1549/head
authorDavid Galloway <dgallowa@redhat.com>
Fri, 10 Apr 2020 13:39:56 +0000 (09:39 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 10 Apr 2020 13:39:56 +0000 (09:39 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
scripts/sync-pull
scripts/sync-push

index 3556e04ace8f34cd13e6c2f6b9b026954ce965c9..041e929d51f8f4d13912bef53aefe1aa05262469 100644 (file)
@@ -38,18 +38,33 @@ for endpoint in https://chacra.ceph.com/repos/$project/$release/$sha1/$highest_c
   fi
 done
 
-# Get numerical version number and create directory tree
-version=$(echo $chacra_repo_status | python -mjson.tool | grep \"version\" | awk '{ print $2 }' | sed 's/"//g')
-[[ -d /opt/repos/$project/$release-$version ]] | mkdir -p /opt/repos/$project/$release-$version/{debian/jessie,centos/{7,8}}
+# We started using the new /opt/repos/ceph/$release-X.X.X format with Octopus.
+# Older releases have all packages in one big $release dir without a trailing "-X.X.X" so we need to adjust paths accordingly.
+if [[ "$release" =~ ^[a-n].* ]]; then
+  newgen=false
+else
+  newgen=true
+  # Get numerical version number (we only need this with Octopus or later because of the new directory/path scheme).
+  version=$(echo $chacra_repo_status | python -mjson.tool | grep \"version\" | awk '{ print $2 }' | sed 's/"//g')
+  [[ -d /opt/repos/$project/$release-$version ]] | mkdir -p /opt/repos/$project/$release-$version/{debian/jessie,centos/{7,8}}
+fi
 
 # 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-$version/debian/jessie/"
+if $newgen; then
+  deb_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/$highest_combo/flavors/default/* /opt/repos/$project/$release-$version/debian/jessie/"
+else
+  deb_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/$highest_combo/flavors/default/* /opt/repos/$project/$release/debian/jessie/"
+fi
 echo $deb_cmd
 echo "--------------------------------------------"
 rsync -Lavh -e 'ssh -p 2222' --progress --exclude '*lockfile*' $deb_cmd
 
 for el_version in 7 8; do
-  el_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/centos/$el_version/flavors/default/* /opt/repos/$project/$release-$version/centos/$el_version/"
+  if $newgen; then
+    el_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/centos/$el_version/flavors/default/* /opt/repos/$project/$release-$version/centos/$el_version/"
+  else
+    el_cmd="ubuntu@chacra.ceph.com:/opt/repos/$project/$release/$sha1/centos/$el_version/flavors/default/* /opt/repos/$project/$release/centos/$el_version/"
+  fi
   echo $el_cmd
   echo "--------------------------------------------"
   rsync -Lavh -e 'ssh -p 2222' --progress $el_cmd
index 74d838c9bfa897d368df481e8037ef9ca2db2a25..9aa2479530b1a22db0be4b0946ba465c1eab404b 100644 (file)
@@ -15,13 +15,13 @@ ceph_sync() {
   for path in /opt/repos/ceph/$release*; do
 
     # We started using the new /opt/repos/ceph/$release-X.X.X format with Octopus.
-    # Older releases have all packages in one big $release dir without a dash.
-    if echo $path | grep -s '-'; then
-      # Octopus and later
-      newgen=true
-    else
+    # Older releases have all packages in one big $release dir without a trailing "-X.X.X" so we need to adjust paths accordingly.
+    if [[ "$release" =~ ^[a-n].* ]]; then
       # Nautilus and older
       newgen=false
+    else
+      # Octopus and newer
+      newgen=true
     fi
 
     if $newgen; then