summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2024-01-25 13:23:39 +0100
committerJean Delvare <jdelvare@suse.de>2024-01-25 13:23:39 +0100
commit4eaaa52d3aff977d55ce00a612ec9acbe34c60e1 (patch)
tree845827958c026143548fa66943d500c04dd83db2
parent6d2a050654bbbb7be46fe91bd114de39cdeebad5 (diff)
downloadquilt-4eaaa52d3aff977d55ce00a612ec9acbe34c60e1.tar.gz
Add support for zst archives
Add support for zstd compressed archives (*.tar.zst) and patches. [JD: Change the file output match pattern to "Zstandard compressed data" to prevent false positives.]
-rw-r--r--quilt/push.in3
-rw-r--r--quilt/scripts/patchfns.in8
-rw-r--r--quilt/setup.in8
3 files changed, 16 insertions, 3 deletions
diff --git a/quilt/push.in b/quilt/push.in
index 2a30a9a..ef39978 100644
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -125,6 +125,9 @@ apply_patch()
elif [ "${patch_file:(-3)}" = ".lz" ]
then
lzip -cd "$patch_file" | "$@" 2>&1
+ elif [ "${patch_file:(-4)}" = ".zst" ]
+ then
+ zstd -cd "$patch_file" | "$@" 2>&1
else
"$@" -i "$patch_file" 2>&1
fi
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index b03644b..276c27e 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -527,7 +527,7 @@ find_patch()
local patch=${1#$SUBDIR_DOWN$QUILT_PATCHES/}
local bre=$(quote_sed_re "$patch")
- set -- $(sed -e "/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\|\.xz\|\.lzma\|\.lz\)\([ "$'\t'"]\|$\)/!d" \
+ set -- $(sed -e "/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\|\.xz\|\.lzma\|\.lz\|\.zst\)\([ "$'\t'"]\|$\)/!d" \
-e 's/[ '$'\t''].*//' "$SERIES")
if [ $# -eq 1 ]
then
@@ -795,6 +795,8 @@ cat_file()
lzma -cd "$filename" ;;
*.lz)
lzip -cd "$filename" ;;
+ *.zst)
+ zstd -cd "$filename" ;;
*)
cat "$filename" ;;
esac
@@ -837,6 +839,8 @@ cat_to_new_file()
lzma -c ;;
*.lz)
lzip -c ;;
+ *.zst)
+ zstd -c ;;
*)
cat ;;
esac \
@@ -999,7 +1003,7 @@ next_filename()
{
local patch=$1 base num
base=$(echo "$patch" \
- | sed -r -e 's:(\.gz|\.bz2|\.xz|\.lzma|\.lz)$::' -e 's:(\.diff?|\.patch)$::')
+ | sed -r -e 's:(\.gz|\.bz2|\.xz|\.lzma|\.lz|\.zst)$::' -e 's:(\.diff?|\.patch)$::')
num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p)
[ -n "$num" ] || num=1
echo "${base%-$num}-$((num+1))${patch#$base}"
diff --git a/quilt/setup.in b/quilt/setup.in
index d3a97f0..50973f7 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -126,7 +126,7 @@ create_md5sums()
;;
# In fast mode, we are only interested in patches, so filter out
# archives
- *.tar|*.tar.Z|*.tar.gz|*.tgz|*.tar.bz2|*.tar.xz|*.tar.lz|*.zip|*.7z)
+ *.tar|*.tar.Z|*.tar.gz|*.tgz|*.tar.bz2|*.tar.xz|*.tar.lz|*.tar.zst|*.zip|*.7z)
[ -n "$QUILT_SETUP_FAST" ] && continue
;;
esac
@@ -182,6 +182,12 @@ create_md5sums()
set -- $(lzip -cd "$file" | md5sum)
echo "$1 $basename"
;;
+ "Zstandard compressed data"*)
+ echo -n "z" >&4
+ echo "zstd -cd $file | md5sum" >&5
+ set -- $(zstd -cd "$file" | md5sum)
+ echo "$1 $basename"
+ ;;
esac
done > $output
echo >&4