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