]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Release tools: fix several bugs in version number detection
authorMaria Matejka <mq@ucw.cz>
Thu, 3 Apr 2025 18:03:50 +0000 (20:03 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 3 Apr 2025 18:30:06 +0000 (20:30 +0200)
Forgetting to do proper checks, I merged a buggy release tools update
not detecting the right version (mostly if tagged).

tools/gendist
tools/make-archive
tools/version

index 2dc42ba90208b70fbdd3d0d31c4c9584bef44a77..2caa11696c637aeb7a525ba978f911a3d91c2915 100755 (executable)
@@ -5,7 +5,8 @@
 #  (c) 2005--2022 Ondrej Filip <feela@network.cz>
 #
 
-VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
+#VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
+VERSION=`tools/version | sed 's/^v//'`
 REL=bird-$VERSION
 DREL=bird-doc-$VERSION
 T=/tmp/bird
@@ -24,6 +25,7 @@ $AC
 rm -rf autom4te*cache
 echo Building $REL
 cp -a . $T/$REL
+sed -i 's/^VERSION := .*/VERSION := '${VERSION}'/' $T/$REL/Makefile.in
 echo Generating ChangeLog
 git log  >$T/$REL/ChangeLog
 rm -f $T/$REL/bird.conf*
index b543687b26c76a153592ac73e39e87a68801fb74..1b3f0df5eb721bb3f1af572dd2607cb67f4e8f60 100755 (executable)
 set -e
 
 # Gather all required information
-VERSION="$($(dirname $0)/version)"
+VERSION="$($(dirname $0)/version | sed 's/^v//')"
 
-SRCPKG="bird-$VERSION"
-DOCPKG="bird-doc-$VERSION"
+SRCPKG="bird-${VERSION}"
+DOCPKG="bird-doc-${VERSION}"
 
 if [ -z "$ARCHIVE_DOCS" ]; then
   ARCHIVE_DOCS=true
index 13a00e9a8553436c38c9b97e7b0485bd332a2cde..d8e14821d95a6ae9985f85962ad7424517a4131f 100755 (executable)
@@ -1,5 +1,12 @@
 #!/bin/bash
 
+# Aren't we directly at version?
+TAG=$(git tag | grep -F $(git describe))
+if [ -n "$TAG" ]; then
+  echo $TAG
+  exit 0
+fi
+
 # Get version tag
 # Uses 'git log ...' insted of 'git tag --merged' to support older distros
 TAG=$(git log --oneline --pretty=format:"%d" \
@@ -7,17 +14,6 @@ TAG=$(git log --oneline --pretty=format:"%d" \
     | head -n 1 \
     | sed -n 's/^ (tag:\ v//p' | sed -n 's/\(,.*\|)\)//p')
 
-# Pack with zeros if needed
-TM=$TAG
-while [ -n "${TM/*.*.*/}" ]; do
-  TM="${TM}.0"
-done
-
-if [ "$(git rev-parse HEAD)" == "$(git rev-parse v${TAG})" ]; then
-  echo $TM
-  exit 0
-fi
-
 HASH=$(git rev-parse --short=12 HEAD)
 
 # Add branch info if not passed via command line
@@ -29,9 +25,9 @@ fi
 # Found a branch
 if [ -n "$BRANCH" ]; then
   LENGTH=$(git log --oneline v$TAG..HEAD | wc -l)
-  echo $TM+branch.$(echo $BRANCH | sed 's/[^a-zA-Z0-9]/./g').${HASH}
+  echo $TAG+branch.$(echo $BRANCH | sed 's/[^a-zA-Z0-9]/./g').${HASH}
   exit 0
 fi
 
-echo $TM+detached.${HASH}
+echo $TAG+detached.${HASH}
 exit 0