
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]
20 lines
731 B
Bash
20 lines
731 B
Bash
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
|
# only run this, if SOURCE_DATE_EPOCH isn't set.
|
|
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
|
unset SOURCE_DATE_EPOCH
|
|
return 0
|
|
fi
|
|
if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
|
if command -v chroot-git &>/dev/null; then
|
|
GIT_CMD=$(command -v chroot-git)
|
|
elif command -v git &>/dev/null; then
|
|
GIT_CMD=$(command -v git)
|
|
fi
|
|
# check if the template is under version control:
|
|
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 log --pretty='%ct' -n1 HEAD)"
|
|
fi
|
|
fi
|