From f3edb21fb5ac1a1ef20b0e370f6ff812e7c0f9df Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Tue, 20 Oct 2009 20:05:42 +0300 Subject: [PATCH] Further enhancements to configuration simplification --- build.py | 5 ++--- configure.py | 23 ++++++++++++++++------- scripts/cml/generate_container_cml.py | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build.py b/build.py index f39e0c8..19fd529 100755 --- a/build.py +++ b/build.py @@ -16,12 +16,11 @@ from configure import * from config.parse_options import * def main(): - options, args = build_parse_options() - + opts, args = build_parse_options() # # Configure # - configure_system(options, args) + configure_system(opts, args) # # Build the kernel diff --git a/configure.py b/configure.py index e91e548..4e20557 100755 --- a/configure.py +++ b/configure.py @@ -76,8 +76,8 @@ def build_parse_options(): parser.add_option("-f", "--use-file", dest = "cml_file", help = "Supply user-defined cml file " "(Use only if you want to override default)") - parser.add_option("-r", "--reset-old-config", action = "store_true", - default = False, dest = "reset_old_config", + parser.add_option("-r", "--reset-config", action = "store_true", + default = False, dest = "reset_config", help = "Reset configuration file settings " "(If you had configured before and changing the " "rule file, this will reset existing values to default)") @@ -92,6 +92,14 @@ def build_parse_options(): (options, args) = parser.parse_args() + if options.cml_file and options.reset_config: + parser.error("options -f and -r are mutually exclusive") + exit() + + # -f implies -c + if options.cml_file: + options.config = 1 + return options, args @@ -109,10 +117,11 @@ def configure_system(options, args): # If we have an existing config file or one supplied in options # and we're not forced to autogenerate, we use the config file. # - # Otherwise we autogenerate a ruleset and compile it. + # Otherwise we autogenerate a ruleset and compile it, and create + # a configuration file from it from scratch. # - if options.cml_file or os.path.exists(CML2_CONFIG_FILE) \ - and not options.reset_old_config: + if (options.cml_file or os.path.exists(CML2_CONFIG_FILE)) \ + and not options.reset_config: if options.cml_file: cml2_config_file = options.cml_file else: @@ -131,7 +140,7 @@ def configure_system(options, args): # Create configuration from existing file os.system(CML2TOOLSDIR + '/cmlconfigure.py -c -o ' + \ - CML2_CONFIG_FILE + ' -i ' + CML2_CONFIG_FILE + \ + CML2_CONFIG_FILE + ' -i ' + cml2_config_file + \ ' ' + CML2_COMPILED_RULES) else: rules_file = autogen_rules_file(options, args) @@ -169,7 +178,7 @@ def configure_system(options, args): generate_kernel_cinfo(config, KERNEL_CINFO_PATH) # Print out the configuration if asked - if opts.print_config: + if options.print_config: config.config_print() return config diff --git a/scripts/cml/generate_container_cml.py b/scripts/cml/generate_container_cml.py index 0e26be7..00e0848 100755 --- a/scripts/cml/generate_container_cml.py +++ b/scripts/cml/generate_container_cml.py @@ -39,6 +39,7 @@ def add_container_constraint(cid): return cml_string def generate_container_cml(arch, ncont): + print "Autogenerating new rule file" fbody = "" with open(join(CML2_CONFIG_SRCDIR, arch + '.ruleset')) as in_ruleset: fbody += in_ruleset.read()