summaryrefslogtreecommitdiff
path: root/src-release.sh
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-10-10 11:28:45 +0100
committerNick Clifton <nickc@redhat.com>2022-10-10 11:28:45 +0100
commitf54c53e9f4e01ba19a2b3a664fee42798b60e38a (patch)
tree31f4c45a1f7f4922d1e38767a3a0f4a3dd89441f /src-release.sh
parentc29a6445a981cee5e8eebe3617ef5c049fd3409f (diff)
downloadbinutils-gdb-f54c53e9f4e01ba19a2b3a664fee42798b60e38a.tar.gz
Add ability to create reproducible source tarballs.
* src-release.sh: Add "-r <date>" option to create reproducible tarballs based upon a fixed timestamp of <date>. * binutils/README-how-to-make-a-release: Add a line showing how to use -r <date> when creating a binutils release.
Diffstat (limited to 'src-release.sh')
-rwxr-xr-xsrc-release.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/src-release.sh b/src-release.sh
index 079b545ae7c..76c355a583c 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -30,6 +30,7 @@ SHA256PROG=sha256sum
MAKE=make
CC=gcc
CXX=g++
+release_date=
# Default to avoid splitting info files by setting the threshold high.
MAKEINFOFLAGS=--split-size=5000000
@@ -184,9 +185,17 @@ do_tar()
ver=$2
echo "==> Making $package-$ver.tar"
rm -f $package-$ver.tar
- find $package-$ver -follow \( $CVS_NAMES \) -prune \
- -o -type f -print \
- | tar cTfh - $package-$ver.tar
+ if test x$release_date == "x" ; then
+ find $package-$ver -follow \( $CVS_NAMES \) -prune -o -type f -print \
+ | tar cTfh - $package-$ver.tar
+ else
+ # Attempt to create a consistent, reproducible tarball using the
+ # specified date.
+ find $package-$ver -follow \( $CVS_NAMES \) -prune -o -type f -print \
+ | LC_ALL=C sort \
+ | tar cTfh - $package-$ver.tar \
+ --mtime=$release_date --group=0 --owner=0
+ fi
}
# Compress the output with bzip2
@@ -340,6 +349,7 @@ usage()
echo " -g: Compress with gzip"
echo " -l: Compress with lzip"
echo " -x: Compress with xz"
+ echo " -r <date>: Create a reproducible tarball using <date> as the mtime"
exit 1
}
@@ -363,7 +373,7 @@ build_release()
compressors=""
-while getopts ":bglx" opt; do
+while getopts ":bglr:x" opt; do
case $opt in
b)
compressors="$compressors bz2";;
@@ -371,6 +381,8 @@ while getopts ":bglx" opt; do
compressors="$compressors gz";;
l)
compressors="$compressors lz";;
+ r)
+ release_date=$OPTARG;;
x)
compressors="$compressors xz";;
\?)