3

I recently realized that the RPM packages shifted from gzip-compression to xz-compression a few years ago. I need to check is the compression type of an RPM package that I have. I also need to check what compression type is considered by my system when it is trying to unpack an RPM file.

Alchemist
  • 551
  • 3
  • 10
  • 21
  • 1
    Since you're using oracle-linux you should have the script `/usr/lib/rpm/rpm2cpio.sh` - this script works out what type of compression is used and will decompress it. You can probably use that as the basis for checking the compression your rpm package uses. – Stephen Harris Aug 31 '16 at 19:31
  • How can I figure out the compression type with this? – Alchemist Sep 01 '16 at 10:29

3 Answers3

8

Query the RPM with a custom format that includes the Payloadcompressor tag ("Payload compressor name") like this:

rpm -q --queryformat '%{PAYLOADCOMPRESSOR}\n' -p qt-4.8.7-67.fc36.x86_64.rpm

By the way other interesting tags are Payloadflags ("Payload compressor level") and Payloadformat ("Payload format (cpio)").

Cristian Ciupitu
  • 2,430
  • 1
  • 22
  • 29
Colm Lynch
  • 81
  • 1
  • 2
0

If you use rpm2cpio; you don't need to know the compression format. You can use rpm2cpio to unpack rpms like this:

rpm2cpio your.rpm | cpio -idmv
Chris Maes
  • 3,282
  • 3
  • 21
  • 32
0

To address: Which compression formats are supported?

It's easy enough to see what's not supported, e.g. trying to install an RPM from Fedora 34 on RHEL 6:

$ rpm --install https://dl.fedoraproject.org/.../Packages/t/tzdata-2021a-1.fc34.noarch.rpm
error: Failed dependencies:
        rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by tzdata-2021a-1.fc34.noarch

Although this dependency is not explicitly exposed by rpm-libs in a way which can be queried by --whatprovides, we can infer the compression formats supported by rpm-libs.

### why do all compression formats have "z" in the name? It's the fashion.
$ rpm -q --requires rpm-libs | grep '^lib.*z'
libbz2.so.1()(64bit)
liblzma.so.5()(64bit)
liblzma.so.5(XZ_5.0)(64bit)
liblzma.so.5(XZ_5.1.2alpha)(64bit)
libz.so.1()(64bit)

Another way to track this would be the features changes for Fedora etc.:

PhilR
  • 137
  • 6