mirror of
https://github.com/drasko/codezero.git
synced 2026-07-19 13:45:23 +02:00
Further enhancements to configuration simplification
This commit is contained in:
5
build.py
5
build.py
@@ -16,12 +16,11 @@ from configure import *
|
|||||||
from config.parse_options import *
|
from config.parse_options import *
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
options, args = build_parse_options()
|
opts, args = build_parse_options()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configure
|
# Configure
|
||||||
#
|
#
|
||||||
configure_system(options, args)
|
configure_system(opts, args)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build the kernel
|
# Build the kernel
|
||||||
|
|||||||
23
configure.py
23
configure.py
@@ -76,8 +76,8 @@ def build_parse_options():
|
|||||||
parser.add_option("-f", "--use-file", dest = "cml_file",
|
parser.add_option("-f", "--use-file", dest = "cml_file",
|
||||||
help = "Supply user-defined cml file "
|
help = "Supply user-defined cml file "
|
||||||
"(Use only if you want to override default)")
|
"(Use only if you want to override default)")
|
||||||
parser.add_option("-r", "--reset-old-config", action = "store_true",
|
parser.add_option("-r", "--reset-config", action = "store_true",
|
||||||
default = False, dest = "reset_old_config",
|
default = False, dest = "reset_config",
|
||||||
help = "Reset configuration file settings "
|
help = "Reset configuration file settings "
|
||||||
"(If you had configured before and changing the "
|
"(If you had configured before and changing the "
|
||||||
"rule file, this will reset existing values to default)")
|
"rule file, this will reset existing values to default)")
|
||||||
@@ -92,6 +92,14 @@ def build_parse_options():
|
|||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(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
|
return options, args
|
||||||
|
|
||||||
|
|
||||||
@@ -109,10 +117,11 @@ def configure_system(options, args):
|
|||||||
# If we have an existing config file or one supplied in options
|
# If we have an existing config file or one supplied in options
|
||||||
# and we're not forced to autogenerate, we use the config file.
|
# 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) \
|
if (options.cml_file or os.path.exists(CML2_CONFIG_FILE)) \
|
||||||
and not options.reset_old_config:
|
and not options.reset_config:
|
||||||
if options.cml_file:
|
if options.cml_file:
|
||||||
cml2_config_file = options.cml_file
|
cml2_config_file = options.cml_file
|
||||||
else:
|
else:
|
||||||
@@ -131,7 +140,7 @@ def configure_system(options, args):
|
|||||||
|
|
||||||
# Create configuration from existing file
|
# Create configuration from existing file
|
||||||
os.system(CML2TOOLSDIR + '/cmlconfigure.py -c -o ' + \
|
os.system(CML2TOOLSDIR + '/cmlconfigure.py -c -o ' + \
|
||||||
CML2_CONFIG_FILE + ' -i ' + CML2_CONFIG_FILE + \
|
CML2_CONFIG_FILE + ' -i ' + cml2_config_file + \
|
||||||
' ' + CML2_COMPILED_RULES)
|
' ' + CML2_COMPILED_RULES)
|
||||||
else:
|
else:
|
||||||
rules_file = autogen_rules_file(options, args)
|
rules_file = autogen_rules_file(options, args)
|
||||||
@@ -169,7 +178,7 @@ def configure_system(options, args):
|
|||||||
generate_kernel_cinfo(config, KERNEL_CINFO_PATH)
|
generate_kernel_cinfo(config, KERNEL_CINFO_PATH)
|
||||||
|
|
||||||
# Print out the configuration if asked
|
# Print out the configuration if asked
|
||||||
if opts.print_config:
|
if options.print_config:
|
||||||
config.config_print()
|
config.config_print()
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ def add_container_constraint(cid):
|
|||||||
return cml_string
|
return cml_string
|
||||||
|
|
||||||
def generate_container_cml(arch, ncont):
|
def generate_container_cml(arch, ncont):
|
||||||
|
print "Autogenerating new rule file"
|
||||||
fbody = ""
|
fbody = ""
|
||||||
with open(join(CML2_CONFIG_SRCDIR, arch + '.ruleset')) as in_ruleset:
|
with open(join(CML2_CONFIG_SRCDIR, arch + '.ruleset')) as in_ruleset:
|
||||||
fbody += in_ruleset.read()
|
fbody += in_ruleset.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user