diff -Nru python-apt-0.7.96.1ubuntu7/apt/cache.py python-apt-0.7.96.1ubuntu8~ppa1/apt/cache.py --- python-apt-0.7.96.1ubuntu7/apt/cache.py 2010-07-28 09:48:39.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/apt/cache.py 2010-09-03 17:31:34.000000000 +0100 @@ -327,12 +327,14 @@ @deprecated_args def update(self, fetch_progress=None, pulse_interval=0, - raise_on_error=True): + raise_on_error=True, sources_list=None): """Run the equivalent of apt-get update. The first parameter *fetch_progress* may be set to an instance of apt.progress.FetchProgress, the default is apt.progress.FetchProgress() . + sources_list -- Update a alternative sources.list than the default. + Note that the sources.list.d directory is ignored in this case """ lockfile = apt_pkg.config.find_dir("Dir::State::Lists") + "lock" lock = apt_pkg.get_lock(lockfile) @@ -340,11 +342,23 @@ if lock < 0: raise LockFailedException("Failed to lock %s" % lockfile) + if sources_list: + old_sources_list = apt_pkg.config.find("Dir::Etc::sourcelist") + old_sources_list_d = apt_pkg.config.find("Dir::Etc::sourceparts") + old_cleanup = apt_pkg.config.find("APT::List-Cleanup") + apt_pkg.config.set("Dir::Etc::sourcelist", os.path.abspath(sources_list)) + apt_pkg.config.set("Dir::Etc::sourceparts", "xxx") + apt_pkg.config.set("APT::List-Cleanup", "0") + slist = apt_pkg.SourceList() + slist.read_main_list() + else: + slist = self._list + try: if fetch_progress is None: fetch_progress = apt.progress.base.AcquireProgress() try: - res = self._cache.update(fetch_progress, self._list, + res = self._cache.update(fetch_progress, slist, pulse_interval) except SystemError, e: raise FetchFailedException(e) @@ -354,6 +368,10 @@ return res finally: os.close(lock) + if sources_list: + apt_pkg.config.set("Dir::Etc::sourcelist", old_sources_list) + apt_pkg.config.set("Dir::Etc::sourceparts", old_sources_list_d) + apt_pkg.config.set("APT::List-Cleanup", old_cleanup) @deprecated_args def install_archives(self, pm, install_progress): diff -Nru python-apt-0.7.96.1ubuntu7/apt/debfile.py python-apt-0.7.96.1ubuntu8~ppa1/apt/debfile.py --- python-apt-0.7.96.1ubuntu7/apt/debfile.py 2010-09-02 09:53:21.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/apt/debfile.py 2010-09-03 17:31:34.000000000 +0100 @@ -66,7 +66,7 @@ self._debfile = apt_inst.DebFile(open(self.filename)) control = self._debfile.control.extractdata("control") # hm, 'replace' is probably better but python2.6 test fail with that - self._sections = apt_pkg.TagSection(control.decode("UTF-8", 'ignore')) + self._sections = apt_pkg.TagSection(control) self.pkgname = self._sections["Package"] def __getitem__(self, key): diff -Nru python-apt-0.7.96.1ubuntu7/apt/package.py python-apt-0.7.96.1ubuntu8~ppa1/apt/package.py --- python-apt-0.7.96.1ubuntu7/apt/package.py 2010-06-01 16:09:36.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/apt/package.py 2010-09-03 17:31:34.000000000 +0100 @@ -415,6 +415,11 @@ return depends_list @property + def provides(self): + """ Return a list of names that this version provides.""" + return [p[0] for p in self._cand.provides_list] + + @property def enhances(self): """Return the list of enhances for the package version.""" return self.get_dependencies("Enhances") diff -Nru python-apt-0.7.96.1ubuntu7/data/templates/Ubuntu.mirrors python-apt-0.7.96.1ubuntu8~ppa1/data/templates/Ubuntu.mirrors --- python-apt-0.7.96.1ubuntu7/data/templates/Ubuntu.mirrors 2010-09-02 09:53:59.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/data/templates/Ubuntu.mirrors 2010-09-03 17:32:23.000000000 +0100 @@ -25,6 +25,7 @@ http://ubuntu.hitsol.net/ubuntu/ http://ubuntu.ipacct.com/ubuntu/ http://ubuntu.linux-bg.org/ubuntu/ +http://ubuntu.nano-box.net/ubuntu/ #LOC:BO http://espejo.softwarelibre.gob.bo/archive.ubuntu.com/ubuntu/ #LOC:BR @@ -36,9 +37,9 @@ http://ubuntu.interlegis.gov.br/ubuntu/ http://ubuntu.mirror.pop-sc.rnp.br/ubuntu/ http://ubuntu.ufba.br/ubuntu/ -http://www.las.ic.unicamp.br/pub/ubuntu/ #LOC:BY http://ftp.byfly.by/ubuntu/ +http://linux.org.by/ubuntu/ http://mirror.datacenter.by/ubuntu/ #LOC:CA ftp://ftp.cs.mun.ca/pub/mirror/ubuntu/ @@ -59,7 +60,6 @@ #LOC:CN http://ftp.sjtu.edu.cn/ubuntu/ http://mirror.bjtu.edu.cn/ubuntu/ -http://mirror.lupaworld.com/ubuntu/ http://mirrors.163.com/ubuntu/ http://mirrors.sohu.com/ubuntu/ http://ubuntu.cn99.com/ubuntu/ @@ -419,6 +419,8 @@ #LOC:UZ http://ubuntu.snet.uz/ubuntu/ http://ubuntu.uz/ubuntu/ +#LOC:VN +http://mirror-fpt-telecom.fpt.net/ubuntu/ #LOC:ZA http://ftp.leg.uct.ac.za/ubuntu/ http://ftp.sun.ac.za/ftp/ubuntu/ diff -Nru python-apt-0.7.96.1ubuntu7/debian/changelog python-apt-0.7.96.1ubuntu8~ppa1/debian/changelog --- python-apt-0.7.96.1ubuntu7/debian/changelog 2010-09-02 09:53:46.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/debian/changelog 2010-09-03 17:32:17.000000000 +0100 @@ -1,3 +1,40 @@ +python-apt (0.7.96.1ubuntu8~ppa1) maverick; urgency=low + + [ Julian Andres Klode ] + * python/tag.cc: + - Support gzip compression for control files (Closes: #383617), + requires APT (>> 0.7.26~exp10) to work. + * doc/conf.py: + - Correctly handle non-digit characters in version (ignore everything + after them). + * python/apt_pkgmodule.cc: + - Bind pkgAcquire::Item::StatTransientNetworkError (Closes: #589010) + * doc/library/apt_pkg.rst: + - Document Configuration.dump(). + + [ Michael Vogt ] + * python/configuration.cc: + - add binding for the "dump()" method to configruation objects + * apt/debfile.py: + - fix crash in DscFile handling and add regression test + * python/acquire.cc: + - return long long when calling TotalNeeded(), FetchNeeded() and + PartialPresent() from pkgAcquire(). This follows the change + in libapt. + * add "provides" property to the apt.Version objects + * apt/debfile.py: + - fix error when reading binary content and add regresion test + * merged patch from Samuel Lidén Borell to fix crash if there utf8 + in the control file (LP: #624290) and add test + * apt/cache.py: + - add "sources_list" parameter to cache.update() to force updating + a single sources.list entry only + * debian/control: + - add missing build-depends on python-debian (needed to run the + tests for apt.debfile.DebPackage() + + -- Michael Vogt Fri, 03 Sep 2010 18:32:17 +0200 + python-apt (0.7.96.1ubuntu7) maverick; urgency=low * cherry pick debfile fix from lp:~mvo/python-apt/mvo (402..405): diff -Nru python-apt-0.7.96.1ubuntu7/debian/control python-apt-0.7.96.1ubuntu8~ppa1/debian/control --- python-apt-0.7.96.1ubuntu7/debian/control 2010-08-27 10:23:05.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/debian/control 2010-09-03 17:31:34.000000000 +0100 @@ -13,7 +13,8 @@ python-all-dbg, python-central (>= 0.5), python-distutils-extra (>= 2.0), - python-sphinx (>= 0.5) + python-sphinx (>= 0.5), + python-debian Vcs-Bzr: http://bzr.debian.org/apt/python-apt/debian-sid Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes diff -Nru python-apt-0.7.96.1ubuntu7/python/cache.cc python-apt-0.7.96.1ubuntu8~ppa1/python/cache.cc --- python-apt-0.7.96.1ubuntu7/python/cache.cc 2010-06-01 16:09:36.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/python/cache.cc 2010-09-03 17:31:34.000000000 +0100 @@ -573,9 +573,8 @@ {"rev_depends_list",PackageGetRevDependsList,0, "An apt_pkg.DependencyList object of all reverse dependencies."}, {"provides_list",PackageGetProvidesList,0, - "A list of all packages providing this package. The list contains\n" - "tuples in the format (providesname, providesver, version)\n" - "where 'version' is an apt_pkg.Version object."}, + "Ignore it, it does nothing. You want to use\n" + "apt_pkg.Version.provides_list instead."}, {"selected_state",PackageGetSelectedState,0, "The state of the selection, which can be compared against the constants\n" "SELSTATE_DEINSTALL, SELSTATE_HOLD, SELSTATE_INSTALL, SELSTATE_PURGE,\n" @@ -979,8 +978,9 @@ {"priority_str",VersionGetPriorityStr,0, "The priority of the package, as a string."}, {"provides_list",VersionGetProvidesList,0, - "A list of all packages provided by this version. See\n" - "Package.provides_list for a description of the format."}, + "A list of all packages provided by this version. The list contains\n" + "tuples in the format (providesname, providesver, version)\n" + "where 'version' is an apt_pkg.Version object."}, {"section",VersionGetSection,0, "The section of this package version."}, {"size",VersionGetSize,0, Binary files /tmp/RTZshGLj9N/python-apt-0.7.96.1ubuntu7/tests/data/test_debs/utf8-package_1.0-1_all.deb and /tmp/cejaSSoQvT/python-apt-0.7.96.1ubuntu8~ppa1/tests/data/test_debs/utf8-package_1.0-1_all.deb differ Binary files /tmp/RTZshGLj9N/python-apt-0.7.96.1ubuntu7/tests/data/test-repo/Packages.gz and /tmp/cejaSSoQvT/python-apt-0.7.96.1ubuntu8~ppa1/tests/data/test-repo/Packages.gz differ diff -Nru python-apt-0.7.96.1ubuntu7/tests/test_apt_cache.py python-apt-0.7.96.1ubuntu8~ppa1/tests/test_apt_cache.py --- python-apt-0.7.96.1ubuntu7/tests/test_apt_cache.py 2010-08-27 10:23:05.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/tests/test_apt_cache.py 2010-09-03 17:31:34.000000000 +0100 @@ -1,6 +1,7 @@ #!/usr/bin/python # # Copyright (C) 2010 Julian Andres Klode +# 2010 Michael Vogt # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -15,7 +16,7 @@ import apt import apt_pkg - +import shutil class TestAptCache(unittest.TestCase): """ test the apt cache """ @@ -50,6 +51,7 @@ # a true virtual pkg l = cache.get_providing_packages("mail-transport-agent") self.assertTrue(len(l) > 0) + self.assertTrue("postfix" in [p.name for p in l]) # this is a not virtual (transitional) package provided by another l = cache.get_providing_packages("scrollkeeper") self.assertEqual(l, []) @@ -58,6 +60,7 @@ l = cache.get_providing_packages("scrollkeeper", include_nonvirtual=True) self.assertTrue(len(l), 1) + self.assertTrue("mail-transport-agent" in cache["postfix"].candidate.provides) def test_dpkg_journal_dirty(self): @@ -81,7 +84,44 @@ self.assertTrue(cache.dpkg_journal_dirty) # reset config value apt_pkg.config.set("Dir::State::status", old_status) + + def test_apt_update(self): + try: + os.makedirs("./data/tmp/var/lib/apt/lists/partial") + except OSError, e: + pass + apt_pkg.config.set("dir::state", "./data/tmp/var/lib/apt") + + # test single sources.list fetching + sources_list = "./data/tmp/test.list" + f=open(sources_list, "w") + repo = os.path.abspath("./data/test-repo") + f.write("deb copy:%s /\n" % repo) + f.close() + self.assertTrue(os.path.exists(sources_list)) + # write marker to ensure listcleaner is not run + open("./data/tmp/var/lib/apt/lists/marker", "w") + + # update a single sources.list + cache = apt.Cache() + cache.update(sources_list=sources_list) + # verify we just got a single source + files = filter(lambda f: f not in ("lock", "partial"), + os.listdir("./data/tmp/var/lib/apt/lists")) + self.assertEqual(len([f for f in files if f.endswith("tests_data_test-repo_Packages")]), 1) + # ensure the listcleaner was not run + self.assertTrue("marker" in files) + # ensure we don't get additional stuff from /etc/apt/sources.list + self.assertTrue(len(files) < 5) + # now run update again and verify that we got the normal sources.list + cache.update() + full_update = filter(lambda f: f not in ("lock", "partial"), + os.listdir("./data/tmp/var/lib/apt/lists")) + self.assertTrue(len(files) < len(full_update)) + + # cleanup + shutil.rmtree("./data/tmp/") if __name__ == "__main__": unittest.main() diff -Nru python-apt-0.7.96.1ubuntu7/tests/test_debfile.py python-apt-0.7.96.1ubuntu8~ppa1/tests/test_debfile.py --- python-apt-0.7.96.1ubuntu7/tests/test_debfile.py 2010-09-02 09:53:21.000000000 +0100 +++ python-apt-0.7.96.1ubuntu8~ppa1/tests/test_debfile.py 2010-09-03 17:31:53.000000000 +0100 @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # Copyright (C) 2010 Michael Vogt # @@ -77,6 +78,12 @@ "Unexpected result for package '%s' (got %s wanted %s)\n%s" % ( filename, res, expected_res, deb._failure_string)) + def test_utf8_sections(self): + deb = apt.debfile.DebPackage(cache=self.cache) + deb.open(os.path.join("data","test_debs","utf8-package_1.0-1_all.deb")) + self.assertEqual(deb["Maintainer"], + "Samuel Lidén Borell ") + def testContent(self): # normal deb = apt.debfile.DebPackage(cache=self.cache)