1 |
commit: 5268ad9569a7b1d40694301fe9efa96801c83812 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 1 21:52:04 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 1 21:52:04 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5268ad95 |
7 |
|
8 |
action_deselect: expand cat against world atoms |
9 |
|
10 |
--- |
11 |
pym/_emerge/actions.py | 36 ++++++++++++++++++++++++------------ |
12 |
1 files changed, 24 insertions(+), 12 deletions(-) |
13 |
|
14 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
15 |
index 20220fc..c752800 100644 |
16 |
--- a/pym/_emerge/actions.py |
17 |
+++ b/pym/_emerge/actions.py |
18 |
@@ -1218,25 +1218,37 @@ def action_deselect(settings, trees, opts, atoms): |
19 |
level=logging.ERROR, noiselevel=-1) |
20 |
return 1 |
21 |
|
22 |
- vardb = root_config.trees['vartree'].dbapi |
23 |
- expanded_atoms = set(atoms) |
24 |
- from portage.dep import Atom |
25 |
- for atom in atoms: |
26 |
- if not atom.startswith(SETPREFIX): |
27 |
- for cpv in vardb.match(atom): |
28 |
- slot, = vardb.aux_get(cpv, ['SLOT']) |
29 |
- if not slot: |
30 |
- slot = '0' |
31 |
- expanded_atoms.add(Atom('%s:%s' % (portage.cpv_getkey(cpv), slot))) |
32 |
- |
33 |
pretend = '--pretend' in opts |
34 |
locked = False |
35 |
if not pretend and hasattr(world_set, 'lock'): |
36 |
world_set.lock() |
37 |
locked = True |
38 |
try: |
39 |
- discard_atoms = set() |
40 |
world_set.load() |
41 |
+ world_atoms = world_set.getAtoms() |
42 |
+ vardb = root_config.trees["vartree"].dbapi |
43 |
+ expanded_atoms = set(atoms) |
44 |
+ |
45 |
+ for atom in atoms: |
46 |
+ if not atom.startswith(SETPREFIX): |
47 |
+ if atom.cp.startswith("null/"): |
48 |
+ # try to expand category from world set |
49 |
+ null_cat, pn = portage.catsplit(atom.cp) |
50 |
+ for world_atom in world_atoms: |
51 |
+ cat, world_pn = portage.catsplit(world_atom.cp) |
52 |
+ if pn == world_pn: |
53 |
+ expanded_atoms.add( |
54 |
+ Atom(atom.replace("null", cat, 1), |
55 |
+ allow_repo=True, allow_wildcard=True)) |
56 |
+ |
57 |
+ for cpv in vardb.match(atom): |
58 |
+ slot, = vardb.aux_get(cpv, ["SLOT"]) |
59 |
+ if not slot: |
60 |
+ slot = "0" |
61 |
+ expanded_atoms.add(Atom("%s:%s" % \ |
62 |
+ (portage.cpv_getkey(cpv), slot))) |
63 |
+ |
64 |
+ discard_atoms = set() |
65 |
for atom in world_set: |
66 |
for arg_atom in expanded_atoms: |
67 |
if arg_atom.startswith(SETPREFIX): |