Re: RFC: Sort tarballs created by the src-release.sh script

Nick Clifton via Gdb-patches
2022-09-30T11:38:36Z

Hi Guys,

Right, here is the latest and greatest - and hopefully last - version
of the patch. I added a parseable string to the --mtime option and a
comment explaining why these options are being used.

Any more comments/suggestions ?

Cheers
Nick

diff --git a/src-release.sh b/src-release.sh
index 079b545ae7c..8a2ac125030 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -184,9 +184,11 @@ do_tar()
ver=$2
echo "==> Making $package-$ver.tar"
rm -f $package-$ver.tar
+ # The sort command and --mtime, --group and --owner options are
+ # used in order to create consistent, reproducible tarballs.
find $package-$ver -follow \( $CVS_NAMES \) -prune \
- -o -type f -print \
- | tar cTfh - $package-$ver.tar
+ -o -type f -print | LC_ALL=C sort \
+ | tar cTfh - $package-$ver.tar --mtime="1970-01-01 00:00:00" --group=0 --owner=0
}

# Compress the output with bzip2