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.
|
2020-04-22 15:59:26 +02:00
|
|
|
|
|
|
|
|
|
if [ -z "$XBPS_GIT_CMD" ]; then
|
2021-02-22 21:24:47 +01:00
|
|
|
|
if [ -z "$XBPS_USE_BUILD_MTIME" ] || [ -n "$XBPS_USE_GIT_REVS" ]; then
|
|
|
|
|
msg_error "BUG: environment/setup: XBPS_GIT_CMD is not set\n"
|
|
|
|
|
fi
|
2020-04-22 15:59:26 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2016-03-08 05:22:12 +01:00
|
|
|
|
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
|
|
|
|
unset SOURCE_DATE_EPOCH
|
2020-04-20 19:14:49 +02:00
|
|
|
|
elif [ -z "${SOURCE_DATE_EPOCH}" ]; then
|
|
|
|
|
if [ -n "$IN_CHROOT" ]; then
|
|
|
|
|
msg_error "xbps-src's BUG: SOURCE_DATE_EPOCH is undefined\n"
|
|
|
|
|
fi
|
2016-03-06 12:52:20 +01:00
|
|
|
|
# check if the template is under version control:
|
2020-04-20 19:14:49 +02:00
|
|
|
|
if [ -n "$basepkg" -a -z "$($XBPS_GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} ls-files template)" ]; then
|
2016-03-06 12:52:20 +01:00
|
|
|
|
export SOURCE_DATE_EPOCH="$(stat -c %Y ${XBPS_SRCPKGDIR}/${basepkg}/template)"
|
|
|
|
|
else
|
2021-09-28 16:43:51 +02:00
|
|
|
|
export SOURCE_DATE_EPOCH=$($XBPS_GIT_CMD cat-file commit HEAD |
|
|
|
|
|
sed -n '/^committer /{s/.*> \([0-9][0-9]*\) [-+][0-9].*/\1/p;q}')
|
2016-03-06 12:52:20 +01:00
|
|
|
|
fi
|
2016-02-29 08:46:40 +01:00
|
|
|
|
fi
|
2020-04-21 17:52:38 +02:00
|
|
|
|
|
|
|
|
|
# if XBPS_USE_GIT_REVS is enabled in conf file,
|
|
|
|
|
# compute XBPS_GIT_REVS to use in pkg hooks
|
|
|
|
|
if [ -z "$XBPS_USE_GIT_REVS" ]; then
|
|
|
|
|
unset XBPS_GIT_REVS
|
|
|
|
|
elif [ -z "$XBPS_GIT_REVS" ]; then
|
|
|
|
|
if [ -n "$IN_CHROOT" ]; then
|
|
|
|
|
msg_error "xbps-src's BUG: XBPS_GIT_REVS is undefined\n"
|
|
|
|
|
else
|
|
|
|
|
export XBPS_GIT_REVS="$($XBPS_GIT_CMD -C "${XBPS_DISTDIR}" rev-parse --verify --short HEAD)"
|
|
|
|
|
fi
|
|
|
|
|
fi
|