summaryrefslogtreecommitdiff
path: root/app-arch/alien/files/alien-8.95-rpm-zstd.patch
blob: 89e2ce31e57bbc9a839dd08c109b70e739326d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 08e8768b07065b32e1aa9ccb3adae79a157bbfbc Mon Sep 17 00:00:00 2001
From: Lars Kellogg-Stedman <lars@oddbit.com>
Date: Tue, 13 Aug 2024 22:02:30 +0300
Subject: [PATCH] Add support for decompressing zstd rpm payloads

Recent (Fedora 32 and later) versions of Fedora have switched to
using zstd to compress rpm payloads.

https://bugs.debian.org/518348
--- a/Alien/Package/Rpm.pm
+++ b/Alien/Package/Rpm.pm
@@ -159,9 +159,19 @@ sub unpack {
 	$this->SUPER::unpack(@_);
 	my $workdir=$this->unpacked_tree;
 	
-	# Check if we need to use lzma to uncompress the cpio archive
+	# Check if we need to uncompress the cpio archive
 	my $decomp='';
-	if ($this->do("rpm2cpio '".$this->filename."' | lzma -t -q > /dev/null 2>&1")) {
+	if ($this->do("rpm2cpio '".$this->filename."' | xz -t -q > /dev/null 2>&1")) {
+		# we first check xz (previously lzma) because this is the
+		# most common compression type at the moment.
+		$decomp = 'xz -d -q |';
+	} elsif ($this->do("rpm2cpio '".$this->filename."' | zstd -t -q > /dev/null 2>&1")) {
+		# we next check zstd, which is used by newer (Fedora 32 and later)
+		# rpms.
+		$decomp = 'zstd -d -q |';
+	} elsif ($this->do("rpm2cpio '".$this->filename."' | lzma -t -q > /dev/null 2>&1")) {
+		# We check lzma last in case we're on an older system with
+		# only lzma and no xz
 		$decomp = 'lzma -d -q |';
 	}
 
-- 
2.45.2