summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-31 14:07:27 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-31 14:07:27 +0000
commitfd8498e96c048d32e30fa500ec0dc3767dc1027e (patch)
treeac8075274d70cac63c2e66ee4a95befa2b62b1b5 /pym/portage.py
parentdae732da66c10976ba37800c0418d0d9acfc4872 (diff)
downloadportage-fd8498e96c048d32e30fa500ec0dc3767dc1027e.tar.gz
portage-fd8498e96c048d32e30fa500ec0dc3767dc1027e.tar.bz2
portage-fd8498e96c048d32e30fa500ec0dc3767dc1027e.zip
Use slot atom matching to simplify detection of downgrades relative to installed packages.
svn path=/main/trunk/; revision=5437
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 41a73957e..82cafc643 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3996,7 +3996,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
# Check if the set of atoms will result in a downgrade of
# an installed package. If they will then don't prefer them
# over other atoms.
- is_downgrade = False
+ has_downgrade = False
versions = {}
if all_installed or all_available:
for atom in atoms:
@@ -4004,23 +4004,21 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg = best(mydbapi.match(atom))
if not avail_pkg:
continue
- avail_slot = mydbapi.aux_get(avail_pkg, ["SLOT"])[0]
- versions["%s:%s" % (mykey, avail_slot)] = avail_pkg
- avail_split = catpkgsplit(avail_pkg)[1:]
- inst_pkgs = vardb.match(mykey)
- if not inst_pkgs:
+ avail_slot = "%s:%s" % (mykey,
+ mydbapi.aux_get(avail_pkg, ["SLOT"])[0])
+ versions[avail_slot] = avail_pkg
+ inst_pkg = vardb.match(avail_slot)
+ if not inst_pkg:
continue
- for pkg in inst_pkgs:
- if avail_slot != vardb.aux_get(pkg, ["SLOT"])[0]:
- continue
- if pkgcmp(avail_split, catpkgsplit(pkg)[1:]) < 0:
- is_downgrade = True
- break
- if is_downgrade:
+ # emerge guarantees 1 package per slot here (highest counter)
+ inst_pkg = inst_pkg[0]
+ if avail_pkg != inst_pkg and \
+ avail_pkg != best([avail_pkg, inst_pkg]):
+ has_downgrade = True
break
this_choice = (atoms, versions, all_available)
- if not is_downgrade:
+ if not has_downgrade:
if all_installed:
preferred.append(this_choice)
continue