summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-30 07:19:22 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-30 07:19:22 +0000
commit0d3928be1bbc32e27d9af5ea269a1427150e45a6 (patch)
treecf5dc690047922a4e7c49aa1a0b9069c0ca520c4
parentAdd a new --deselect action which removes atoms from the world file. This (diff)
downloadportage-multirepo-0d3928be1bbc32e27d9af5ea269a1427150e45a6.tar.gz
portage-multirepo-0d3928be1bbc32e27d9af5ea269a1427150e45a6.tar.bz2
portage-multirepo-0d3928be1bbc32e27d9af5ea269a1427150e45a6.zip
Fix bugs in action_deselect() and add --pretend support. (trunk r13364)
svn path=/main/branches/2.1.6/; revision=13520
-rw-r--r--pym/_emerge/__init__.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 3ba88ecc..7d22e027 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -13889,8 +13889,9 @@ def action_deselect(settings, trees, opts, atoms):
writemsg_level("World set does not appear to be mutable.\n",
level=logging.ERROR, noiselevel=-1)
return 1
+ pretend = '--pretend' in opts
locked = False
- if not hasattr(world_set, 'lock'):
+ if not pretend and hasattr(world_set, 'lock'):
world_set.lock()
locked = True
try:
@@ -13902,16 +13903,18 @@ def action_deselect(settings, trees, opts, atoms):
# nested set
continue
for arg_atom in atoms:
- if arg_atom.intersects(atom):
+ if arg_atom.intersects(atom) and \
+ not (arg_atom.slot and not atom.slot):
discard_atoms.add(atom)
- break
+ break
if discard_atoms:
for atom in sorted(discard_atoms):
print ">>> Removing %s from \"world\" favorites file..." % \
colorize("INFORM", str(atom))
remaining = set(world_set)
remaining.difference_update(discard_atoms)
- world_set.replace(remaining)
+ if not pretend:
+ world_set.replace(remaining)
else:
print ">>> No matching atoms found in \"world\" favorites file..."
finally:
@@ -15611,7 +15614,7 @@ def emerge_main():
if portage.secpass < 2:
# We've already allowed "--version" and "--help" above.
if "--pretend" not in myopts and myaction not in ("search","info"):
- need_superuser = not \
+ need_superuser = myaction in ('deselect',) or not \
(fetchonly or \
(buildpkgonly and secpass >= 1) or \
myaction in ("metadata", "regen") or \