[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#518348: [PATCH] Add support for decompressing zstd rpm payloads



Package: alien
Version: 8.95

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

Resolves Debian #518348
---
 Alien/Package/Rpm.pm | 15 +++++++++++++--
 debian/control       |  3 +--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm
index d53be2b..b9177d6 100644
--- a/Alien/Package/Rpm.pm
+++ b/Alien/Package/Rpm.pm
@@ -159,9 +159,20 @@ 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 |';
 	}
 
diff --git a/debian/control b/debian/control
index f6f0af0..7e4a873 100644
--- a/debian/control
+++ b/debian/control
@@ -4,12 +4,11 @@ Priority: optional
 Build-Depends: debhelper (>= 9)
 Maintainer: Debian QA Group <packages@qa.debian.org>
 Standards-Version: 3.9.6
-Vcs-Git: git://git.kitenet.net/alien
 Homepage: http://kitenet.net/~joey/code/alien/
 
 Package: alien
 Architecture: all
-Depends: debhelper (>= 7), ${misc:Depends}, ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio, rpm2cpio
+Depends: debhelper (>= 7), ${misc:Depends}, ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio, rpm2cpio, xz-utils, zstd
 Suggests: patch, bzip2, lintian, lzma
 Description: convert and install rpm and other packages
  Alien allows you to convert LSB, Red Hat, Stampede and Slackware Packages
-- 
2.24.1


-- 
Lars Kellogg-Stedman <lars@oddbit.com> | larsks @ {irc,twitter,github}
http://blog.oddbit.com/                | N1LKS


Reply to: