1 |
Author: zmedico |
2 |
Date: 2009-04-30 07:19:22 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13520 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Fix bugs in action_deselect() and add --pretend support. (trunk r13364) |
9 |
|
10 |
Modified: main/branches/2.1.6/pym/_emerge/__init__.py |
11 |
=================================================================== |
12 |
--- main/branches/2.1.6/pym/_emerge/__init__.py 2009-04-30 07:19:02 UTC (rev 13519) |
13 |
+++ main/branches/2.1.6/pym/_emerge/__init__.py 2009-04-30 07:19:22 UTC (rev 13520) |
14 |
@@ -13889,8 +13889,9 @@ |
15 |
writemsg_level("World set does not appear to be mutable.\n", |
16 |
level=logging.ERROR, noiselevel=-1) |
17 |
return 1 |
18 |
+ pretend = '--pretend' in opts |
19 |
locked = False |
20 |
- if not hasattr(world_set, 'lock'): |
21 |
+ if not pretend and hasattr(world_set, 'lock'): |
22 |
world_set.lock() |
23 |
locked = True |
24 |
try: |
25 |
@@ -13902,16 +13903,18 @@ |
26 |
# nested set |
27 |
continue |
28 |
for arg_atom in atoms: |
29 |
- if arg_atom.intersects(atom): |
30 |
+ if arg_atom.intersects(atom) and \ |
31 |
+ not (arg_atom.slot and not atom.slot): |
32 |
discard_atoms.add(atom) |
33 |
- break |
34 |
+ break |
35 |
if discard_atoms: |
36 |
for atom in sorted(discard_atoms): |
37 |
print ">>> Removing %s from \"world\" favorites file..." % \ |
38 |
colorize("INFORM", str(atom)) |
39 |
remaining = set(world_set) |
40 |
remaining.difference_update(discard_atoms) |
41 |
- world_set.replace(remaining) |
42 |
+ if not pretend: |
43 |
+ world_set.replace(remaining) |
44 |
else: |
45 |
print ">>> No matching atoms found in \"world\" favorites file..." |
46 |
finally: |
47 |
@@ -15611,7 +15614,7 @@ |
48 |
if portage.secpass < 2: |
49 |
# We've already allowed "--version" and "--help" above. |
50 |
if "--pretend" not in myopts and myaction not in ("search","info"): |
51 |
- need_superuser = not \ |
52 |
+ need_superuser = myaction in ('deselect',) or not \ |
53 |
(fetchonly or \ |
54 |
(buildpkgonly and secpass >= 1) or \ |
55 |
myaction in ("metadata", "regen") or \ |