Red Hat Bugzilla – Bug 1282024
Have rpm2cpio use rpm libraries for decompression
Last modified: 2016-01-29 08:32:23 EST
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):
Steps to Reproduce:
The method I have been using and appears to work well employs the RPM file handling interface rather than gzip.FZipFile.
--- 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
@@ -148,13 +147,7 @@
compr = hdr[rpm.RPMTAG_PAYLOADCOMPRESSOR] or 'gzip'
- #XXX FIXME
- #if compr == 'bzip2':
- # TODO: someone implement me!
- 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)
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.
Resolved in GitHub - function will be dropped.