mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-13 10:33:35 +00:00
abuild: get the git commit date only when needed
getting the commit date can be timeconsuming so only do it once we need it. We also re-use the ABUILD_LAST_COMMIT to speed up the operation.
This commit is contained in:
parent
114c0cf287
commit
71d9d5233b
20
abuild.in
20
abuild.in
@ -1608,6 +1608,17 @@ build_abuildrepo() {
|
|||||||
logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
|
logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
|
||||||
local _starttime=$(date --utc +%s)
|
local _starttime=$(date --utc +%s)
|
||||||
msg "Building $repo/$pkgname $pkgver-r$pkgrel (using $program $program_version) started $(date -R)"
|
msg "Building $repo/$pkgname $pkgver-r$pkgrel (using $program $program_version) started $(date -R)"
|
||||||
|
|
||||||
|
# set time stamp for reproducible builds
|
||||||
|
export ABUILD_LAST_COMMIT="$(git_last_commit)$(git_dirty)"
|
||||||
|
if [ -z "$SOURCE_DATE_EPOCH" ] && [ "${ABUILD_LAST_COMMIT%-dirty}" = "$ABUILD_LAST_COMMIT" ]; then
|
||||||
|
SOURCE_DATE_EPOCH=$(git_last_commit_epoch $ABUILD_LAST_COMMIT)
|
||||||
|
fi
|
||||||
|
if [ -z "$SOURCE_DATE_EPOCH" ]; then
|
||||||
|
SOURCE_DATE_EPOCH=$(date -u "+%s")
|
||||||
|
fi
|
||||||
|
export SOURCE_DATE_EPOCH
|
||||||
|
|
||||||
for part in sanitycheck builddeps clean fetch unpack prepare mkusers build \
|
for part in sanitycheck builddeps clean fetch unpack prepare mkusers build \
|
||||||
$_check rootpkg; do
|
$_check rootpkg; do
|
||||||
runpart $part
|
runpart $part
|
||||||
@ -1891,6 +1902,7 @@ rootpkg() {
|
|||||||
cd "$startdir"
|
cd "$startdir"
|
||||||
rm -rf "$pkgdir"
|
rm -rf "$pkgdir"
|
||||||
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
|
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
|
||||||
|
|
||||||
do_fakeroot "$abuild_path" $forceroot $color_opt $keep_build \
|
do_fakeroot "$abuild_path" $forceroot $color_opt $keep_build \
|
||||||
package \
|
package \
|
||||||
prepare_subpackages \
|
prepare_subpackages \
|
||||||
@ -2556,14 +2568,6 @@ BUILD_ROOT=
|
|||||||
|
|
||||||
export CC CXX
|
export CC CXX
|
||||||
|
|
||||||
if [ -z "$SOURCE_DATE_EPOCH" ]; then
|
|
||||||
SOURCE_DATE_EPOCH=$(git_last_commit_epoch)
|
|
||||||
fi
|
|
||||||
if [ -z "$SOURCE_DATE_EPOCH" ]; then
|
|
||||||
SOURCE_DATE_EPOCH=$(date -u "+%s")
|
|
||||||
fi
|
|
||||||
export SOURCE_DATE_EPOCH
|
|
||||||
|
|
||||||
cd "$startdir" || die
|
cd "$startdir" || die
|
||||||
. "$APKBUILD"
|
. "$APKBUILD"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user