summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/debfile.py2
-rw-r--r--debian/changelog5
-rw-r--r--tests/test_debfile.py12
3 files changed, 17 insertions, 2 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 5f47b713..f36571f9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,11 @@ python-apt (0.7.100.1ubuntu1) UNRELEASEDnatty; urgency=low
* merged from debian
* 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, 21 Dec 2010 17:49:23 +0100
+ -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 21 Dec 2010 18:18:59 +0100
python-apt (0.7.100.1) unstable; urgency=low
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)