From 08e8768b07065b32e1aa9ccb3adae79a157bbfbc Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman 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