diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-19 11:23:24 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-19 11:23:24 +0200 |
commit | 48f046aec4df3b09906ca41e2c75ce7e0fb045a6 (patch) | |
tree | 5562fc5377f9592a6293735e8baf78230a1a48a6 /portato/backend | |
parent | be7f3e89a19cadad856dae717836f9ed3a66c85d (diff) | |
parent | 52f04fc6cccffa7cf31a4d7eab9c9b341f77a293 (diff) | |
download | portato-48f046aec4df3b09906ca41e2c75ce7e0fb045a6.tar.gz portato-48f046aec4df3b09906ca41e2c75ce7e0fb045a6.tar.bz2 portato-48f046aec4df3b09906ca41e2c75ce7e0fb045a6.zip |
Merged from trunk
Diffstat (limited to '')
-rw-r--r-- | portato/backend/portage/package.py | 36 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 2 |
2 files changed, 26 insertions, 12 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 02d141a..3502306 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -189,7 +189,7 @@ class PortagePackage (Package): return [d for d in deps if d[0] != "!"] - def get_dep_packages (self, depvar = ["RDEPEND", "PDEPEND", "DEPEND"], with_criterions = False): + def get_dep_packages (self, depvar = ["RDEPEND", "PDEPEND", "DEPEND"], with_criterions = False, return_blocks = False): dep_pkgs = [] # the package list # change the useflags, because we have internally changed some, but not made them visible for portage @@ -221,28 +221,37 @@ class PortagePackage (Package): for dep in deps: if dep[0] == '!': # blocking sth - dep = dep[1:] - if dep != self.get_cp(): # not cpv, because a version might explicitly block another one - blocked = system.find_packages(dep, "installed", only_cpv = True) - if blocked != []: - raise BlockedException, (self.get_cpv(), blocked[0]) + blocked = system.find_packages(dep, "installed", only_cpv = True) + if len(blocked) == 1: # only exact one match allowed to be harmless + if blocked[0].get_slot_cp() == self.get_slot_cp(): # blocks in the same slot are harmless + continue + + if return_blocks: + if with_criterions: + dep_pkgs.append((dep, dep)) + else: + dep_pkgs.append(dep) + else: + raise BlockedException, (self.get_cpv(), blocked[0].get_cpv()) + continue # finished with the blocking one -> next pkg = system.find_best_match(dep) if not pkg: # try to find masked ones - list = system.find_packages(dep, masked = True) - if not list: + pkgs = system.find_packages(dep, masked = True) + if not pkgs: raise PackageNotFoundException, dep - list = system.sort_package_list(list) + pkgs = system.sort_package_list(pkgs) + pkgs.reverse() done = False - for p in reversed(list): + for p in pkgs: if not p.is_masked(): dep_pkgs.append(create_dep_pkgs_data(dep, p)) done = True break if not done: - dep_pkgs.append(create_dep_pkgs_data(dep, list[0])) + dep_pkgs.append(create_dep_pkgs_data(dep, pkgs[0])) else: dep_pkgs.append(create_dep_pkgs_data(dep, pkg)) @@ -256,7 +265,10 @@ class PortagePackage (Package): return v def get_ebuild_path(self): - return self._settings.porttree.dbapi.findname(self._cpv) + if self.is_in_system(): + return self._settings.porttree.dbapi.findname(self._cpv) + else: + return self._settings.vartree.dbapi.findname(self._cpv) def get_files (self): if self.is_installed(): diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index e14908c..0d81945 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -168,6 +168,8 @@ class PortageSystem (SystemInterface): if self._version >= (2,1,5): t += [pkg.get_cpv() for pkg in self.find_packages(search_key, "installed") if not (pkg.is_testing(True) or pkg.is_masked())] + else: + t = self.find_packages(search_key, "installed", only_cpv=True) if t: t = unique_array(t) |