[pacman-dev] [PATCH] libmakepkg: Support zstd decompression

Morten Linderud foxboron at archlinux.org
Sun Feb 21 21:36:31 UTC 2021


From: Morten Linderud <morten at linderud.pw>

This enables us to extract files in the source array and ensures that we
can decompress files if the uncompressed signature is served.

Signed-off-by: Morten Linderud <morten at linderud.pw>
---
 scripts/libmakepkg/integrity/verify_signature.sh.in | 3 ++-
 scripts/libmakepkg/source/file.sh.in                | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/integrity/verify_signature.sh.in b/scripts/libmakepkg/integrity/verify_signature.sh.in
index 2be5c493..2960ebbe 100644
--- a/scripts/libmakepkg/integrity/verify_signature.sh.in
+++ b/scripts/libmakepkg/integrity/verify_signature.sh.in
@@ -134,7 +134,7 @@ verify_file_signature() {
 	fi
 
 	found=0
-	for ext in "" gz bz2 xz lrz lzo Z; do
+	for ext in "" gz bz2 xz lrz lzo Z zst; do
 		if sourcefile="$(get_filepath "${file%.*}${ext:+.$ext}")"; then
 			found=1
 			break
@@ -152,6 +152,7 @@ verify_file_signature() {
 		xz)  decompress="xz -c -d" ;;
 		lrz) decompress="lrzip -q -d" ;;
 		lzo) decompress="lzop -c -d -q" ;;
+		zst) decompress="zstd -d -q -f" ;;
 		Z)   decompress="uncompress -c -f" ;;
 		"")  decompress="cat" ;;
 	esac
diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in
index b29aeb04..cbaab315 100644
--- a/scripts/libmakepkg/source/file.sh.in
+++ b/scripts/libmakepkg/source/file.sh.in
@@ -118,6 +118,11 @@ extract_file() {
 				xz) cmd="xz" ;;
 				*) return;;
 			esac ;;
+		*application/zstd*)
+			case "$ext" in
+				zst) cmd="zstd" ;;
+				*) return;;
+			esac ;;
 		*)
 			# See if bsdtar can recognize the file
 			if bsdtar -tf "$file" -q '*' &>/dev/null; then
-- 
2.30.1


More information about the pacman-dev mailing list