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:
|
|
|
|
if $GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} status --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 .)"
|
|
|
|
fi
|
2016-02-29 08:46:40 +01:00
|
|
|
fi
|