From f64dd53bad86a2f91f1b152cfcfa9c4f6eb0b13f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 1 Mar 2011 13:52:04 -0800 Subject: [PATCH] action_deselect: expand cat against world atoms --- pym/_emerge/actions.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index ea8fc42fc..b683a37e8 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1218,25 +1218,37 @@ def action_deselect(settings, trees, opts, atoms): level=logging.ERROR, noiselevel=-1) return 1 - vardb = root_config.trees['vartree'].dbapi - expanded_atoms = set(atoms) - from portage.dep import Atom - for atom in atoms: - 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 if not pretend and hasattr(world_set, 'lock'): world_set.lock() locked = True try: - discard_atoms = set() world_set.load() + world_atoms = world_set.getAtoms() + vardb = root_config.trees["vartree"].dbapi + expanded_atoms = set(atoms) + + for atom in atoms: + if not atom.startswith(SETPREFIX): + if atom.cp.startswith("null/"): + # try to expand category from world set + null_cat, pn = portage.catsplit(atom.cp) + for world_atom in world_atoms: + cat, world_pn = portage.catsplit(world_atom.cp) + if pn == world_pn: + expanded_atoms.add( + Atom(atom.replace("null", cat, 1), + allow_repo=True, allow_wildcard=True)) + + 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))) + + discard_atoms = set() for atom in world_set: for arg_atom in expanded_atoms: if arg_atom.startswith(SETPREFIX): -- 2.26.2