Description of problem: dnf.rpm.miscutils.rpm2cpio uses gzip directly to decompress RPM payload. This limits the utility to gzip packages only, while most RPM now use other compression methods. The RPM library can be used to handle the decompression directly. This will allow the python utility to support all compression methods supported by RPM and it's command-line utility. Version-Release number of selected component (if applicable): rpm-4.12.0.1-13.fc22.x86_64 dnf-1.1.3-1.fc22.noarch How reproducible: Steps to Reproduce: Actual results: Expected results: Additional info: The method I have been using and appears to work well employs the RPM file handling interface rather than gzip.FZipFile. Unified diff: --- a/dnf/rpm/miscutils.py 2015-10-14 17:40:12.000000000 +0100 +++ b/dnf/rpm/miscutils.py 2015-11-14 11:57:15.814296763 +0000 @@ -17,7 +17,6 @@ from __future__ import unicode_literals import dnf.pycomp import rpm -import gzip import os import sys import locale @@ -148,13 +147,7 @@ del ts compr = hdr[rpm.RPMTAG_PAYLOADCOMPRESSOR] or 'gzip' - #XXX FIXME - #if compr == 'bzip2': - # TODO: someone implement me! - #el - if compr != 'gzip': - raise RpmUtilsError('Unsupported payload compressor: "%s"' % compr) - f = gzip.GzipFile(None, 'rb', None, os.fdopen(fdno, 'rb', bufsize)) + f = rpm.fd.open(fdno, 'r', compr) while 1: tmp = f.read(bufsize) if tmp == "": break
Would you mind creating a pull request? https://github.com/rpm-software-management/dnf
First-time GitHub user, something I've been meaning to try out. Hope I did it right. Pull request #386. Still needs a test build. -- David.
Resolved in GitHub - function will be dropped. https://github.com/rpm-software-management/dnf/pull/386