promote: Print meaningful message when pool dir is missing
authorChristoph Berg <myon@debian.org>
Thu, 23 May 2024 11:41:52 +0000 (13:41 +0200)
committerChristoph Berg <myon@debian.org>
Thu, 23 May 2024 11:41:52 +0000 (13:41 +0200)
repo/promote

index e2d2ca28e667cd0e1119b057cc4670744d9bc4ef..6423ea561e84e52c2732bec1589fce1efea6f400 100755 (executable)
@@ -57,8 +57,12 @@ if [ -z "$NEWVERSION" ]; then
        exit 1
 fi
 INITIAL=$(echo $PKG | grep -Eo '^(lib)?.')
-test -d /srv/apt/repo/pool/$COMPONENT/$INITIAL/$PKG/
-BINARIES=$(ls /srv/apt/repo/pool/$COMPONENT/$INITIAL/$PKG/*deb | sed -e 's!.*/!!' -e 's/_.*//' | sort -u)
+POOLDIR="/srv/apt/repo/pool/$COMPONENT/$INITIAL/$PKG"
+if ! test -d $POOLDIR; then
+  echo "$POOLDIR is missing (did you mean promote -c NN ?)"
+  exit 1
+fi
+BINARIES=$(ls $POOLDIR/*deb | sed -e 's!.*/!!' -e 's/_.*//' | sort -u)
 OTHERBINARIES=$(echo "$BINARIES" | while read b; do if [ "$b" != "$PKG" ]; then echo "$b"; fi; done)
 
 if [ -z "${QUIET:-}" ]; then
@@ -91,7 +95,7 @@ fi
 NEWSHORTVERSION=$(echo "$NEWVERSION" | sed -e 's/.*://')
 
 if [ "$OLDVERSION" ]; then
-       SOMEDEB=$(ls /srv/apt/repo/pool/$COMPONENT/$INITIAL/$PKG/*$NEWSHORTVERSION*deb | head -1)
+       SOMEDEB=$(ls $POOLDIR/*$NEWSHORTVERSION*deb | head -1)
        CHANGES=$(LANGUAGE= LANG=C.UTF-8 apt-listchanges -f text --which=both --since=$OLDVERSION $SOMEDEB | grep -Fv 'Reading changelogs...')
        CHANGESTEXT="$CHANGES"
 else