diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-04-29 21:45:25 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-05-27 01:50:33 -0700 |
commit | b6060200e016b2c6d7fa828cd611a83abc2a0064 (patch) | |
tree | 2c08e2dee99ff56c0efbafe31581a154a2711d03 /pym/_emerge/actions.py | |
parent | 4a2bcdc20f7559748b168238faeb63cd801cb417 (diff) | |
download | portage-b6060200e016b2c6d7fa828cd611a83abc2a0064.tar.gz portage-b6060200e016b2c6d7fa828cd611a83abc2a0064.tar.bz2 portage-b6060200e016b2c6d7fa828cd611a83abc2a0064.zip |
Make --deselect work for sets (bug 268798)
Diffstat (limited to 'pym/_emerge/actions.py')
-rw-r--r-- | pym/_emerge/actions.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 78f564c95..148b8c31f 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1164,11 +1164,12 @@ def action_deselect(settings, trees, opts, atoms): expanded_atoms = set(atoms) from portage.dep import Atom for atom in atoms: - for cpv in vardb.match(atom): - slot, = vardb.aux_get(cpv, ['SLOT']) - if not slot: - slot = '0' - expanded_atoms.add(Atom('%s:%s' % (portage.cpv_getkey(cpv), slot))) + if not atom.startswith(SETPREFIX): + for cpv in vardb.match(atom): + slot, = vardb.aux_get(cpv, ['SLOT']) + if not slot: + slot = '0' + expanded_atoms.add(Atom('%s:%s' % (portage.cpv_getkey(cpv), slot))) pretend = '--pretend' in opts locked = False @@ -1179,14 +1180,16 @@ def action_deselect(settings, trees, opts, atoms): discard_atoms = set() world_set.load() for atom in world_set: - if not isinstance(atom, Atom): - # nested set - continue for arg_atom in expanded_atoms: - if arg_atom.intersects(atom) and \ - not (arg_atom.slot and not atom.slot): - discard_atoms.add(atom) - break + if arg_atom.startswith(SETPREFIX): + if arg_atom == atom: + discard_atoms.add(atom) + break + else: + if arg_atom.intersects(atom) and \ + not (arg_atom.slot and not atom.slot): + discard_atoms.add(atom) + break if discard_atoms: for atom in sorted(discard_atoms): print(">>> Removing %s from \"world\" favorites file..." % \ @@ -2310,6 +2313,9 @@ def action_uninstall(settings, trees, ldpath_mtimes, # multiple files in a single iter_owners() call. lookup_owners.append(x) + elif x.startswith(SETPREFIX) and action == "deselect": + valid_atoms.append(x) + else: msg = [] msg.append("'%s' is not a valid package atom." % (x,)) |