diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-30 17:13:04 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-30 17:13:04 +0200 |
| commit | 57ed80e7fd4f1d9d819f76acdca460a8ca638266 (patch) | |
| tree | aefff2ae098c4f6f59d4eb9b1fbecd8c3a110250 | |
| parent | 33b79b4717953064130e5be3b3371613e2b7a210 (diff) | |
| parent | 4bbf76cfa7a42b0cccd650baf3508cf6cfb14c5a (diff) | |
| download | python-apt-57ed80e7fd4f1d9d819f76acdca460a8ca638266.tar.gz | |
* python/arfile.cc, apt/debfile.py:
- add support for .xz archives
* tests/test_debfile.py:
- add test for xz compression
* update priority of python3-apt to match the archive
| -rw-r--r-- | apt/debfile.py | 3 | ||||
| -rw-r--r-- | debian/changelog | 11 | ||||
| -rw-r--r-- | debian/control | 1 | ||||
| -rw-r--r-- | python/arfile.cc | 14 | ||||
| -rw-r--r-- | tests/data/test_debs/data-tar-xz.deb | bin | 0 -> 626 bytes | |||
| -rw-r--r-- | tests/test_debfile.py | 5 |
6 files changed, 28 insertions, 6 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 86fd221b..fb4312a1 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -40,7 +40,8 @@ class DebPackage(object): VERSION_SAME, VERSION_NEWER) = range(4) - _supported_data_members = ("data.tar.gz", "data.tar.bz2", "data.tar.lzma") + _supported_data_members = ("data.tar.gz", "data.tar.bz2", "data.tar.lzma", + "data.tar.xz") debug = 0 diff --git a/debian/changelog b/debian/changelog index 89395ab4..346a42a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +python-apt (0.7.100.2ubuntu3) UNRELEASED; urgency=low + + [ Michael Vogt ] + * python/arfile.cc, apt/debfile.py: + - add support for .xz archives + * tests/test_debfile.py: + - add test for xz compression + * update priority of python3-apt to match the archive + + -- Michael Vogt <mvo@debian.org> Mon, 21 Mar 2011 15:46:50 +0100 + python-apt (0.7.100.2ubuntu2) natty; urgency=low [ Barry Warsaw ] diff --git a/debian/control b/debian/control index 73a4b57b..dbfe644f 100644 --- a/debian/control +++ b/debian/control @@ -98,6 +98,7 @@ Description: Python interface to libapt-pkg (locales) This package contains locales. Package: python3-apt +Priority: optional Architecture: any Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-apt-common Recommends: lsb-release, iso-codes 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 @@ -541,8 +541,12 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 = { diff --git a/tests/data/test_debs/data-tar-xz.deb b/tests/data/test_debs/data-tar-xz.deb Binary files differnew file mode 100644 index 00000000..fc15f597 --- /dev/null +++ b/tests/data/test_debs/data-tar-xz.deb diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 712c4958..32e52ddb 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -112,6 +112,11 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading content = deb.control_content("control") self.assertEqual(content, needle) + def test_xz_data(self): + deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") + self.assertEqual(deb.filelist, ["./", "usr/", "usr/bin/"]) + + if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) unittest.main() |
