Adapt release-tools/release.sh for pre-3.0 versions
authorRichard Levitte <levitte@openssl.org>
Thu, 30 Mar 2023 11:53:51 +0000 (13:53 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 16 May 2023 03:54:35 +0000 (05:54 +0200)
There are small differences, such as some make targets not existing,
the method for creating tarballs being different in 1.0.2, ...

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/tools/pull/140)

release-tools/release.sh

index 9c020905194a8b667c45d07665d2129e2f7465bd..00d552ec26212e481e8548f72b6253de3740c3d9 100755 (executable)
@@ -345,7 +345,9 @@ update_branch="$orig_branch"
 release_branch="$(std_branch_name)"
 
 # among others, we only create a release branch if the patch number is zero
-if [ "$update_branch" = "$release_branch" ] || [ $PATCH -ne 0 ]; then
+if [ "$update_branch" = "$release_branch" ] \
+       || [ -z "$PATCH" ] \
+       || [ $PATCH -ne 0 ]; then
     if $do_branch && $warn_branch; then
         echo >&2 "Warning! We're already in a release branch; --branch ignored"
     fi
@@ -414,10 +416,12 @@ make update >&42
 # As long as we're doing an alpha release, we can have symbols without specific
 # numbers assigned. In a beta or final release, all symbols MUST have an
 # assigned number.
-if [ "$next_method" != 'alpha' ]; then
+if [ "$next_method" != 'alpha' ] && grep -q '^renumber *:' Makefile; then
     make renumber >&42
 fi
-make update-fips-checksums >&42
+if grep -q '^update-fips-checksums *:' Makefile; then
+    make update-fips-checksums >&42
+fi
 
 if [ -n "$(git status --porcelain)" ]; then
     $VERBOSE "== Committing updates"
@@ -476,10 +480,16 @@ announce=openssl-$release.txt
 echo "== Generating tar, hash and announcement files.  This make take a bit of time"
 
 $VERBOSE "== Making tarfile: $tgzfile"
-# Unfortunately, util/mktar.sh does verbose output on STDERR...  for good
-# reason, but it means we don't display errors unless --verbose
-./util/mktar.sh --tarfile="../$tarfile" 2>&1 \
-    | while read L; do $VERBOSE "> $L"; done
+
+# Unfortunately, some tarball generators do verbose output on STDERR...  for
+# good reason, but it means we don't display errors unless --verbose
+(
+    if [ -f ./util/mktar.sh ]; then
+        ./util/mktar.sh --tarfile="../$tarfile" 2>&1
+    else
+        make DISTTARVARS=TARFILE="../$tarfile" dist 2>&1
+    fi
+) | while read L; do $VERBOSE "> $L"; done
 
 if ! [ -f "../$tgzfile" ]; then
     echo >&2 "Where did the tarball end up? (../$tgzfile)"