Commit 71d9d523 authored by Natanael Copa's avatar Natanael Copa

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.
parent 114c0cf2
...@@ -1608,6 +1608,17 @@ build_abuildrepo() { ...@@ -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() { ...@@ -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= ...@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment