commit 6fdcdbf

Michael Forney  ·  2025-04-28 21:27:49 +0000 UTC
parent 8bbe95e
Use our own pax for extracting archives

This reduces dependencies and variability in pax implementations.
4 files changed,  +8, -11
+5, -1
 1@@ -392,12 +392,16 @@ end
 2 
 3 function fetch(method)
 4 	local script
 5+	local deps = {'|', '$dir/ver', script}
 6 	if method == 'local' then
 7 		script = '$dir/fetch.sh'
 8 	else
 9 		script = '$basedir/scripts/fetch-'..method..'.sh'
10+		if method == 'curl' then
11+			table.insert(deps, '$builddir/pkg/pax/host/pax')
12+		end
13 	end
14-	build('fetch', '$dir/fetch', {'|', '$dir/ver', script}, {script=script})
15+	build('fetch', '$dir/fetch', deps, {script=script})
16 	if basedir ~= '.' then
17 		build('phony', '$gendir/fetch', '$dir/fetch')
18 	end
+1, -1
1@@ -125,7 +125,7 @@ rule fspec-tar
2   command = $builddir/pkg/fspec-sync/host/fspec-tar <$in | zstd >$out
3 
4 rule fetch
5-  command = cd $basedir && sh $$OLDPWD/$script $gendir && touch $$OLDPWD/$out
6+  command = cd $basedir && PAX=$$OLDPWD/$builddir/pkg/pax/host/pax sh $$OLDPWD/$script $gendir && touch $$OLDPWD/$out
7   description = 	FETCH	$gendir
8   restat = 1
9   generator = 1
+1, -8
 1@@ -8,11 +8,4 @@ case $file in
 2 *) exit 0
 3 esac
 4 
 5-if command -v bsdtar >/dev/null; then
 6-	exec bsdtar -xf "$file" "$@"
 7-elif command -v pax >/dev/null; then
 8-	"$tool" -d -c "$file" | pax -r "$@"
 9-else
10-	printf '%s: bsdtar or pax is required' "$0" >&2
11-	exit 1
12-fi
13+"$tool" -d -c "$file" | "$PAX" -r "$@"
+1, -1
1@@ -20,7 +20,7 @@ if ! sh "$OLDPWD/scripts/checksum.sh" -c sha256 2>/dev/null ; then
2 fi
3 
4 while read -r _ archive ; do
5-	sh "$OLDPWD/scripts/extract.sh" "$archive" -s ',^[^/]*,src,' '*/*'
6+	sh "$OLDPWD/scripts/extract.sh" "$archive" -s ',^[^/]*,src,'
7 done <sha256
8 
9 if [ -d patch ] ; then