# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 07 Apr 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst,
+ modules/catalyst/config.py:
+ Get rid of addlargs in the main script Initial basics for multiple target
+ support Move targetmap into global config object
+
07 Apr 2009; Andrew Gaffney <agaffney@gentoo.org>
modules/catalyst/target/stage1.py:
Clean up cleanables
msg("Envscript support enabled.")
conf_values["ENVSCRIPT"] = myconf["envscript"]
-def build_target(addlargs, targetmap):
- try:
- if not addlargs["target"] in targetmap:
- raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
+def build_targets():
+ spec_values = config.get_spec().get_values()
+ targetmap = config.get_targetmap()
- config.get_spec().set_target(addlargs["target"])
-# mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
- mytarget=targetmap[addlargs["target"]]()
+ if not "targets" in spec_values or not spec_values['targets']:
+ raise CatalystError, "No target(s) specified."
- mytarget.run()
+ for x in spec_values['targets']:
+ if not x in targetmap:
+ raise CatalystError("Target \"" + x + "\" is not a known target.")
- except:
- catalyst.util.print_traceback()
- warn("Error encountered during run of target " + addlargs["target"])
- raise
+ for x in spec_values['targets']:
+ try:
+ config.get_spec().set_target(x)
+ mytarget = targetmap[x]()
+ mytarget.run()
+
+ except:
+ catalyst.util.print_traceback()
+ warn("Error encountered during run of target " + x)
+ raise
def verify_digest_and_hash_functions():
# Start checking that digests are valid now that the hash_map was imported from catalyst_support
verify_digest_and_hash_functions()
targetmap = catalyst.target.build_target_map()
-
- addlargs = {}
spec = catalyst.config.Spec()
if myspecfile:
specparser = catalyst.config.SpecParser(myspecfile)
spec_values = specparser.get_values()
- addlargs.update(spec_values)
spec.parse_values(spec_values)
if mycmdline:
cmdline = catalyst.config.ConfigParser()
cmdline.parse_lines(mycmdline)
cmdline_values = cmdline.get_values()
- addlargs.update(cmdline.get_values())
spec.parse_values(cmdline_values)
except CatalystError:
die("Could not parse commandline, exiting.")
config.set_spec(spec)
config.set_conf(conf_values)
-
- if not "target" in addlargs:
- raise CatalystError, "Required value \"target\" not specified."
+ config.set_targetmap(targetmap)
# everything is setup, so the build is a go
try:
- build_target(addlargs, targetmap)
+ build_targets()
except CatalystError:
msg()
if not parts[0] in self.values:
self.values[parts[0]] = {}
self.values[parts[0]]['/'.join(parts[1:])] = values[x]
+ if 'target' in self.values['global']:
+ self.values['global']['targets'] = set((self.values['global']['target'], ))
+ del self.values['global']['target']
def set_target(self, target):
self.target = target
if not hasattr(self, 'spec'):
self.spec = None
self.conf = {}
+ self.targetmap = None
def set_spec(self, spec):
self.spec = spec
def get_conf(self):
return self.conf
+
+ def set_targetmap(self, targetmap):
+ self.targetmap = targetmap
+
+ def get_targetmap(self):
+ return self.targetmap