summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-12-21 18:19:15 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-12-21 18:19:15 +0100
commita4bd6f49f40e1dad06530fbcfa5768a8487d84ba (patch)
tree62c66fb47ac0c77e8230a041e71c07d3539ed669
parent4861eac4753a9b60ed6df2d25aae0da74b84728a (diff)
parentb4816b79b3ce90fdabed8e812fc8e6f7109d1de0 (diff)
downloadpython-apt-a4bd6f49f40e1dad06530fbcfa5768a8487d84ba.tar.gz
meged from mvo
-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)