public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andreas Schwab <schwab@suse.de>,
	Binutils <binutils@sourceware.org>,
	Nick Clifton via Gdb-patches <gdb-patches@sourceware.org>,
	Tzvetelin Katchov <katchov@gnu.org>, Sam James <sam@gentoo.org>
Subject: Re: RFC: Sort tarballs created by the src-release.sh script
Date: Wed, 5 Oct 2022 13:23:48 +0100	[thread overview]
Message-ID: <c512c0f6-5c3b-294c-69e5-5377518a93ce@redhat.com> (raw)
In-Reply-To: <94778afd-a6ec-59b6-c8f9-c60aca991bc3@suse.com>

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

Hi Guys,

On 10/4/22 08:10, Jan Beulich wrote:
> Every commit should be considered to affect the tarball, imo, as such
> effects could also be indirect. If you really wanted to go that route,
> then perhaps an alternative would be to use the commit date of the
> most recent commit touching bfd/version.m4.

Hmm, except that would probably only be appropriate for binutils tarballs,
not others.

So how about the attached patch ?  This one adds a new command line option to
src-release.sh.  If it is not used then the behaviour is not changed in any
way.  If the new option is used, it provides a date that is passed to tar's
--mtime option, along with triggering the use of sort and the other tar
options necessary to make a reproducible tarball.  So:

   src-release.sh -x -r `git log -1 --format=%cd --date=format:%F bfd/version.m4` binutils

should create a pretty consistent tarball.

Cheers
   Nick



[-- Attachment #2: src-release.sh.patch --]
[-- Type: text/x-patch, Size: 1656 bytes --]

diff --git a/src-release.sh b/src-release.sh
index 079b545ae7c..6e16cb00992 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 tarall 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";;
 	\?)

  reply	other threads:[~2022-10-05 12:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 12:59 Nick Clifton
2022-09-28 13:05 ` Andreas Schwab
2022-09-28 13:34   ` Nick Clifton
2022-09-29 12:24     ` Nick Clifton
2022-09-29 12:36       ` Jan Beulich
2022-09-30 11:38         ` Nick Clifton
2022-10-02  7:54           ` Sam James
2022-10-02  7:54             ` Sam James
2022-10-03  6:55             ` Jan Beulich
2022-10-03  6:59               ` Sam James
2022-10-03  7:41                 ` Andreas Schwab
2022-10-03 14:40               ` Nick Clifton
2022-10-03 19:56                 ` Andreas Schwab
2022-10-04  7:10                 ` Jan Beulich
2022-10-05 12:23                   ` Nick Clifton [this message]
2022-10-05 13:00                     ` Jan Beulich
2022-10-03  7:47             ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c512c0f6-5c3b-294c-69e5-5377518a93ce@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jbeulich@suse.com \
    --cc=katchov@gnu.org \
    --cc=sam@gentoo.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).