maven-chain: support multiple config files

This commit is contained in:
Mike Bonnet 2014-06-11 13:47:41 -04:00 committed by Mike McLean
parent fb325c7936
commit 238c45a95e

View file

@ -1242,7 +1242,7 @@ def _wrapper_params(parser, opts, items):
def handle_maven_chain(options, session, args):
"Run a set of Maven builds in dependency order"
usage = _("usage: %prog maven-chain [options] target config")
usage = _("usage: %prog maven-chain [options] target config...")
usage += _("\n(Specify the --help global option for a list of other help options)")
parser = OptionParser(usage=usage)
parser.add_option("--skip-tag", action="store_true",
@ -1258,8 +1258,8 @@ def handle_maven_chain(options, session, args):
parser.add_option("--background", action="store_true",
help=_("Run the build at a lower priority"))
(build_opts, args) = parser.parse_args(args)
if len(args) != 2:
parser.error(_("Exactly two arguments (a build target and a config file) are required"))
if len(args) < 2:
parser.error(_("Two arguments (a build target and a config file) are required"))
assert False
activate_session(session)
target = args[0]
@ -1277,9 +1277,10 @@ def handle_maven_chain(options, session, args):
if val:
opts[key] = val
config = ConfigParser.ConfigParser()
conf_fd = file(args[1])
config.readfp(conf_fd)
conf_fd.close()
for configfile in args[1:]:
conf_fd = file(configfile)
config.readfp(conf_fd)
conf_fd.close()
builds = {}
depmap = {}
for package in config.sections():
@ -1303,7 +1304,7 @@ def handle_maven_chain(options, session, args):
order = koji.util.tsort(depmap)
except ValueError, e:
# if there is no possible build order, fail fast
print parser.error(_("Unable to run chain build, circular dependencies"))
print parser.error(_("Unable to run chain build, unresolved or circular dependencies"))
assert False
priority = None
if build_opts.background: