From d902f6e33493be74d7908b859d6272a7892f635c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 21 Mar 2011 16:30:25 +0100 Subject: * python/arfile.cc, apt/debfile.py: - add support for .xz archives * tests/test_debfile.py: - add test for xz compression --- python/arfile.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'python/arfile.cc') diff --git a/python/arfile.cc b/python/arfile.cc index a279807d..5377ca8d 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -477,8 +477,8 @@ PyTypeObject PyArArchive_Type = { * Representation of a Debian package. * * This does not resemble debDebFile in apt-inst, but instead is a subclass - * of ArFile which adds properties for the control.tar.{lzma,bz2,gz} and - * data.tar.{lzma,bz2,gz} members which return TarFile objects. It also adds + * of ArFile which adds properties for the control.tar.{xz,lzma,bz2,gz} and + * data.tar.{xz,lzma,bz2,gz} members which return TarFile objects. It also adds * a descriptor 'version' which returns the content of 'debian-binary'. * * We are using it this way as it seems more natural to represent this special @@ -540,9 +540,13 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (!self->data) self->data = _gettar(self, self->Object->FindMember("data.tar.lzma"), "lzma"); + if (!self->data) + self->data = _gettar(self, self->Object->FindMember("data.tar.xz"), + "xz"); if (!self->data) return PyErr_Format(PyExc_SystemError, "No debian archive, missing %s", - "data.tar.gz or data.tar.bz2 or data.tar.lzma"); + "data.tar.gz or data.tar.bz2 or data.tar.lzma " + "or data.tar.xz"); const ARArchive::Member *member = self->Object->FindMember("debian-binary"); @@ -586,7 +590,7 @@ static PyGetSetDef debfile_getset[] = { {"control",(getter)debfile_get_control,0, "The TarFile object associated with the control.tar.gz member."}, {"data",(getter)debfile_get_data,0, - "The TarFile object associated with the data.tar.{gz,bz2,lzma} member."}, + "The TarFile object associated with the data.tar.{gz,bz2,lzma,xz}) member."}, {"debian_binary",(getter)debfile_get_debian_binary,0, "The package version, as contained in debian-binary."}, {NULL} @@ -600,7 +604,7 @@ static const char *debfile_doc = "specifying a file descriptor (returned by e.g. os.open()).\n" "The recommended way of using it is to pass in the path to the file.\n\n" "It differs from ArArchive by providing the members 'control', 'data'\n" - "and 'version' for accessing the control.tar.gz, data.tar.{gz,bz2,lzma},\n" + "and 'version' for accessing the control.tar.gz, data.tar.{gz,bz2,lzma,xz},\n" "and debian-binary members in the archive."; PyTypeObject PyDebFile_Type = { -- cgit v1.2.3