diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-12 14:55:55 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-12 14:55:55 +0200 |
| commit | 008ba8e659c6aabe66496aab0bfbeb0bf92a9e30 (patch) | |
| tree | f6b2ec1effefbed34de7e8a9ea01f5885f0cdd30 | |
| parent | 4325749c7bfe5f1e83983415e13eafd84bb62907 (diff) | |
| parent | 3b155e595fed78f8eac22de78106cd3dcad9793c (diff) | |
| download | python-apt-008ba8e659c6aabe66496aab0bfbeb0bf92a9e30.tar.gz | |
merged from debian-sid, improve test output
| -rw-r--r-- | apt/cache.py | 3 | ||||
| -rw-r--r-- | apt/debfile.py | 2 | ||||
| -rw-r--r-- | debian/changelog | 18 | ||||
| -rwxr-xr-x | debian/rules | 2 | ||||
| -rw-r--r-- | po/python-apt.pot | 21 | ||||
| -rw-r--r-- | python/progress.cc | 5 | ||||
| -rw-r--r-- | tests/data/test_debs/gdebi-test1.deb (renamed from tests/test_debs/gdebi-test1.deb) | bin | 934 -> 934 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test10.deb (renamed from tests/test_debs/gdebi-test10.deb) | bin | 614 -> 614 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test2.deb (renamed from tests/test_debs/gdebi-test2.deb) | bin | 554 -> 554 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test3.deb (renamed from tests/test_debs/gdebi-test3.deb) | bin | 570 -> 570 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test4.deb (renamed from tests/test_debs/gdebi-test4.deb) | bin | 2306 -> 2306 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test5.deb (renamed from tests/test_debs/gdebi-test5.deb) | bin | 2306 -> 2306 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test6.deb (renamed from tests/test_debs/gdebi-test6.deb) | bin | 600 -> 600 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test7.deb (renamed from tests/test_debs/gdebi-test7.deb) | bin | 578 -> 578 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test8.deb (renamed from tests/test_debs/gdebi-test8.deb) | bin | 598 -> 598 bytes | |||
| -rw-r--r-- | tests/data/test_debs/gdebi-test9.deb (renamed from tests/test_debs/gdebi-test9.deb) | bin | 586 -> 586 bytes | |||
| -rw-r--r-- | tests/data/test_debs/var/lib/dpkg/status (renamed from tests/test_debs/var/lib/dpkg/status) | 26 | ||||
| -rw-r--r-- | tests/test_apt_cache.py | 6 | ||||
| -rw-r--r-- | tests/test_aptsources.py | 4 | ||||
| -rw-r--r-- | tests/test_debfile.py | 8 | ||||
| -rw-r--r-- | tests/test_progress.py | 3 | ||||
| -rwxr-xr-x | utils/pyversions | 2 |
22 files changed, 52 insertions, 48 deletions
diff --git a/apt/cache.py b/apt/cache.py index 26532c76..f64b489a 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -471,7 +471,8 @@ class Cache(object): fix the system if dpkg got interrupted is to run 'dpkg --configure -a' as root. """ - dpkg_status_dir = os.path.dirname(apt_pkg.Config.find_file("Dir::State::status")) + dpkg_status_dir = os.path.dirname( + apt_pkg.config.find_file("Dir::State::status")) for f in os.listdir(os.path.join(dpkg_status_dir, "updates")): if fnmatch.fnmatch(f, "[0-9]*"): return True diff --git a/apt/debfile.py b/apt/debfile.py index 7a1fa82d..ea83c5b3 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -507,6 +507,7 @@ class DebPackage(object): content.append(name) return sorted(content) + @staticmethod def to_hex(self, in_data): hex = "" for (i, c) in enumerate(in_data): @@ -515,6 +516,7 @@ class DebPackage(object): hex += "%2.2x " % ord(c) return hex + @staticmethod def to_strish(self, in_data): s = "" for c in in_data: diff --git a/debian/changelog b/debian/changelog index b8ae49c1..466913a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,12 @@ -python-apt (0.7.96) UNRELEASED; urgency=low +python-apt (0.7.96.1) UNRELEASED; urgency=low + + * tests/test_debfile.py: + - properly setup fixture data to make debfile test pass + (closes: #588796) + + -- Michael Vogt <mvo@debian.org> Mon, 12 Jul 2010 14:14:51 +0200 + +python-apt (0.7.96) unstable; urgency=low [ Michael Vogt ] * data/templates/gNewSense.info.in, @@ -21,8 +29,11 @@ python-apt (0.7.96) UNRELEASED; urgency=low * apt/debfile.py: - check if the debfiles provides are in conflict with the systems packages + - fix py3 compatibility * tests/test_debs/*.deb, tests/test_debfile.py: - add automatic test based on the test debs from gdebi + * python/progress.cc: + - deal with missing return value from the acquire progress in pulse() [ Martin Pitt ] * tests/test_apt_cache.py: Test accessing the record of all packages during @@ -36,7 +47,10 @@ python-apt (0.7.96) UNRELEASED; urgency=low latter is disastrous if we use compressed package indexes, and slower than necessary for uncompressed indexes. - -- Michael Vogt <mvo@debian.org> Tue, 01 Jun 2010 16:20:00 +0200 + [ Julian Andres Klode ] + * Re-enable Python 3 support for latest python-default changes (hack). + + -- Michael Vogt <mvo@debian.org> Mon, 12 Jul 2010 08:58:42 +0200 python-apt (0.7.95) unstable; urgency=low diff --git a/debian/rules b/debian/rules index a65c5cfd..f7cca130 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,8 @@ export DH_PYCENTRAL=nomove export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') export CFLAGS=-Wno-write-strings -DCOMPAT_0_7 +export PATH :=$(CURDIR)/utils:$(PATH) +export SHELL = env PATH=$(PATH) sh %: dh --with python-central $@ diff --git a/po/python-apt.pot b/po/python-apt.pot index 036495e2..0d683700 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-07-12 14:07+0200\n" +"POT-Creation-Date: 2010-07-12 09:45+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" @@ -432,16 +433,16 @@ msgstr "" #: ../apt/debfile.py:323 #, python-format msgid "" -"Breaks existing package '%(pkgname)s' dependency %(depname)s (%(deprelation)" -"s %(depversion)s)" +"Breaks existing package '%(pkgname)s' dependency %(depname)s " +"(%(deprelation)s %(depversion)s)" msgstr "" #. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation #: ../apt/debfile.py:339 #, python-format msgid "" -"Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s %" -"(targetver)s)" +"Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " +"%(targetver)s)" msgstr "" #: ../apt/debfile.py:348 @@ -474,26 +475,26 @@ msgstr "" msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:503 ../apt/debfile.py:549 ../apt/debfile.py:560 +#: ../apt/debfile.py:503 ../apt/debfile.py:551 ../apt/debfile.py:562 msgid "Python-debian module not available" msgstr "" -#: ../apt/debfile.py:533 +#: ../apt/debfile.py:535 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:539 +#: ../apt/debfile.py:541 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:636 +#: ../apt/debfile.py:638 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:646 +#: ../apt/debfile.py:648 msgid "An essential package would be removed" msgstr "" diff --git a/python/progress.cc b/python/progress.cc index 9002b3eb..437309cf 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -300,7 +300,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) Py_INCREF(pyAcquire); if (RunSimpleCallback("pulse", TUPLEIZE(pyAcquire) , &result1)) { - if (result1 != NULL && PyArg_Parse(result1, "b", &res1) && res1 == false) { + if (result1 != NULL && + result1 != Py_None && + PyArg_Parse(result1, "b", &res1) && + res1 == false) { // the user returned a explicit false here, stop PyCbObj_BEGIN_ALLOW_THREADS return false; diff --git a/tests/test_debs/gdebi-test1.deb b/tests/data/test_debs/gdebi-test1.deb Binary files differindex ea9991ac..ea9991ac 100644 --- a/tests/test_debs/gdebi-test1.deb +++ b/tests/data/test_debs/gdebi-test1.deb diff --git a/tests/test_debs/gdebi-test10.deb b/tests/data/test_debs/gdebi-test10.deb Binary files differindex ca43ace6..ca43ace6 100644 --- a/tests/test_debs/gdebi-test10.deb +++ b/tests/data/test_debs/gdebi-test10.deb diff --git a/tests/test_debs/gdebi-test2.deb b/tests/data/test_debs/gdebi-test2.deb Binary files differindex 307ac689..307ac689 100644 --- a/tests/test_debs/gdebi-test2.deb +++ b/tests/data/test_debs/gdebi-test2.deb diff --git a/tests/test_debs/gdebi-test3.deb b/tests/data/test_debs/gdebi-test3.deb Binary files differindex 436b9258..436b9258 100644 --- a/tests/test_debs/gdebi-test3.deb +++ b/tests/data/test_debs/gdebi-test3.deb diff --git a/tests/test_debs/gdebi-test4.deb b/tests/data/test_debs/gdebi-test4.deb Binary files differindex 9eb92d1b..9eb92d1b 100644 --- a/tests/test_debs/gdebi-test4.deb +++ b/tests/data/test_debs/gdebi-test4.deb diff --git a/tests/test_debs/gdebi-test5.deb b/tests/data/test_debs/gdebi-test5.deb Binary files differindex 0c98c03f..0c98c03f 100644 --- a/tests/test_debs/gdebi-test5.deb +++ b/tests/data/test_debs/gdebi-test5.deb diff --git a/tests/test_debs/gdebi-test6.deb b/tests/data/test_debs/gdebi-test6.deb Binary files differindex 8ceacadc..8ceacadc 100644 --- a/tests/test_debs/gdebi-test6.deb +++ b/tests/data/test_debs/gdebi-test6.deb diff --git a/tests/test_debs/gdebi-test7.deb b/tests/data/test_debs/gdebi-test7.deb Binary files differindex c0414990..c0414990 100644 --- a/tests/test_debs/gdebi-test7.deb +++ b/tests/data/test_debs/gdebi-test7.deb diff --git a/tests/test_debs/gdebi-test8.deb b/tests/data/test_debs/gdebi-test8.deb Binary files differindex 439f8ca7..439f8ca7 100644 --- a/tests/test_debs/gdebi-test8.deb +++ b/tests/data/test_debs/gdebi-test8.deb diff --git a/tests/test_debs/gdebi-test9.deb b/tests/data/test_debs/gdebi-test9.deb Binary files differindex 9901d906..9901d906 100644 --- a/tests/test_debs/gdebi-test9.deb +++ b/tests/data/test_debs/gdebi-test9.deb diff --git a/tests/test_debs/var/lib/dpkg/status b/tests/data/test_debs/var/lib/dpkg/status index 443262e1..f0c48151 100644 --- a/tests/test_debs/var/lib/dpkg/status +++ b/tests/data/test_debs/var/lib/dpkg/status @@ -1,5 +1,5 @@ Package: apt -Status: hold ok installed +Status: install ok installed Priority: important Section: admin Installed-Size: 5456 @@ -8,12 +8,6 @@ Architecture: i386 Version: 0.7.25.3 Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) Provides: libapt-pkg-libc6.10-6-4.8 -Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt -Conffiles: - /etc/cron.daily/apt 3528ddf873535d4c268d83e73e85dc79 - /etc/apt/apt.conf.d/01autoremove 6154750d39a78704b5bbf6fafd65ada7 - /etc/logrotate.d/apt 179f2ed4f85cbaca12fa3d69c2a4a1c3 - /etc/apt/apt.conf.d/01ubuntu 078b96538a377743bee0f554eb5b2fc6 obsolete Description: Advanced front-end for dpkg This is Debian's next generation front-end for the dpkg package manager. It provides the apt-get utility and APT dselect method that provides a @@ -33,20 +27,7 @@ Version: 2.7.0-1 Replaces: mail-transport-agent, postfix-tls Provides: default-mta, mail-transport-agent, postfix-tls Recommends: python -Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, resolvconf, postfix-cdb, mail-reader, ufw Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, postfix-tls, smail -Conffiles: - /etc/init.d/postfix e47d7ef0cbd2e212324812d74c409d77 - /etc/ppp/ip-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 - /etc/ppp/ip-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 - /etc/network/if-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 - /etc/network/if-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 - /etc/postfix/postfix-script 0d01860b2f0778cf41951c801f538b30 - /etc/postfix/post-install d53706c232f6497539fa0c99df674b33 - /etc/postfix/postfix-files 47e63262ab84069c840556b469b0fb2f - /etc/rsyslog.d/postfix.conf d8a09827fff2a22311e4dd4a83e95c83 - /etc/ufw/applications.d/postfix 6716a7729145a40bf7cb721c8dc6c3b0 - /etc/resolvconf/update-libc.d/postfix 6c80adbe120bc46cbf42658a7364e17f Description: High-performance mail transport agent Postfix is Wietse Venema's mail transport agent that started life as an alternative to the widely-used Sendmail program. Postfix attempts to @@ -65,12 +46,7 @@ Version: 1.5.28 Replaces: debconf-tiny Provides: debconf-2.0 Recommends: apt-utils (>= 0.5.1) -Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgnome2-perl, libnet-ldap-perl, perl Conflicts: apt (<< 0.3.12.1), cdebconf (<< 0.96), debconf-tiny, debconf-utils (<< 1.3.22), dialog (<< 0.9b-20020814-1), menu (<= 2.1.3-1), whiptail (<< 0.51.4-11), whiptail-utf8 (<= 0.50.17-13) -Conffiles: - /etc/apt/apt.conf.d/70debconf 7e9d09d5801a42b4926b736b8eeabb73 - /etc/bash_completion.d/debconf 8fa1862734fbe54d7178aaaa419f5a11 - /etc/debconf.conf 8c0619be413824f1fc7698cee0f23811 Description: Debian configuration management system Debconf is a configuration management system for debian packages. Packages use Debconf to ask questions when they are installed. diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 653a0f48..a43e92d2 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -62,13 +62,13 @@ class TestAptCache(unittest.TestCase): def test_dpkg_journal_dirty(self): # backup old value - old_status = apt_pkg.Config.find_file("Dir::State::status") + old_status = apt_pkg.config.find_file("Dir::State::status") # create tmp env tmpdir = tempfile.mkdtemp() dpkg_dir = os.path.join(tmpdir,"var","lib","dpkg") os.makedirs(os.path.join(dpkg_dir,"updates")) open(os.path.join(dpkg_dir,"status"), "w") - apt_pkg.Config.set("Dir::State::status", + apt_pkg.config.set("Dir::State::status", os.path.join(dpkg_dir,"status")) cache = apt.Cache() # test empty @@ -80,7 +80,7 @@ class TestAptCache(unittest.TestCase): open(os.path.join(dpkg_dir,"updates","000"), "w") self.assertTrue(cache.dpkg_journal_dirty) # reset config value - apt_pkg.Config.set("Dir::State::status", old_status) + apt_pkg.config.set("Dir::State::status", old_status) if __name__ == "__main__": diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 767f5244..3ef20f64 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -98,7 +98,7 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list.testDistribution") sources = aptsources.sourceslist.SourcesList(True, self.templates) - distro = aptsources.distro.get_distro() + distro = aptsources.distro.get_distro(id="Ubuntu") distro.get_sources(sources) # test if all suits of the current distro were detected correctly dist_templates = set() @@ -111,7 +111,7 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list.testDistribution") sources = aptsources.sourceslist.SourcesList(True, self.templates) - distro = aptsources.distro.get_distro() + distro = aptsources.distro.get_distro(id="Ubuntu") distro.get_sources(sources) # test if all suits of the current distro were detected correctly dist_templates = set() diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 6af0cf1c..e4755b5b 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -46,18 +46,18 @@ class TestDebfilee(unittest.TestCase): def setUp(self): apt_pkg.config.set("APT::Architecture","i386") apt_pkg.config.set("Dir::State::status", - "./test_debs/var/lib/dpkg/status") + "./data/test_debs/var/lib/dpkg/status") self.cache = apt.Cache() def testDebFile(self): deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: logging.debug("testing %s, expecting %s" % (filename, expected_res)) - deb.open(os.path.join("test_debs", filename)) + deb.open(os.path.join("data", "test_debs", filename)) res = deb.check() self.assertEqual(res, expected_res, - "Unexpected result for package '%s' (got %s wanted %s)" % ( - filename, res, expected_res)) + "Unexpected result for package '%s' (got %s wanted %s)\n%s" % ( + filename, res, expected_res, deb._failure_string)) if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) diff --git a/tests/test_progress.py b/tests/test_progress.py index 2ab8ce5e..ffab5bc0 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -15,6 +15,9 @@ import os class TestAcquireProgress(apt.progress.base.AcquireProgress): def pulse(self, owner): self.pulsed = True + # there should be a return value here, either (True,False) + # but often this is forgoten (and causes odd error messages) + # so the lib supports it. we test the lack of support value here class TestProgress(unittest.TestCase): diff --git a/utils/pyversions b/utils/pyversions new file mode 100755 index 00000000..3accad3f --- /dev/null +++ b/utils/pyversions @@ -0,0 +1,2 @@ +#!/bin/sh +(/usr/bin/pyversions "$@"; /usr/bin/py3versions "$@"; ) | tr '\n' ' ' |
