From 16917ac913f029aed5148bdb134069901c816300 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 23 Jan 2009 09:59:32 +0100 Subject: * apt/cache.py: - when running with the rootdir option, run InitConfig() again to ensure that the config from the rootdir is read, not from the host (lp: #243550) --- apt/cache.py | 1 + 1 file changed, 1 insertion(+) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index 0065d14c..a8432a32 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -55,6 +55,7 @@ class Cache(object): apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") + apt_pkg.InitConfig() self.open(progress) def _runCallbacks(self, name): -- cgit v1.2.3 From 82fda8b9fa514ed8a268650f21ae9e76d713e1d4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 23 Jan 2009 21:41:00 +0100 Subject: * apt/package.py: - make sure to set the defaulttimeout back to the original value (in getChangelog(), LP: #314212) --- apt/package.py | 11 +++++++---- debian/changelog | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index ecfd8b61..5a7da1f3 100644 --- a/apt/package.py +++ b/apt/package.py @@ -32,10 +32,6 @@ import apt_pkg __all__ = 'BaseDependency', 'Dependency', 'Origin', 'Package', 'Record' -# Set a timeout for the changelog download -socket.setdefaulttimeout(2) - - def _(string): """Return the translation of the string.""" return gettext.dgettext("python-apt", string) @@ -596,7 +592,12 @@ class Package(object): "prefix": prefix, "src_pkg": src_pkg, "src_ver": src_ver} + + timeout = socket.getdefaultimeout() try: + # Set a timeout for the changelog download + socket.setdefaulttimeout(2) + # Check if the download was canceled if cancel_lock and cancel_lock.isSet(): return "" @@ -649,6 +650,8 @@ class Package(object): except (IOError, httplib.BadStatusLine): return _("Failed to download the list of changes. \nPlease " "check your Internet connection.") + finally: + socket.setdefaulttimeout(timeout) return self._changelog @property diff --git a/debian/changelog b/debian/changelog index 73715a36..f3514680 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ python-apt (0.7.9~exp3) experimental; urgency=low InitConfig() again to ensure that the config from the rootdir is read, not from the host (lp: #243550) + * apt/package.py: + - make sure to set the defaulttimeout back to the + original value (in getChangelog(), LP: #314212) -- -- cgit v1.2.3 From efceaa5a5d14994e30c9539e719edd8cddc68366 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Jan 2009 09:08:15 +0100 Subject: apt/package.py: compatibility with python2.4 (pep 341 missing) --- apt/package.py | 105 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 51 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 5a7da1f3..10b55dc6 100644 --- a/apt/package.py +++ b/apt/package.py @@ -594,62 +594,65 @@ class Package(object): "src_ver": src_ver} timeout = socket.getdefaultimeout() + + # FIXME: when python2.4 vanishes from the archive, + # merge this into a single try..finally block (pep 341) try: - # Set a timeout for the changelog download - socket.setdefaulttimeout(2) - - # Check if the download was canceled - if cancel_lock and cancel_lock.isSet(): - return "" - changelog_file = urllib2.urlopen(uri) - # do only get the lines that are new - changelog = "" - regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg)) - - while True: + try: + # Set a timeout for the changelog download + socket.setdefaulttimeout(2) + # Check if the download was canceled if cancel_lock and cancel_lock.isSet(): return "" - # Read changelog line by line - line_raw = changelog_file.readline() - if line_raw == "": - break - # The changelog is encoded in utf-8, but since there isn't any - # http header, urllib2 seems to treat it as ascii - line = line_raw.decode("utf-8") - - #print line.encode('utf-8') - match = re.match(regexp, line) - if match: - # strip epoch from installed version - # and from changelog too - installed = self.installedVersion - if installed and ":" in installed: - installed = installed.split(":", 1)[1] - changelog_ver = match.group(1) - if changelog_ver and ":" in changelog_ver: - changelog_ver = changelog_ver.split(":", 1)[1] - if installed and \ - apt_pkg.VersionCompare(changelog_ver, installed) <= 0: + changelog_file = urllib2.urlopen(uri) + # do only get the lines that are new + changelog = "" + regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg)) + + while True: + # Check if the download was canceled + if cancel_lock and cancel_lock.isSet(): + return "" + # Read changelog line by line + line_raw = changelog_file.readline() + if line_raw == "": break - # EOF (shouldn't really happen) - changelog += line - - # Print an error if we failed to extract a changelog - if len(changelog) == 0: - changelog = _("The list of changes is not available") - self._changelog = changelog - - # FIXME: Ubuntu-specific part. - except urllib2.HTTPError: - return _("The list of changes is not available yet.\n\n" - "Please use http://launchpad.net/ubuntu/+source/%s/%s/" - "+changelog\n" - "until the changes become available or try again " - "later.") % (src_pkg, src_ver) - except (IOError, httplib.BadStatusLine): - return _("Failed to download the list of changes. \nPlease " - "check your Internet connection.") + # The changelog is encoded in utf-8, but since there isn't any + # http header, urllib2 seems to treat it as ascii + line = line_raw.decode("utf-8") + + #print line.encode('utf-8') + match = re.match(regexp, line) + if match: + # strip epoch from installed version + # and from changelog too + installed = self.installedVersion + if installed and ":" in installed: + installed = installed.split(":", 1)[1] + changelog_ver = match.group(1) + if changelog_ver and ":" in changelog_ver: + changelog_ver = changelog_ver.split(":", 1)[1] + if (installed and + apt_pkg.VersionCompare(changelog_ver, installed) <= 0): + break + # EOF (shouldn't really happen) + changelog += line + + # Print an error if we failed to extract a changelog + if len(changelog) == 0: + changelog = _("The list of changes is not available") + self._changelog = changelog + + except urllib2.HTTPError: + return _("The list of changes is not available yet.\n\n" + "Please use http://launchpad.net/ubuntu/+source/%s/%s/" + "+changelog\n" + "until the changes become available or try again " + "later.") % (src_pkg, src_ver) + except (IOError, httplib.BadStatusLine): + return _("Failed to download the list of changes. \nPlease " + "check your Internet connection.") finally: socket.setdefaulttimeout(timeout) return self._changelog -- cgit v1.2.3 From 52546cc5e1a3980301286b8c2c14354d0b3b6dc5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Jan 2009 09:19:38 +0100 Subject: apt/package.py: typo in getdefaulttimeout, add changelog to simple test --- apt/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 10b55dc6..3d7846e4 100644 --- a/apt/package.py +++ b/apt/package.py @@ -593,7 +593,7 @@ class Package(object): "src_pkg": src_pkg, "src_ver": src_ver} - timeout = socket.getdefaultimeout() + timeout = socket.getdefaulttimeout() # FIXME: when python2.4 vanishes from the archive, # merge this into a single try..finally block (pep 341) @@ -778,9 +778,11 @@ def _test(): print "homepage: %s" % pkg.homepage print "rec: ", pkg.candidateRecord + # now test install/remove progress = apt.progress.OpTextProgress() cache = apt.Cache(progress) + print cache["2vcard"].getChangelog() for i in True, False: print "Running install on random upgradable pkgs with AutoFix: %s " % i for pkg in cache: -- cgit v1.2.3 From 33522c90ad814bc03643fd3bea435315831a8c7f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Jan 2009 12:10:44 +0100 Subject: revert commit r317 --- apt/cache.py | 1 - debian/changelog | 5 ----- 2 files changed, 6 deletions(-) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index a8432a32..0065d14c 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -55,7 +55,6 @@ class Cache(object): apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") - apt_pkg.InitConfig() self.open(progress) def _runCallbacks(self, name): diff --git a/debian/changelog b/debian/changelog index f3514680..0b41246f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,11 +5,6 @@ python-apt (0.7.9~exp3) experimental; urgency=low - fix incorrect indent * debian/control: - add Recommends to iso-codes (for iso_3166.xml) - * apt/cache.py: - - when running with the rootdir option, run - InitConfig() again to ensure that the config - from the rootdir is read, not from the host - (lp: #243550) * apt/package.py: - make sure to set the defaulttimeout back to the original value (in getChangelog(), LP: #314212) -- cgit v1.2.3 From 5cbf0b5807b4cc67818eae652b59a25d52eb9f7b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 29 Jan 2009 09:26:03 +0100 Subject: * apt/cache.py: - when setting a alternative rootdir, read the config from it as well * python/configuration.cc, python/apt_pkgmodule.cc: - add apt_pkg.ReadConfigDir() --- apt/cache.py | 3 +++ debian/changelog | 5 +++++ po/python-apt.pot | 19 +++++++------------ python/apt_pkgmodule.cc | 1 + python/apt_pkgmodule.h | 2 ++ python/configuration.cc | 18 ++++++++++++++++++ 6 files changed, 36 insertions(+), 12 deletions(-) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index 0065d14c..b74f8ef1 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -52,6 +52,9 @@ class Cache(object): # force apt to build its caches in memory apt_pkg.Config.Set("Dir::Cache::pkgcache", "") if rootdir: + print "reading apt.conf" + apt_pkg.ReadConfigFile(apt_pkg.Config, rootdir+"/etc/apt/apt.conf") + apt_pkg.ReadConfigDir(apt_pkg.Config, rootdir+"/etc/apt/apt.conf.d") apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") diff --git a/debian/changelog b/debian/changelog index 0b41246f..ffacbec0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,11 @@ python-apt (0.7.9~exp3) experimental; urgency=low * apt/package.py: - make sure to set the defaulttimeout back to the original value (in getChangelog(), LP: #314212) + * apt/cache.py: + - when setting a alternative rootdir, read the + config from it as well + * python/configuration.cc, python/apt_pkgmodule.cc: + - add apt_pkg.ReadConfigDir() -- diff --git a/po/python-apt.pot b/po/python-apt.pot index 6af898db..9bcda683 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-01-09 18:08+0100\n" +"POT-Creation-Date: 2009-01-29 09:24+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -82,11 +82,6 @@ msgstr "" msgid "Community-maintained" msgstr "" -#. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:305 -msgid "Proprietary drivers for devices" -msgstr "" - #. CompDescription #: ../data/templates/Ubuntu.info.in:307 msgid "Restricted software" @@ -124,7 +119,7 @@ msgstr "" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:357 -msgid "Proprietary drivers for devices " +msgid "Proprietary drivers for devices" msgstr "" #. CompDescription @@ -275,7 +270,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:33 -msgid "Debian 4.0 'Etch' " +msgid "Debian 4.0 'Etch'" msgstr "" #. Description @@ -319,7 +314,7 @@ msgid "Non-DFSG-compatible Software" msgstr "" #. TRANSLATORS: %s is a country -#: ../aptsources/distro.py:194 ../aptsources/distro.py:401 +#: ../aptsources/distro.py:207 ../aptsources/distro.py:422 #, python-format msgid "Server for %s" msgstr "" @@ -327,12 +322,12 @@ msgstr "" #. More than one server is used. Since we don't handle this case #. in the user interface we set "custom servers" to true and #. append a list of all used servers -#: ../aptsources/distro.py:213 ../aptsources/distro.py:218 -#: ../aptsources/distro.py:232 +#: ../aptsources/distro.py:225 ../aptsources/distro.py:231 +#: ../aptsources/distro.py:247 msgid "Main server" msgstr "" -#: ../aptsources/distro.py:235 +#: ../aptsources/distro.py:251 msgid "Custom servers" msgstr "" diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 2e488d58..86732781 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -402,6 +402,7 @@ static PyMethodDef methods[] = // Command line {"ReadConfigFile",LoadConfig,METH_VARARGS,doc_LoadConfig}, + {"ReadConfigDir",LoadConfigDir,METH_VARARGS,doc_LoadConfigDir}, {"ReadConfigFileISC",LoadConfigISC,METH_VARARGS,doc_LoadConfig}, {"ParseCommandLine",ParseCommandLine,METH_VARARGS,doc_ParseCommandLine}, diff --git a/python/apt_pkgmodule.h b/python/apt_pkgmodule.h index 38486182..e047bcd8 100644 --- a/python/apt_pkgmodule.h +++ b/python/apt_pkgmodule.h @@ -23,9 +23,11 @@ extern PyTypeObject VersionType; extern char *doc_LoadConfig; extern char *doc_LoadConfigISC; +extern char *doc_LoadConfigDir; extern char *doc_ParseCommandLine; PyObject *LoadConfig(PyObject *Self,PyObject *Args); PyObject *LoadConfigISC(PyObject *Self,PyObject *Args); +PyObject *LoadConfigDir(PyObject *Self,PyObject *Args); PyObject *ParseCommandLine(PyObject *Self,PyObject *Args); // Tag File Stuff diff --git a/python/configuration.cc b/python/configuration.cc index f52c3c97..21f70bc1 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -327,6 +327,24 @@ PyObject *LoadConfigISC(PyObject *Self,PyObject *Args) if (ReadConfigFile(GetSelf(Self),Name,true) == false) return HandleErrors(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); +} +char *doc_LoadConfigDir = "LoadConfigDir(Configuration,DirName) -> None"; +PyObject *LoadConfigDir(PyObject *Self,PyObject *Args) +{ + char *Name = 0; + if (PyArg_ParseTuple(Args,"Os",&Self,&Name) == 0) + return 0; + if (Configuration_Check(Self)== 0) + { + PyErr_SetString(PyExc_TypeError,"argument 1: expected Configuration."); + return 0; + } + + if (ReadConfigDir(GetSelf(Self),Name,false) == false) + return HandleErrors(); + Py_INCREF(Py_None); return HandleErrors(Py_None); } -- cgit v1.2.3 From 54e8dd740523532425393caf91e10bbbf244c103 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 29 Jan 2009 09:36:15 +0100 Subject: apt/cache.py: test for existance first before reading the file --- apt/cache.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index b74f8ef1..01c12c94 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -52,9 +52,10 @@ class Cache(object): # force apt to build its caches in memory apt_pkg.Config.Set("Dir::Cache::pkgcache", "") if rootdir: - print "reading apt.conf" - apt_pkg.ReadConfigFile(apt_pkg.Config, rootdir+"/etc/apt/apt.conf") - apt_pkg.ReadConfigDir(apt_pkg.Config, rootdir+"/etc/apt/apt.conf.d") + if os.path.exists(rootdir+"/etc/apt/apt.conf"): + apt_pkg.ReadConfigFile(apt_pkg.Config, rootdir+"/etc/apt/apt.conf") + if os.path.isdir(rootdir+"/etc/apt/apt.conf.d"): + apt_pkg.ReadConfigDir(apt_pkg.Config, rootdir+"/etc/apt/apt.conf.d") apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") -- cgit v1.2.3 From abc022945280efbce5c08124066cbc9b1340a940 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 29 Jan 2009 18:10:17 +0100 Subject: apt/package.py: add Origin.not_automatic --- apt/package.py | 1 + 1 file changed, 1 insertion(+) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 3d7846e4..f5262fff 100644 --- a/apt/package.py +++ b/apt/package.py @@ -83,6 +83,7 @@ class Origin(object): self.label = VerFileIter.Label self.origin = VerFileIter.Origin self.site = VerFileIter.Site + self.not_automatic = VerFileIter.NotAutomatic # check the trust indexfile = pkg._list.FindIndex(VerFileIter) if indexfile and indexfile.IsTrusted: -- cgit v1.2.3 From 46c29108ea76d1ca336042be99bbe11e8e5061b8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 26 Feb 2009 11:53:50 +0100 Subject: avoid duplicated internal references of the Package object for _cache, _depcache, _records, _list - they add up to ~10mb for the full cache on my test system and all information is available via Package._pcache --- apt/cache.py | 4 +-- apt/package.py | 86 +++++++++++++++++++++++++++----------------------------- debian/changelog | 2 ++ 3 files changed, 44 insertions(+), 48 deletions(-) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index 01c12c94..cd9c5fe9 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -90,9 +90,7 @@ class Cache(object): last=i # drop stuff with no versions (cruft) if len(pkg.VersionList) > 0: - self._dict[pkg.Name] = Package(self._cache, self._depcache, - self._records, self._list, - self, pkg) + self._dict[pkg.Name] = Package(self, pkg) i += 1 if progress is not None: diff --git a/apt/package.py b/apt/package.py index f5262fff..8b4e1803 100644 --- a/apt/package.py +++ b/apt/package.py @@ -85,7 +85,7 @@ class Origin(object): self.site = VerFileIter.Site self.not_automatic = VerFileIter.NotAutomatic # check the trust - indexfile = pkg._list.FindIndex(VerFileIter) + indexfile = pkg._pcache._list.FindIndex(VerFileIter) if indexfile and indexfile.IsTrusted: self.trusted = True else: @@ -145,13 +145,9 @@ class Package(object): much more. """ - def __init__(self, cache, depcache, records, sourcelist, pcache, pkgiter): + def __init__(self, pcache, pkgiter): """ Init the Package object """ - self._cache = cache # low level cache - self._depcache = depcache - self._records = records self._pkg = pkgiter - self._list = sourcelist # sourcelist self._pcache = pcache # python cache in cache.py self._changelog = "" # Cached changelog @@ -161,7 +157,7 @@ class Package(object): Must be called before _records is accessed. """ if UseCandidate: - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) else: ver = self._pkg.CurrentVer @@ -175,7 +171,7 @@ class Package(object): print "No FileList for: %s " % self._pkg.Name() return False f, index = ver.FileList.pop(0) - self._records.Lookup((f, index)) + self._pcache._records.Lookup((f, index)) return True @property @@ -208,7 +204,7 @@ class Package(object): @property def candidateVersion(self): """Return the candidate version as string.""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) if ver is not None: return ver.VerStr else: @@ -234,7 +230,7 @@ class Package(object): @property def candidateDependencies(self): """Return a list of candidate dependencies.""" - candver = self._depcache.GetCandidateVer(self._pkg) + candver = self._pcache._depcache.GetCandidateVer(self._pkg) if candver is None: return [] return self._getDependencies(candver) @@ -252,7 +248,7 @@ class Package(object): """Return the Architecture of the package""" if not self._lookupRecord(): return None - sec = apt_pkg.ParseSection(self._records.Record) + sec = apt_pkg.ParseSection(self._pcache._records.Record) try: return sec["Architecture"] except KeyError: @@ -261,7 +257,7 @@ class Package(object): def _downloadable(self, useCandidate=True): """Return True if the package is downloadable.""" if useCandidate: - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) else: ver = self._pkg.CurrentVer if ver is None: @@ -284,7 +280,7 @@ class Package(object): if not self._lookupRecord(): if not self._lookupRecord(False): return self._pkg.Name - src = self._records.SourcePkg + src = self._pcache._records.SourcePkg if src != "": return src else: @@ -295,7 +291,7 @@ class Package(object): """Return the homepage field as string.""" if not self._lookupRecord(): return None - return self._records.Homepage + return self._pcache._records.Homepage @property def section(self): @@ -305,7 +301,7 @@ class Package(object): @property def priority(self): """Return the priority (of the candidate version).""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) if ver: return ver.PriorityStr else: @@ -314,7 +310,7 @@ class Package(object): @property def installedPriority(self): """Return the priority (of the installed version).""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) if ver: return ver.PriorityStr else: @@ -325,10 +321,10 @@ class Package(object): """Return the short description (one line summary).""" if not self._lookupRecord(): return "" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) desc_iter = ver.TranslatedDescription - self._records.Lookup(desc_iter.FileList.pop(0)) - return self._records.ShortDesc + self._pcache._records.Lookup(desc_iter.FileList.pop(0)) + return self._pcache._records.ShortDesc @property def description(self, format=True, useDots=False): @@ -344,12 +340,12 @@ class Package(object): if not self._lookupRecord(): return "" # get the translated description - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) desc_iter = ver.TranslatedDescription - self._records.Lookup(desc_iter.FileList.pop(0)) + self._pcache._records.Lookup(desc_iter.FileList.pop(0)) desc = "" try: - dsc = unicode(self._records.LongDesc, "utf-8") + dsc = unicode(self._pcache._records.LongDesc, "utf-8") except UnicodeDecodeError, err: dsc = _("Invalid unicode in description for '%s' (%s). " "Please report.") % (self.name, err) @@ -391,53 +387,53 @@ class Package(object): """return the long description (raw).""" if not self._lookupRecord(): return "" - return self._records.LongDesc + return self._pcache._records.LongDesc @property def candidateRecord(self): """Return the Record of the candidate version of the package.""" if not self._lookupRecord(True): return None - return Record(self._records.Record) + return Record(self._pcache._records.Record) @property def installedRecord(self): """Return the Record of the candidate version of the package.""" if not self._lookupRecord(False): return None - return Record(self._records.Record) + return Record(self._pcache._records.Record) # depcache states @property def markedInstall(self): """Return True if the package is marked for install.""" - return self._depcache.MarkedInstall(self._pkg) + return self._pcache._depcache.MarkedInstall(self._pkg) @property def markedUpgrade(self): """Return True if the package is marked for upgrade.""" - return self._depcache.MarkedUpgrade(self._pkg) + return self._pcache._depcache.MarkedUpgrade(self._pkg) @property def markedDelete(self): """Return True if the package is marked for delete.""" - return self._depcache.MarkedDelete(self._pkg) + return self._pcache._depcache.MarkedDelete(self._pkg) @property def markedKeep(self): """Return True if the package is marked for keep.""" - return self._depcache.MarkedKeep(self._pkg) + return self._pcache._depcache.MarkedKeep(self._pkg) @property def markedDowngrade(self): """ Package is marked for downgrade """ - return self._depcache.MarkedDowngrade(self._pkg) + return self._pcache._depcache.MarkedDowngrade(self._pkg) @property def markedReinstall(self): """Return True if the package is marked for reinstall.""" - return self._depcache.MarkedReinstall(self._pkg) + return self._pcache._depcache.MarkedReinstall(self._pkg) @property def isInstalled(self): @@ -447,7 +443,7 @@ class Package(object): @property def isUpgradable(self): """Return True if the package is upgradable.""" - return self.isInstalled and self._depcache.IsUpgradable(self._pkg) + return self.isInstalled and self._pcache._depcache.IsUpgradable(self._pkg) @property def isAutoRemovable(self): @@ -457,14 +453,14 @@ class Package(object): another package, and if no packages depend on it anymore, the package is no longer required. """ - return self.isInstalled and self._depcache.IsGarbage(self._pkg) + return self.isInstalled and self._pcache._depcache.IsGarbage(self._pkg) # sizes @property def packageSize(self): """Return the size of the candidate deb package.""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) return ver.Size @property @@ -476,7 +472,7 @@ class Package(object): @property def candidateInstalledSize(self, UseCandidate=True): """Return the size of the candidate installed package.""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) if ver: return ver.Size else: @@ -545,7 +541,7 @@ class Package(object): # assume "main" section src_section = "main" # use the section of the candidate as a starting point - section = self._depcache.GetCandidateVer(self._pkg).Section + section = self._pcache._depcache.GetCandidateVer(self._pkg).Section # get the source version, start with the binaries version bin_ver = self.candidateVersion @@ -661,7 +657,7 @@ class Package(object): @property def candidateOrigin(self): """Return the Origin() of the candidate version.""" - ver = self._depcache.GetCandidateVer(self._pkg) + ver = self._pcache._depcache.GetCandidateVer(self._pkg) if not ver: return None origins = [] @@ -674,7 +670,7 @@ class Package(object): def markKeep(self): """Mark a package for keep.""" self._pcache.cachePreChange() - self._depcache.MarkKeep(self._pkg) + self._pcache._depcache.MarkKeep(self._pkg) self._pcache.cachePostChange() def markDelete(self, autoFix=True, purge=False): @@ -687,10 +683,10 @@ class Package(object): well. The default is to keep the configuration. """ self._pcache.cachePreChange() - self._depcache.MarkDelete(self._pkg, purge) + self._pcache._depcache.MarkDelete(self._pkg, purge) # try to fix broken stuffsta - if autoFix and self._depcache.BrokenCount > 0: - Fix = apt_pkg.GetPkgProblemResolver(self._depcache) + if autoFix and self._pcache._depcache.BrokenCount > 0: + Fix = apt_pkg.GetPkgProblemResolver(self._pcache._depcache) Fix.Clear(self._pkg) Fix.Protect(self._pkg) Fix.Remove(self._pkg) @@ -713,10 +709,10 @@ class Package(object): it. """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg, autoInst, fromUser) + self._pcache._depcache.MarkInstall(self._pkg, autoInst, fromUser) # try to fix broken stuff - if autoFix and self._depcache.BrokenCount > 0: - fixer = apt_pkg.GetPkgProblemResolver(self._depcache) + if autoFix and self._pcache._depcache.BrokenCount > 0: + fixer = apt_pkg.GetPkgProblemResolver(self._pcache._depcache) fixer.Clear(self._pkg) fixer.Protect(self._pkg) fixer.Resolve(True) @@ -740,7 +736,7 @@ class Package(object): The parameter `iprogress` refers to an InstallProgress() object, as found in apt.progress. """ - self._depcache.Commit(fprogress, iprogress) + self._pcache._depcache.Commit(fprogress, iprogress) def _test(): diff --git a/debian/changelog b/debian/changelog index ffacbec0..f8494712 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ python-apt (0.7.9~exp3) experimental; urgency=low config from it as well * python/configuration.cc, python/apt_pkgmodule.cc: - add apt_pkg.ReadConfigDir() + * apt/package.py: + - avoid uneeded interal references in the Package objects -- -- cgit v1.2.3