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]
This commit is contained in:
Michael Gehring 2018-03-08 23:36:06 +00:00
parent f65e2182cc
commit a4a229cf64
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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