* [PATCH] MODULES.html.sh: handle tarball builds
@ 2020-03-24 9:06 Bernhard M. Wiedemann
2020-04-10 12:26 ` Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Bernhard M. Wiedemann @ 2020-03-24 9:06 UTC (permalink / raw
To: bug-gnulib; +Cc: Bernhard M. Wiedemann, Bruno Haible
Distributions typically build binaries from release tarballs
that do not contain a .git directory.
In such a setup the git log would fail.
This patch provides a fallback that still allows for reproducibility.
See https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
This also replaces the git log line with a simpler equivalent.
CC: Bruno Haible <bruno@clisp.org>
---
MODULES.html.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/MODULES.html.sh b/MODULES.html.sh
index b1638dada..0151670cc 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -3695,7 +3695,10 @@ func_echo '<LI>A POT file and some PO files'
func_end UL
func_echo '<HR>'
-git_checkout_date=`git log -n 1 --date=iso --format=fuller | sed -n -e 's/^CommitDate: //p'`
+git_checkout_date=`PAGER= git log -n 1 --format=%ci`
+if [ -z "$git_checkout_date" ] ; then
+ git_checkout_date=@${SOURCE_DATE_EPOCH:-`date +%s`}
+fi
pretty_date=`LC_ALL=C date +"%e %B %Y" --date="$git_checkout_date"`
func_echo "Generated by <CODE>MODULES.html.sh</CODE> from a git checkout as of ${pretty_date}."
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MODULES.html.sh: handle tarball builds
2020-03-24 9:06 [PATCH] MODULES.html.sh: handle tarball builds Bernhard M. Wiedemann
@ 2020-04-10 12:26 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2020-04-10 12:26 UTC (permalink / raw
To: Bernhard M. Wiedemann; +Cc: bug-gnulib
Hi Bernhard,
> Distributions typically build binaries from release tarballs
> that do not contain a .git directory.
> In such a setup the git log would fail.
I did not know that, as I'm not in the distro business.
> This patch provides a fallback that still allows for reproducibility.
As I wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00061.html>,
the date is important for the readers of the generated file.
If the .git directory is not present, let's use the ChangeLog instead.
2020-04-10 Bruno Haible <bruno@clisp.org>
MODULES.html.sh: Support for reproducible builds from git-less tarballs.
Reported by Bernhard M. Wiedemann <bwiedemann@suse.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00061.html>.
* MODULES.html.sh: In a git-less tarball, use the date of the first
ChangeLog entry.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index b1638da..d1ec78f 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -3695,7 +3695,11 @@ func_echo '<LI>A POT file and some PO files'
func_end UL
func_echo '<HR>'
-git_checkout_date=`git log -n 1 --date=iso --format=fuller | sed -n -e 's/^CommitDate: //p'`
+git_checkout_date=`if test -d .git; then
+ git log -n 1 --date=iso --format=fuller | sed -n -e 's/^CommitDate: //p';
+ else
+ sed -n -e 's/^\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*/\1/p' -e 1q ChangeLog;
+ fi`
pretty_date=`LC_ALL=C date +"%e %B %Y" --date="$git_checkout_date"`
func_echo "Generated by <CODE>MODULES.html.sh</CODE> from a git checkout as of ${pretty_date}."
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-10 12:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-24 9:06 [PATCH] MODULES.html.sh: handle tarball builds Bernhard M. Wiedemann
2020-04-10 12:26 ` Bruno Haible
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).