1
0
mirror of https://gitlab.alpinelinux.org/alpine/abuild.git synced 2025-04-19 06:42:18 +03:00

functions.sh: move apk_tar from abuild

Allows sharing code with other abuild tools
This commit is contained in:
Sertonix 2025-03-26 17:12:02 +01:00 committed by Natanael Copa
parent 3f5614abbe
commit 6627a52596
2 changed files with 11 additions and 9 deletions

View File

@ -1791,13 +1791,6 @@ human_size() {
printf("%.1f %s\n", y, type[i+2]) }'
}
apk_tar() {
tar --format=posix \
--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,ctime:=0 \
--mtime="@$SOURCE_DATE_EPOCH" \
--no-recursion --null -T - -f - -c "$@"
}
create_apks() {
local file= dir= name= ver= apk= datadir= size= i= gzip=
gzip=$(command -v pigz || echo gzip)
@ -1861,7 +1854,7 @@ create_apks() {
# explicitly sort package content
find "$@" -print0
fi | LC_ALL=C sort -z | apk_tar --xattrs \
fi | LC_ALL=C sort -z | apk_tar -T - --xattrs \
--xattrs-exclude=security.selinux \
--owner-map="$pkgbasedir"/.owner-map \
--group-map="$pkgbasedir"/.group-map \
@ -1875,7 +1868,7 @@ create_apks() {
# control.tar.gz
cd "$dir"
apk_tar < .metafiles | abuild-tar --cut \
apk_tar -T - < .metafiles | abuild-tar --cut \
| $gzip -n -9 > control.tar.gz
abuild-sign -q control.tar.gz || exit 1

View File

@ -246,6 +246,15 @@ any_buildscript() {
fi
}
apk_tar() {
if [ -n "$SOURCE_DATE_EPOCH" ]; then
set -- --mtime="@$SOURCE_DATE_EPOCH" "$@"
fi
tar --format=posix \
--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,ctime:=0 \
--no-recursion --null -f - -c "$@"
}
# output functions
msg() {
[ -n "$quiet" ] && return 0