SCRIPTS: publish-release: pass -n to gzip to remove timestamp
authorWilly Tarreau <w@1wt.eu>
Sat, 30 May 2020 04:59:07 +0000 (06:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Jun 2020 09:12:14 +0000 (11:12 +0200)
It just appeared that the tar.gz we put online are not reproducible
because a timestamp is put by default into the archive. Passing "-n"
to gzip is sufficient to remove this timestamp, so let's do it, and
also make the gzip command configurable for more flexibility. Now
issuing the commands multiple times finally results in the same
archives being produced.

This should be backported to supported stable branches.

(cherry picked from commit 6fab3e6d91bff843dcb289172c8b7a5dd54062ac)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

scripts/publish-release

index 6a615a6..abde56f 100755 (executable)
@@ -9,6 +9,7 @@
 #   - shows a listing of the final file
 
 USAGE="Usage: ${0##*/} [-a] [-q] [-y] [-b branch] [-n newver] DIR"
+CMD_GZIP="${CMD_GZIP:-gzip -nc9}"
 TARGET_DIR=
 OUTPUT=
 SAYYES=
@@ -161,7 +162,7 @@ fi
 echo "Archiving sources for version $NEW ..."
 rm -f "${TARGET_DIR}/src${DEVEL}/haproxy-${NEW}.tar.gz"{,.md5,.sha256}
 if ! git archive --format=tar --prefix="haproxy-${NEW}/" "v$NEW" | \
-     gzip -9 > "${TARGET_DIR}/src${DEVEL}/haproxy-${NEW}.tar.gz"; then
+     $CMD_GZIP > "${TARGET_DIR}/src${DEVEL}/haproxy-${NEW}.tar.gz"; then
        die "Failed to produce the tar.gz archive"
 fi
 
@@ -174,7 +175,7 @@ git show "v$NEW:CHANGELOG" > "$TARGET_DIR/src/CHANGELOG"
 
 for i in "${DOC[@]}"; do
        git show "v$NEW:$i" > "$TARGET_DIR/doc/${i#doc/}"
-       gzip -c9 < "$TARGET_DIR/doc/${i#doc/}" > "$TARGET_DIR/doc/${i#doc/}.gz"
+       $CMD_GZIP < "$TARGET_DIR/doc/${i#doc/}" > "$TARGET_DIR/doc/${i#doc/}.gz"
 done
 
 echo "Done : ls -l ${TARGET_DIR}"