[commit: ghc] master: Make git-committer inferred version-date TZ-invariant (bab5109)

git at git.haskell.org git at git.haskell.org
Mon Dec 28 22:07:10 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/bab51097701aaf2d890196a351fd3614a66c79dd/ghc

>---------------------------------------------------------------

commit bab51097701aaf2d890196a351fd3614a66c79dd
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Mon Dec 28 22:55:24 2015 +0100

    Make git-committer inferred version-date TZ-invariant
    
    The existing code suffers from the issue of converting the
    committer date to localtime, thereby resulting in varying
    inferred dates for the same commit-hash depending on the currently
    set local timezone.
    
    In order to have a universally unique mapping between commit-hashes and
    their snapshot-version-date it's better to convert to the date expressed
    in a fixed timezone like e.g. UTC.
    
    Sadly, `git` doesn't seem to provide a way to directly format dates the
    way we need it, so we shell out to `perl` for this.
    
    Reviewers: austin, thomie, erikd, bgamari
    
    Differential Revision: https://phabricator.haskell.org/D1711


>---------------------------------------------------------------

bab51097701aaf2d890196a351fd3614a66c79dd
 aclocal.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index e823f34..8e97726 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1458,10 +1458,11 @@ if test "$RELEASE" = "NO"; then
         AC_MSG_RESULT(given $PACKAGE_VERSION)
     elif test -d .git; then
         changequote(, )dnl
-        ver_date=`git log -n 1 --date=short --pretty=format:%ci | cut -d ' ' -f 1 | tr -d -`
+        ver_posixtime=`git log -1 --pretty=format:%ct`
+        ver_date=`perl -MPOSIX -e "print strftime('%Y%m%d', gmtime($ver_posixtime));"`
         if echo $ver_date | grep '^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' 2>&1 >/dev/null; then true; else
         changequote([, ])dnl
-                AC_MSG_ERROR([failed to detect version date: check that git is in your path])
+                AC_MSG_ERROR([failed to detect version date: check that git and perl are in your path])
         fi
         PACKAGE_VERSION=${PACKAGE_VERSION}.$ver_date
         AC_MSG_RESULT(inferred $PACKAGE_VERSION)



More information about the ghc-commits mailing list