Bug#506861: python-debian: support data.tar.xz member

Stuart Prescott stuart at debian.org
Thu Jun 28 23:57:03 UTC 2012

tag 506861 + patch


attached is a patch that gives python-debian support for xz-compressed .debs. 
This patch is based on the python3 patches that Colin Watson has been working 
on and has been tested with python 2.6, 2.7, 3.2 and 3.3.

For python < 3.3, the unxz utility from the xz-utils package is used to 
decompress the member which is then fed into the python tarfile module as would 
be done for gz or bz2 members. This is crude but works fine. Perhaps python-
debian and python3-debian (until python 3.3 at least) should Recommend xz-
utils as a result. Perhaps better error handling around the subprocess would 
be advisable for the absence of unxz(1) on the system.

For python 3.3 onwards (i.e. wheezy+1), python's in-built lzma support is used 
with tarfile.

Performance wise, there is very little performance difference between using 
unxz(1) and the lzma python module. There is, however, a consistent 
performance difference between operations on gz and xz members. Extracting the 
copyright file from a small .deb (25 kB) is about 50% slower for an xz-
compressed member than a gz compressed member. For very large .debs (~100 MB), 
it's about a factor of 5 slower. This is true for each python tested, 
irrespective of calls to unxz(1) or use of liblzma.

(the large uuencoded mess in the middle of the patch is hello.deb repacked as 
an xz compressed .deb in the same way as hello-bz2.deb is provided for the 
test suite)

Colin: if the maintainers are happy with this and you do intend to NMU python-
debian so that wheezy has python3-debian, please consider adding this patch to 
your stack.


Stuart Prescott    http://www.nanonanonano.net/   stuart at nanonanonano.net
Debian Developer   http://www.debian.org/         stuart at debian.org
GPG fingerprint    BE65 FD1E F4EA 08F3 23D4 3C6D 9FE8 B8CD 71C5 D1A8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xz-member.patch
Type: text/x-patch
Size: 56804 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20120629/2c5f1d90/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20120629/2c5f1d90/attachment-0001.pgp>

More information about the pkg-python-debian-maint mailing list