diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-31 14:07:27 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-31 14:07:27 +0000 |
commit | fd8498e96c048d32e30fa500ec0dc3767dc1027e (patch) | |
tree | ac8075274d70cac63c2e66ee4a95befa2b62b1b5 | |
parent | dae732da66c10976ba37800c0418d0d9acfc4872 (diff) | |
download | portage-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
-rw-r--r-- | pym/portage.py | 26 |
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 |