diff options
author | necoro <> | 2006-12-06 22:33:49 +0000 |
---|---|---|
committer | necoro <> | 2006-12-06 22:33:49 +0000 |
commit | 437364739954d8281ad199e2fa0a9fd57ad8c344 (patch) | |
tree | 8f024f3dc4abf4664013a6dd180ea50d499e603e /portato/backend | |
parent | 285ef518c9f99349153581d9addba665ba3944eb (diff) | |
download | portato-437364739954d8281ad199e2fa0a9fd57ad8c344.tar.gz portato-437364739954d8281ad199e2fa0a9fd57ad8c344.tar.bz2 portato-437364739954d8281ad199e2fa0a9fd57ad8c344.zip |
added handling of masked packages during an update-world; small changes in gentoolkit-code
Diffstat (limited to 'portato/backend')
-rw-r--r-- | portato/backend/package.py | 25 | ||||
-rw-r--r-- | portato/backend/portage_helper.py | 24 |
2 files changed, 24 insertions, 25 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py index 6e32776..3ff9a79 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -19,27 +19,29 @@ import portage, portage_dep from portage_util import unique_array import types +import os.path class Package: - """This is a subclass of the gentoolkit.Package-class which a lot of additional functionality we need in Portato.""" + """This is a class abstracting a normal package which can be installed.""" def __init__ (self, cpv): """Constructor. - @param cpv: The cpv or gentoolkit.Package which describes the package to create. - @type cpv: string (cat/pkg-ver) or gentoolkit.Package-object.""" + @param cpv: The cpv which describes the package to create. + @type cpv: string (cat/pkg-ver)""" self._cpv = cpv self._scpv = portage.catpkgsplit(self._cpv) if not self._scpv: - raise FatalError("invalid cpv: %s" % cpv) + raise ValueError("invalid cpv: %s" % cpv) + self._db = None self._settings = settings self._settingslock = settingslock try: - self._status = portage.getmaskingstatus(self.get_cpv(), settings = settings) + self._status = portage.getmaskingstatus(self.get_cpv(), settings = self._settings) except KeyError: # package is not located in the system self._status = None @@ -51,7 +53,7 @@ class Package: def is_overlay(self): """Returns true if the package is in an overlay.""" dir,ovl = portage.portdb.findname2(self._cpv) - return ovl != settings["PORTDIR"] + return ovl != self._settings["PORTDIR"] def is_in_system (self): """Returns False if the package could not be found in the portage system. @@ -347,7 +349,7 @@ class Package: def get_settings(self, key): """Returns the value of the given key for this package (useful - for package.* files.""" + for package.* files).""" self._settingslock.acquire() self._settings.setcpv(self._cpv) v = self._settings[key] @@ -377,10 +379,7 @@ class Package: else: mytree = tree r = mytree.dbapi.aux_get(self._cpv,[var]) - if not r: - raise FatalError("Could not find the package tree") - if len(r) != 1: - raise FatalError("Should only get one element!") + return r[0] def get_use_flags(self): @@ -400,7 +399,7 @@ class Package: # if name is different elif v1[1] != v2[1]: return cmp(v1[1],v2[1]) - # Compaare versions + # Compare versions else: return portage.pkgcmp(v1[1:],v2[1:]) @@ -410,7 +409,7 @@ class Package: if not self._db: cat = self.get_category() pnv = self.get_name()+"-"+self.get_version() - self._db = portage.dblink(cat,pnv,settings["ROOT"],settings) + self._db = portage.dblink(cat, pnv, self._settings["ROOT"], self._settings) def matches (self, criterion): """This checks, whether this package matches a specific verisioning criterion - e.g.: "<=net-im/foobar-1.2". diff --git a/portato/backend/portage_helper.py b/portato/backend/portage_helper.py index 1726323..814a0bb 100644 --- a/portato/backend/portage_helper.py +++ b/portato/backend/portage_helper.py @@ -78,22 +78,22 @@ def find_packages (search_key, masked=False): try: if masked: - t = portage.db["/"]["porttree"].dbapi.xmatch("match-all", search_key) - t += portage.db["/"]["vartree"].dbapi.match(search_key) + t = porttree.dbapi.xmatch("match-all", search_key) + t += vartree.dbapi.match(search_key) else: - t = portage.db["/"]["porttree"].dbapi.match(search_key) - t += portage.db["/"]["vartree"].dbapi.match(search_key) - # catch the "amgigous package" Exception + t = porttree.dbapi.match(search_key) + t += vartree.dbapi.match(search_key) + # catch the "ambigous package" Exception except ValueError, e: if type(e[0]) == types.ListType: t = [] for cp in e[0]: if masked: - t += portage.db["/"]["porttree"].dbapi.xmatch("match-all", cp) - t += portage.db["/"]["vartree"].dbapi.match(cp) + t += porttree.dbapi.xmatch("match-all", cp) + t += vartree.dbapi.match(cp) else: - t += portage.db["/"]["porttree"].dbapi.match(cp) - t += portage.db["/"]["vartree"].dbapi.match(cp) + t += porttree.dbapi.match(cp) + t += vartree.dbapi.match(cp) else: raise ValueError(e) # Make the list of packages unique @@ -113,13 +113,13 @@ def find_installed_packages (search_key, masked=False): @rtype: backend.Package[]""" try: - t = portage.db["/"]["vartree"].dbapi.match(search_key) - # catch the "amgigous package" Exception + t = vartree.dbapi.match(search_key) + # catch the "ambigous package" Exception except ValueError, e: if type(e[0]) == types.ListType: t = [] for cp in e[0]: - t += portage.db["/"]["vartree"].dbapi.match(cp) + t += vartree.dbapi.match(cp) else: raise ValueError(e) |