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  <br...@clisp.org>

        MODULES.html.sh: Support for reproducible builds from git-less tarballs.
        Reported by Bernhard M. Wiedemann <bwiedem...@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}."
 


Reply via email to