makepkg: Unify source time for reproducible source tarballs

This commit is contained in:
Samuel Dionne-Riel 2024-12-14 00:37:33 -05:00
parent ea79eac19f
commit af68f192af

View file

@ -683,6 +683,9 @@ create_srcpackage() {
if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then
local absfile
absfile=$(get_filepath "$file") || missing_source_file "$file"
if (( REPRODUCIBLE )); then
touch -d @$SOURCE_DATE_EPOCH "$absfile"
fi
msg2 "$(gettext "Adding %s...")" "${absfile##*/}"
ln -s "$absfile" "$srclinks/$pkgbase"
fi
@ -724,6 +727,12 @@ create_srcpackage() {
local fullver=$(get_full_version)
local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
if (( REPRODUCIBLE )); then
# We have activated reproducible builds, so unify source times before
# building
find "${srclinks}/${pkgbase}" -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
fi
# tar it up
msg2 "$(gettext "Compressing source package...")"
cd_safe "${srclinks}"