summaryrefslogtreecommitdiff
path: root/portato/backend/portage
diff options
context:
space:
mode:
Diffstat (limited to 'portato/backend/portage')
-rw-r--r--portato/backend/portage/system.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index c241a4b..4453df7 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -194,8 +194,8 @@ class PortageSystem (SystemInterface):
if VERSION >= (2,1,5):
t += [pkg.get_cpv() for pkg in self.find_packages(search_key, self.SET_INSTALLED) if not (pkg.is_testing(True) or pkg.is_masked())]
- else:
- t = self.find_packages(search_key, self.SET_INSTALLED, only_cpv=True)
+ elif not only_installed: # no need to run twice
+ t += self.find_packages(search_key, self.SET_INSTALLED, only_cpv=True)
if t:
t = unique_array(t)
@@ -237,6 +237,19 @@ class PortageSystem (SystemInterface):
"""
new_packages = []
+
+ def append(crit, best, inst):
+ if not best:
+ return
+
+ if not best.is_installed() and (best.is_masked() or best.is_testing(True)): # check to not update unnecessairily
+ for i in inst:
+ if i.matches(crit):
+ debug("The installed %s matches %s. Discarding upgrade to masked version.", i.get_cpv(), crit)
+ return
+
+ new_packages.append(best)
+
for p in packages:
inst = self.find_packages(p, self.SET_INSTALLED)
@@ -256,10 +269,10 @@ class PortageSystem (SystemInterface):
myslots.add(best_p.get_package_settings("SLOT")) # add the slot of the best package in portage
for slot in myslots:
- new_packages.append(\
- self.find_best(self.find_packages("%s:%s" % (i.get_cp(), slot), only_cpv = True)))
+ crit = "%s:%s" % (p, slot)
+ append(crit, self.find_best_match(crit), inst)
else:
- new_packages.append(best_p)
+ append(p, best_p, inst)
return new_packages
@@ -348,15 +361,6 @@ class PortageSystem (SystemInterface):
else:
for pkg in bm:
if not pkg: continue
- if not pkg.is_installed() and (pkg.is_masked() or pkg.is_testing(True)): # check to not update unnecessairily
- cont = False
- for inst in self.find_packages(pkg.get_cp(), self.SET_INSTALLED, only_cpv = True):
- if self.cpv_matches(inst, i):
- debug("The installed %s matches %s. Discarding upgrade to masked version.", inst, i)
- cont = True
- break
- if cont: continue
-
check(pkg, state[1], appended) # XXX: should be 'or'ed with prev_appended?
for p in self.get_new_packages(packages):