summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2008-09-28 17:02:51 +0000
committerMarius Mauch <genone@gentoo.org>2008-09-28 17:02:51 +0000
commit5883ba88a08f0d8f802b7ca3a251f0165f902b1a (patch)
treedc236f6037ae7256f977433f356e40d1d368075f
parent6e5246e6a463a40849bae470304e50da03521151 (diff)
downloadportage-5883ba88a08f0d8f802b7ca3a251f0165f902b1a.tar.gz
portage-5883ba88a08f0d8f802b7ca3a251f0165f902b1a.tar.bz2
portage-5883ba88a08f0d8f802b7ca3a251f0165f902b1a.zip
Properly process set arguments inside set expressions
svn path=/main/trunk/; revision=11583
-rw-r--r--pym/_emerge/__init__.py86
1 files changed, 48 insertions, 38 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 39ab9f661..f533a0eb6 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -13362,25 +13362,8 @@ def expand_set_arguments(myfiles, myaction, root_config):
retval = os.EX_OK
setconfig = root_config.setconfig
- # display errors that occured while loading the SetConfig instance
- for e in setconfig.errors:
- print colorize("BAD", "Error during set creation: %s" % e)
-
sets = setconfig.getSets()
- # emerge relies on the existance of sets with names "world" and "system"
- required_sets = ("world", "system")
-
- for s in required_sets:
- if s not in sets:
- msg = ["emerge: incomplete set configuration, " + \
- "no \"%s\" set defined" % s]
- msg.append(" sets defined: %s" % ", ".join(sets))
- for line in msg:
- sys.stderr.write(line + "\n")
- retval = 1
- unmerge_actions = ("unmerge", "prune", "clean", "depclean")
-
# In order to know exactly which atoms/sets should be added to the
# world file, the depgraph performs set expansion later. It will get
# confused about where the atoms came from if it's not allowed to
@@ -13399,34 +13382,61 @@ def expand_set_arguments(myfiles, myaction, root_config):
# separators for set arguments
ARG_START = "{"
ARG_END = "}"
+
+ # WARNING: all operators must be of equal length
+ IS_OPERATOR = "/@"
+ DIFF_OPERATOR = "-@"
+ UNION_OPERATOR = "+@"
for i in range(0, len(myfiles)):
if myfiles[i].startswith(SETPREFIX):
+ start = 0
+ end = 0
x = myfiles[i][len(SETPREFIX):]
- start = x.find(ARG_START)
- end = x.find(ARG_END)
- if start > 0 and start < end:
- namepart = x[:start]
- argpart = x[start+1:end]
+ newset = ""
+ while x:
+ start = x.find(ARG_START)
+ end = x.find(ARG_END)
+ if start > 0 and start < end:
+ namepart = x[:start]
+ argpart = x[start+1:end]
+
+ # TODO: implement proper quoting
+ args = argpart.split(",")
+ options = {}
+ for a in args:
+ if "=" in a:
+ k, v = a.split("=", 1)
+ options[k] = v
+ else:
+ options[a] = "True"
+ setconfig.update(namepart, options)
+ newset += (x[:start-len(namepart)]+namepart)
+ x = x[end+len(ARG_END):]
+ else:
+ newset += x
+ x = ""
+ myfiles[i] = SETPREFIX+newset
- # TODO: implement proper quoting
- args = argpart.split(",")
- options = {}
- for a in args:
- if "=" in a:
- k, v = a.split("=", 1)
- options[k] = v
- else:
- options[a] = "True"
- setconfig.update(namepart, options)
- myfiles[i] = SETPREFIX + namepart
sets = setconfig.getSets()
- # WARNING: all operators must be of equal length
- IS_OPERATOR = "/@"
- DIFF_OPERATOR = "-@"
- UNION_OPERATOR = "+@"
-
+ # display errors that occured while loading the SetConfig instance
+ for e in setconfig.errors:
+ print colorize("BAD", "Error during set creation: %s" % e)
+
+ # emerge relies on the existance of sets with names "world" and "system"
+ required_sets = ("world", "system")
+
+ for s in required_sets:
+ if s not in sets:
+ msg = ["emerge: incomplete set configuration, " + \
+ "no \"%s\" set defined" % s]
+ msg.append(" sets defined: %s" % ", ".join(sets))
+ for line in msg:
+ sys.stderr.write(line + "\n")
+ retval = 1
+ unmerge_actions = ("unmerge", "prune", "clean", "depclean")
+
for a in myfiles:
if a.startswith(SETPREFIX):
# support simple set operations (intersection, difference and union)