Fix package selection logic in order to prevent downgrade in cases
authorZac Medico <zmedico@gentoo.org>
Thu, 14 Feb 2008 07:30:57 +0000 (07:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 14 Feb 2008 07:30:57 +0000 (07:30 -0000)
when selective is True and the currently installed version does
not have a matching ebuild in the tree. For example, this type of
situation is likely to occur if the user somehow obtains a binary
package that has a newer version than any of the ebuilds in the
portage tree. If package maintainers want to encourage a downgrade
in a case like this then they should use package.mask so that the
user receives a warning about the installed package being masked.

svn path=/main/trunk/; revision=9336

pym/_emerge/__init__.py

index e5e48fe487d431408b3d87d54d4e73606af6e10e..d16c4fc20ceda16e8ab5402f89d1061e62e426ae 100644 (file)
@@ -2514,10 +2514,12 @@ class depgraph(object):
                        for db, pkg_type, built, installed, db_keys in dbs:
                                if existing_node:
                                        break
-                               if installed and not find_existing_node and \
+                               if not selective and installed and not find_existing_node and \
                                        (matched_packages or empty):
-                                       # We only need to select an installed package here
-                                       # if there is no other choice.
+                                       # We only need to select an installed package in the
+                                       # following cases:
+                                       #   1) there is no other choice
+                                       #   2) selective is True
                                        continue
                                if hasattr(db, "xmatch"):
                                        cpv_list = db.xmatch("match-all", atom)