From a4a229cf6428ecca04d50369d010e028414590e5 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Thu, 8 Mar 2018 23:36:06 +0000 Subject: [PATCH] xbps-src: use HEAD commit time for SOURCE_DATE_EPOCH In order to make builds more reproducible SOURCE_DATE_EPOCH was set to the time of the last commit that touched the template. Since trying to reproduce a build from a different revision is futile (the most obvious reason is that the source-revisions property includes the HEAD commit hash) and looking up the commit in question can take several seconds, stop wasting time an just use HEAD. Closes: #12314 [via git-merge-pr] --- common/environment/setup/git.sh | 2 +- etc/defaults.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/environment/setup/git.sh b/common/environment/setup/git.sh index 486a7ac6fb7..2932624a072 100644 --- a/common/environment/setup/git.sh +++ b/common/environment/setup/git.sh @@ -14,6 +14,6 @@ if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then if $GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} status -u normal --porcelain template | grep "^?? " &> /dev/null; then export SOURCE_DATE_EPOCH="$(stat -c %Y ${XBPS_SRCPKGDIR}/${basepkg}/template)" else - export SOURCE_DATE_EPOCH="$($GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} log --pretty='%ct' -n1 .)" + export SOURCE_DATE_EPOCH="$($GIT_CMD log --pretty='%ct' -n1 HEAD)" fi fi diff --git a/etc/defaults.conf b/etc/defaults.conf index 2326184cfe3..bd1322921d5 100644 --- a/etc/defaults.conf +++ b/etc/defaults.conf @@ -121,6 +121,6 @@ XBPS_SUCMD="sudo /bin/sh -c" # [OPTIONAL] # Enable to use the standard mtime of files. Otherwise it will be rewritten to -# the last commit time of the package. +# the HEAD commit time. # #XBPS_USE_BUILD_MTIME=yes