diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-12-21 18:17:21 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-12-21 18:17:21 +0100 |
| commit | b4816b79b3ce90fdabed8e812fc8e6f7109d1de0 (patch) | |
| tree | 01d97646f42519659e8fb831167db2c2865e8030 | |
| parent | bebae32a598593f9d427d54cb48a84bd9beac227 (diff) | |
| download | python-apt-b4816b79b3ce90fdabed8e812fc8e6f7109d1de0.tar.gz | |
* apt/debfile.py, tests/test_debfile.py:
- strip "./" from _get_content and add tests, this fixes a control
file extraction bug in gdebi
| -rw-r--r-- | apt/debfile.py | 2 | ||||
| -rw-r--r-- | debian/changelog | 3 | ||||
| -rw-r--r-- | tests/test_debfile.py | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 0a740c63..996a4cb3 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -531,6 +531,8 @@ class DebPackage(object): return s def _get_content(self, part, name, auto_decompress=True, auto_hex=True): + if name.startswith("./"): + name = name[2:] data = part.extractdata(name) # check for zip content if name.endswith(".gz") and auto_decompress: diff --git a/debian/changelog b/debian/changelog index 97a79f68..9740fa4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ python-apt (0.7.100.1) UNRELEASED; urgency=low deallocated * apt/progress/text.py: - only run ioctl for termios.TIOCGWINSZ if the fd is a tty + * apt/debfile.py, tests/test_debfile.py: + - strip "./" from _get_content and add tests, this fixes a control + file extraction bug in gdebi -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 07 Dec 2010 13:41:07 +0100 diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 759639c4..712c4958 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -100,7 +100,17 @@ class TestDebfilee(unittest.TestCase): deb.open(os.path.join("data", "test_debs", "gdebi-test12.deb")) content = deb.data_content("usr/bin/binary") self.assertTrue(content.startswith("Automatically converted to printable ascii:\n\x7fELF ")) - + # control file + needle = """Package: gdebi-test12 +Version: 1.0 +Architecture: all +Description: testpackage for gdebi - contains usr/bin/binary for file reading + This tests the binary file reading for debfile.py +""" + content = deb.control_content("./control") + self.assertEqual(content, needle) + content = deb.control_content("control") + self.assertEqual(content, needle) if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) |
