Create LATEST-X.[0N] links when running the first X-rc
authorAlexandre Oliva <lxoliva@fsfla.org>
Wed, 11 May 2022 02:59:40 +0000 (22:59 -0400)
committerAlexandre Oliva <lxoliva@fsfla.org>
Wed, 11 May 2022 02:59:40 +0000 (22:59 -0400)
mkgitrel.cln
mkgitrel.pub
mkgitrel.rel

index 214fdd1128ece405a0615607831dbc32b91fd073..5098b6d845f9fbd95adeccc59f677e95e3780031 100755 (executable)
@@ -45,8 +45,22 @@ elif test -h $reldir/LATEST-$rup.N; then
   prev0=$(readlink $reldir/LATEST-$cbr.0)
   prevn=$(readlink $reldir/LATEST-$cbr.N)
 else
-  echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
-  exit 1
+  case $rup in
+  *-rc*)
+    prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,')
+    if test -h $reldir/LATEST-$prevbase.N; then
+      prev0=$(readlink $reldir/LATEST-$prevbase.N)
+      prevn=$prev0
+    else
+      echo $reldir/LATEST-$prevbase.N does not exit >&2
+      exit 1
+    fi
+    ;;
+  *)
+    echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
+    exit 1
+    ;;
+  esac
 fi
 
 for up in linus stable; do
index c851c30beafb3cd390a964f72703f2a3b3c53ed9..6c9ac9019684e7d9fc0f7c24c55ab9eb81ea077d 100755 (executable)
@@ -45,8 +45,22 @@ elif test -h $reldir/LATEST-$rup.N; then
   prev0=$(readlink $reldir/LATEST-$cbr.0)
   prevn=$(readlink $reldir/LATEST-$cbr.N)
 else
-  echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
-  exit 1
+  case $rup in
+  *-rc*)
+    prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,')
+    if test -h $reldir/LATEST-$prevbase.N; then
+      prev0=$(readlink $reldir/LATEST-$prevbase.N)
+      prevn=$prev0
+    else
+      echo $reldir/LATEST-$prevbase.N does not exit >&2
+      exit 1
+    fi
+    ;;
+  *)
+    echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
+    exit 1
+    ;;
+  esac
 fi
 
 DATE=$(git cat-file -p incr/v$rel |
index 86a8028e29f9b3ee8934cc088500784d4ef5f57a..84e3c71103eb78e3db9d8f8df588832792cd9049 100755 (executable)
@@ -45,8 +45,22 @@ elif test -h $reldir/LATEST-$rup.N; then
   prev0=$(readlink $reldir/LATEST-$cbr.0)
   prevn=$(readlink $reldir/LATEST-$cbr.N)
 else
-  echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
-  exit 1
+  case $rup in
+  *-rc*)
+    prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,')
+    if test -h $reldir/LATEST-$prevbase.N; then
+      prev0=$(readlink $reldir/LATEST-$prevbase.N)
+      prevn=$prev0
+    else
+      echo $reldir/LATEST-$prevbase.N does not exit >&2
+      exit 1
+    fi
+    ;;
+  *)
+    echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2
+    exit 1
+    ;;
+  esac
 fi
 
 if test -f linux-libre-$rel.check; then
@@ -108,6 +122,8 @@ ln -snfv $rel $reldir/LATEST-$cbr.N &&
 if test "$rup" = "$cbr"; then
   ln -nfv $reldir/LATEST-$cbr.N $reldir/LATEST-$cbr.0 &&
   ln -nfv $reldir/LATEST-$cbr.N $reldir/LATEST-${cbr%.*}.N
+elif test -n "$prevbase" && test ! -h $reldir/LATEST-$cbr.0; then
+  ln -nfv $reldir/LATEST-$prevbase.N $reldir/LATEST-$cbr.0
 fi &&
 
 git worktree remove logs/v$rel &&