summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-06 06:41:04 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-06 06:41:04 +0000
commit2bd00ddc063d34c2a037869d7822e097ad2aabb6 (patch)
tree52ce4dd2a65d6808ae42c5464fe493489cda91ec
parent1a680f7ebd9859d0a1a0db7fb242534abae5b2fe (diff)
downloadportage-2bd00ddc063d34c2a037869d7822e097ad2aabb6.tar.gz
portage-2bd00ddc063d34c2a037869d7822e097ad2aabb6.tar.bz2
portage-2bd00ddc063d34c2a037869d7822e097ad2aabb6.zip
Bug #198129 - Prevent SLOT atoms like sys-devel/binutils:0
from being inappropriately recorded in the world file when USE=multislot is enabled. svn path=/main/trunk/; revision=8438
-rw-r--r--pym/_emerge/__init__.py38
1 files changed, 28 insertions, 10 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 933c4ce9b..67f8d7306 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -631,19 +631,37 @@ def create_world_atom(pkg_key, metadata, args_set, root_config):
# If the user gave a specific atom, store it as a
# slot atom in the world file.
slot_atom = "%s:%s" % (cp, metadata["SLOT"])
- # First verify the slot is in the portage tree to avoid
- # adding a bogus slot like that produced by multislot.
+
+ # For USE=multislot, there are a couple of cases to
+ # handle here:
+ #
+ # 1) SLOT="0", but the real SLOT spontaneously changed to some
+ # unknown value, so just record an unslotted atom.
+ #
+ # 2) SLOT comes from an installed package and there is no
+ # matching SLOT in the portage tree.
+ #
+ # Make sure that the slot atom is available in either the
+ # portdb or the vardb, since otherwise the user certainly
+ # doesn't want the SLOT atom recorded in the world file
+ # (case 1 above). If it's only available in the vardb,
+ # the user may be trying to prevent a USE=multislot
+ # package from being removed by --depclean (case 2 above).
+
mydb = portdb
if not portdb.match(slot_atom):
+ # SLOT seems to come from an installed multislot package
mydb = vardb
- # Now verify that the argument is precise
- # enough to identify a specific slot.
- matches = mydb.match(arg_atom)
- matched_slots = set()
- for cpv in matches:
- matched_slots.add(mydb.aux_get(cpv, ["SLOT"])[0])
- if len(matched_slots) == 1:
- new_world_atom = slot_atom
+ if mydb.match(slot_atom):
+ # Now verify that the argument is precise
+ # enough to identify a specific slot.
+ matches = mydb.match(arg_atom)
+ matched_slots = set()
+ for cpv in matches:
+ matched_slots.add(mydb.aux_get(cpv, ["SLOT"])[0])
+ if len(matched_slots) == 1:
+ new_world_atom = slot_atom
+
if new_world_atom == sets["world"].findAtomForPackage(pkg_key, metadata):
# Both atoms would be identical, so there's nothing to add.
return None