2016-02-29 07:46:40 +00:00
|
|
|
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
2016-03-02 06:45:51 +00:00
|
|
|
# only run this, if SOURCE_DATE_EPOCH isn't set.
|
2016-03-08 04:22:12 +00:00
|
|
|
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
|
|
|
unset SOURCE_DATE_EPOCH
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
2016-02-29 07:46:40 +00:00
|
|
|
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
|
2016-03-06 11:52:20 +00:00
|
|
|
# check if the template is under version control:
|
2017-11-24 13:10:00 +00:00
|
|
|
if $GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} status -u normal --porcelain template | grep "^?? " &> /dev/null; then
|
2016-03-06 11:52:20 +00:00
|
|
|
export SOURCE_DATE_EPOCH="$(stat -c %Y ${XBPS_SRCPKGDIR}/${basepkg}/template)"
|
|
|
|
else
|
2018-03-14 15:47:56 +00:00
|
|
|
export SOURCE_DATE_EPOCH="$($GIT_CMD -C ${XBPS_DISTDIR} log --pretty='%ct' -n1 HEAD)"
|
2016-03-06 11:52:20 +00:00
|
|
|
fi
|
2016-02-29 07:46:40 +00:00
|
|
|
fi
|