--- mock.multicfg 2006-05-10 16:03:43.000000000 -0500 +++ mock.multicfg2 2006-05-10 16:26:07.000000000 -0500 @@ -649,9 +649,9 @@ clean - clean out the specified chroot init - initialize the chroot, do not build anything""" parser = OptionParser(usage=usage, version=__VERSION__) - parser.add_option("-r", action="store", type="string", dest="chroot", + parser.add_option("-r", action="append", type="string", dest="chroot", help="chroot name/config file name default: %default", - default='default') + default=[]) parser.add_option("--no-clean", action ="store_true", dest="dirty", help="do not clean chroot before building") parser.add_option("--arch", action ="store", dest="arch", @@ -811,55 +811,58 @@ # cli option parsing (options, args) = command_parse() - # set default config_opts - config_opts = {} - set_default_config_opts(config_opts) - + if not options.chroot: options.chroot = ['default'] + if len(args) < 1: error("No srpm or command specified - nothing to do") sys.exit(50) - if options.configdir: - config_path = options.configdir + for config in options.chroot: + # set default config_opts + config_opts = {} + set_default_config_opts(config_opts) + + if options.configdir: + config_path = options.configdir - # read in the config file by chroot name - if options.chroot.endswith('.cfg'): - cfg = '%s/%s' % (config_path, options.chroot) - else: - cfg = '%s/%s.cfg' % (config_path, options.chroot) + # read in the config file by chroot name + if config.endswith('.cfg'): + cfg = '%s/%s' % (config_path, config) + else: + cfg = '%s/%s.cfg' % (config_path, config) - if os.path.exists(cfg): - execfile(cfg) - else: - error("Could not find config file %s for chroot %s" % (cfg, options.chroot)) - sys.exit(1) + if os.path.exists(cfg): + execfile(cfg) + else: + error("Could not find config file %s for chroot %s" % (cfg, config)) + sys.exit(1) - set_config_opts_from_cmdline(config_opts, options) + set_config_opts_from_cmdline(config_opts, options) - # do whatever we're here to do - if args[0] == 'clean': - do_clean(config_opts, prep=False ) - - elif args[0] == 'init': - do_clean(config_opts, prep=True ) - - elif args[0] == 'chroot': - config_opts['clean'] = config_opts['quiet'] = False - my= Root(config_opts) - my.do_chroot(' '.join(args[1:]), True) - print 'Finished chroot command' + # do whatever we're here to do + if args[0] == 'clean': + do_clean(config_opts, prep=False ) - else: - if args[0] == 'rebuild': - if len(args) > 1: - srpms = args[1:] - else: - error("No package specified to rebuild command.") - sys.exit(50) + elif args[0] == 'init': + do_clean(config_opts, prep=True ) + + elif args[0] == 'chroot': + config_opts['clean'] = config_opts['quiet'] = False + my= Root(config_opts) + my.do_chroot(' '.join(args[1:]), True) + print 'Finished chroot command' + else: - srpms = args[0:] - - do_rebuild( config_opts, srpms ) + if args[0] == 'rebuild': + if len(args) > 1: + srpms = args[1:] + else: + error("No package specified to rebuild command.") + sys.exit(50) + else: + srpms = args[0:] + + do_rebuild( config_opts, srpms ) if __name__ == '__main__': main()