Gentoo Archives: gentoo-commits

From: "Marius Mauch (genone)" <genone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11583 - main/trunk/pym/_emerge
Date: Sun, 28 Sep 2008 17:02:56
Message-Id: E1KjzfZ-0008Ty-BH@stork.gentoo.org
1 Author: genone
2 Date: 2008-09-28 17:02:51 +0000 (Sun, 28 Sep 2008)
3 New Revision: 11583
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Properly process set arguments inside set expressions
9
10 Modified: main/trunk/pym/_emerge/__init__.py
11 ===================================================================
12 --- main/trunk/pym/_emerge/__init__.py 2008-09-28 17:01:58 UTC (rev 11582)
13 +++ main/trunk/pym/_emerge/__init__.py 2008-09-28 17:02:51 UTC (rev 11583)
14 @@ -13362,25 +13362,8 @@
15 retval = os.EX_OK
16 setconfig = root_config.setconfig
17
18 - # display errors that occured while loading the SetConfig instance
19 - for e in setconfig.errors:
20 - print colorize("BAD", "Error during set creation: %s" % e)
21 -
22 sets = setconfig.getSets()
23
24 - # emerge relies on the existance of sets with names "world" and "system"
25 - required_sets = ("world", "system")
26 -
27 - for s in required_sets:
28 - if s not in sets:
29 - msg = ["emerge: incomplete set configuration, " + \
30 - "no \"%s\" set defined" % s]
31 - msg.append(" sets defined: %s" % ", ".join(sets))
32 - for line in msg:
33 - sys.stderr.write(line + "\n")
34 - retval = 1
35 - unmerge_actions = ("unmerge", "prune", "clean", "depclean")
36 -
37 # In order to know exactly which atoms/sets should be added to the
38 # world file, the depgraph performs set expansion later. It will get
39 # confused about where the atoms came from if it's not allowed to
40 @@ -13399,34 +13382,61 @@
41 # separators for set arguments
42 ARG_START = "{"
43 ARG_END = "}"
44 +
45 + # WARNING: all operators must be of equal length
46 + IS_OPERATOR = "/@"
47 + DIFF_OPERATOR = "-@"
48 + UNION_OPERATOR = "+@"
49
50 for i in range(0, len(myfiles)):
51 if myfiles[i].startswith(SETPREFIX):
52 + start = 0
53 + end = 0
54 x = myfiles[i][len(SETPREFIX):]
55 - start = x.find(ARG_START)
56 - end = x.find(ARG_END)
57 - if start > 0 and start < end:
58 - namepart = x[:start]
59 - argpart = x[start+1:end]
60 + newset = ""
61 + while x:
62 + start = x.find(ARG_START)
63 + end = x.find(ARG_END)
64 + if start > 0 and start < end:
65 + namepart = x[:start]
66 + argpart = x[start+1:end]
67
68 - # TODO: implement proper quoting
69 - args = argpart.split(",")
70 - options = {}
71 - for a in args:
72 - if "=" in a:
73 - k, v = a.split("=", 1)
74 - options[k] = v
75 - else:
76 - options[a] = "True"
77 - setconfig.update(namepart, options)
78 - myfiles[i] = SETPREFIX + namepart
79 + # TODO: implement proper quoting
80 + args = argpart.split(",")
81 + options = {}
82 + for a in args:
83 + if "=" in a:
84 + k, v = a.split("=", 1)
85 + options[k] = v
86 + else:
87 + options[a] = "True"
88 + setconfig.update(namepart, options)
89 + newset += (x[:start-len(namepart)]+namepart)
90 + x = x[end+len(ARG_END):]
91 + else:
92 + newset += x
93 + x = ""
94 + myfiles[i] = SETPREFIX+newset
95 +
96 sets = setconfig.getSets()
97
98 - # WARNING: all operators must be of equal length
99 - IS_OPERATOR = "/@"
100 - DIFF_OPERATOR = "-@"
101 - UNION_OPERATOR = "+@"
102 -
103 + # display errors that occured while loading the SetConfig instance
104 + for e in setconfig.errors:
105 + print colorize("BAD", "Error during set creation: %s" % e)
106 +
107 + # emerge relies on the existance of sets with names "world" and "system"
108 + required_sets = ("world", "system")
109 +
110 + for s in required_sets:
111 + if s not in sets:
112 + msg = ["emerge: incomplete set configuration, " + \
113 + "no \"%s\" set defined" % s]
114 + msg.append(" sets defined: %s" % ", ".join(sets))
115 + for line in msg:
116 + sys.stderr.write(line + "\n")
117 + retval = 1
118 + unmerge_actions = ("unmerge", "prune", "clean", "depclean")
119 +
120 for a in myfiles:
121 if a.startswith(SETPREFIX):
122 # support simple set operations (intersection, difference and union)