Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13787 - main/trunk/pym/_emerge
Date: Sun, 05 Jul 2009 09:34:21
Message-Id: E1MNO6y-0006de-MC@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-07-05 09:34:16 +0000 (Sun, 05 Jul 2009)
3 New Revision: 13787
4
5 Modified:
6 main/trunk/pym/_emerge/main.py
7 Log:
8 Remove set operator support since the current implementation does not meet
9 user expectations, as mentioned in bug #253802, comment #5:
10
11 Package set operators currently operate on atoms, but what users really need
12 is for them to operate on the packages themselves. This will allow one set to
13 add or subtract packages from another even though the sets to not use the exact
14 same atoms to refer to the given packages.
15
16 I imagine the way this should be done is to create a mapping of atom -> package
17 for each set, perform the intersection using the packages, and then map the
18 package intersection back into a set of atoms.
19
20
21 Modified: main/trunk/pym/_emerge/main.py
22 ===================================================================
23 --- main/trunk/pym/_emerge/main.py 2009-07-04 20:33:46 UTC (rev 13786)
24 +++ main/trunk/pym/_emerge/main.py 2009-07-05 09:34:16 UTC (rev 13787)
25 @@ -658,11 +658,6 @@
26 ARG_START = "{"
27 ARG_END = "}"
28
29 - # WARNING: all operators must be of equal length
30 - IS_OPERATOR = "/@"
31 - DIFF_OPERATOR = "-@"
32 - UNION_OPERATOR = "+@"
33 -
34 for i in range(0, len(myfiles)):
35 if myfiles[i].startswith(SETPREFIX):
36 start = 0
37 @@ -727,44 +722,7 @@
38 unmerge_actions = ("unmerge", "prune", "clean", "depclean")
39
40 for a in myfiles:
41 - if a.startswith(SETPREFIX):
42 - # support simple set operations (intersection, difference and union)
43 - # on the commandline. Expressions are evaluated strictly left-to-right
44 - if IS_OPERATOR in a or DIFF_OPERATOR in a or UNION_OPERATOR in a:
45 - expression = a[len(SETPREFIX):]
46 - expr_sets = []
47 - expr_ops = []
48 - while IS_OPERATOR in expression or DIFF_OPERATOR in expression or UNION_OPERATOR in expression:
49 - is_pos = expression.rfind(IS_OPERATOR)
50 - diff_pos = expression.rfind(DIFF_OPERATOR)
51 - union_pos = expression.rfind(UNION_OPERATOR)
52 - op_pos = max(is_pos, diff_pos, union_pos)
53 - s1 = expression[:op_pos]
54 - s2 = expression[op_pos+len(IS_OPERATOR):]
55 - op = expression[op_pos:op_pos+len(IS_OPERATOR)]
56 - if not s2 in sets:
57 - display_missing_pkg_set(root_config, s2)
58 - return (None, 1)
59 - expr_sets.insert(0, s2)
60 - expr_ops.insert(0, op)
61 - expression = s1
62 - if not expression in sets:
63 - display_missing_pkg_set(root_config, expression)
64 - return (None, 1)
65 - expr_sets.insert(0, expression)
66 - result = set(setconfig.getSetAtoms(expression))
67 - for i in range(0, len(expr_ops)):
68 - s2 = setconfig.getSetAtoms(expr_sets[i+1])
69 - if expr_ops[i] == IS_OPERATOR:
70 - result.intersection_update(s2)
71 - elif expr_ops[i] == DIFF_OPERATOR:
72 - result.difference_update(s2)
73 - elif expr_ops[i] == UNION_OPERATOR:
74 - result.update(s2)
75 - else:
76 - raise NotImplementedError("unknown set operator %s" % expr_ops[i])
77 - newargs.extend(result)
78 - else:
79 + if a.startswith(SETPREFIX):
80 s = a[len(SETPREFIX):]
81 if s not in sets:
82 display_missing_pkg_set(root_config, s)