[Yum] [PATCH] Add bzip2, lzma support to rpm2cpio()

Ville Skyttä ville.skytta at iki.fi
Sun Jan 25 22:18:16 UTC 2009


Hello,

The attached patch adds support for bzip2 and lzma payloads to rpm2cpio().  
lzma support was done using pyliblzma from https://launchpad.net/pyliblzma

We discussed this patch previously in private mail with James, he wasn't quite 
satisfied with the patch, continuing discussion here per his request:

> On Friday 23 January 2009, James Antill wrote:
>> Ville Skyttä <ville.skytta at iki.fi> writes:

>> Regarding the "too ugly" part, I'm afraid there's not much that can be done
>> to radically change it, the python gzip API is different from bz2 and lzma.
>> First, there's no similar decompressor object for gzip that exists for bz2
>> and lzma.  There's one in zlib but that one doesn't handle the gzip header
>> so that would have to be done manually which sure would be even uglier and
>> possibly fragile code duplication IMO.  Second unlike GzipFile, BZ2File and
>> LZMAFile don't have an option to pass an existing open file object (or file
>> descriptor) to them, they operate on filenames.
>
> Well it looked like at least the bz2 and lzma ones could share a code
> path, and maybe some of the control flow.

Hmm, but they do share the main decompression loop.  The only real differences 
are construction (obviously a necessity), and that lzma requires flush() to 
be called at the end but the bz2 decompressor doesn't have that method.  I'm 
sure the EOFError was needed for one (or perhaps both) of these, but the 
patch has been floating around in my local workspace so long that I've 
forgotten details about that.

> Seth also mentioned that 
> he'd prefer if that moved to a "cpio" property on YumLocalPackage
> anyway,

Ok, maybe there's some code in this patch that can be reused for that.

> and just deprecate the old rpmUtils interface. 

I see uses for rpm2cpio like functionality for external programs, such as for 
example rpmlint, so for those cases not depracating it would be useful.  But 
then again, I can't make rpmUtils a rpmlint dependency because it's part of 
yum and I'm sure distros that don't use yum otherwise wouldn't welcome a 
whole new depsolver dragged in for this purpose only.  Has splitting rpmUtils 
to a separate package been considered?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-bzip2-and-lzma-support-to-rpm2cpio.patch
Type: text/x-diff
Size: 2881 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum/attachments/20090126/cfd6c537/attachment.bin 


More information about the Yum mailing list