environment/build: overwrite __DATE__, __TIME__, and __TIMESTAMP__ macros.

This commit overwrites timestamps that depend on timestamps with the
commit date of a package.
This commit is contained in:
Enno Boland 2016-02-29 08:46:40 +01:00
parent a34576cac3
commit 3c04642877
6 changed files with 25 additions and 20 deletions

View file

@ -0,0 +1,10 @@
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
# only run this, if XBPS_COMMIT_TIMESTAMP isn't set
if [ -z "$XBPS_USE_BUILD_MTIME" ] && [ -z "${XBPS_COMMIT_TIMESTAMP}" ]; 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
export XBPS_COMMIT_TIMESTAMP="$($GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} log --pretty='%ci' --date=iso -n1 .)"
fi