summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-06-08 18:24:44 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-06-08 18:24:44 +0200
commitee446ef74d1a1a63ce0fdc0b7076a3150e63352f (patch)
tree3c2284f39e4a802a7a91b069092df5ccead8bfac /portato/backend
parent40b5396e7c1a290461bbafb920f3961fd8ca5255 (diff)
downloadportato-ee446ef74d1a1a63ce0fdc0b7076a3150e63352f.tar.gz
portato-ee446ef74d1a1a63ce0fdc0b7076a3150e63352f.tar.bz2
portato-ee446ef74d1a1a63ce0fdc0b7076a3150e63352f.zip
Make blocks way more intelligent
Diffstat (limited to '')
-rw-r--r--portato/backend/portage/package.py33
1 files changed, 20 insertions, 13 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 424945e..b07dc93 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -202,7 +202,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
@@ -234,30 +234,37 @@ class PortagePackage (Package):
for dep in deps:
if dep[0] == '!': # blocking sth
- dep = dep[1:]
- blocked = system.find_installed_packages(dep)
- if blocked:
- if blocked[0].get_slot_cp() != self.get_slot_cp(): # blocks in the same slot are harmless
- raise BlockedException, (self.get_cpv(), blocked[0].get_cpv())
+ blocked = system.find_installed_packages(dep[1:])
+ 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)
- list.reverse()
+ pkgs = system.sort_package_list(pkgs)
+ pkgs.reverse()
done = False
- for i in range(len(list)):
- p = list[i]
+ 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))