[DEV] add multiple compilation requesting with xxx* (only work with * at the end)

This commit is contained in:
Edouard DUPIN 2016-03-16 23:41:25 +01:00
parent 5995effd9e
commit 1ec07b9446

View File

@ -500,97 +500,106 @@ class Target:
if len(action_list) == 0: if len(action_list) == 0:
action_list = ["build"] action_list = ["build"]
debug.verbose("requested : " + module_name + " ? actions:" + str(action_list)) debug.verbose("requested : " + module_name + " ? actions:" + str(action_list))
for action_name in action_list: multiple_module_list = []
debug.verbose("requested : " + module_name + "?" + action_name + " [START]") if module_name[-1] == "*":
ret = None; base_name = module_name[:-1]
if action_name == "install": for mod in module.list_all_module():
try: if mod[:len(base_name)] == base_name:
self.install_package(module_name) debug.verbose("need do it for: " + mod);
except AttributeError: multiple_module_list.append(mod)
debug.error("target have no 'install_package' instruction") else:
elif action_name == "uninstall": multiple_module_list.append(module_name)
try: for module_name in multiple_module_list:
self.un_install_package(module_name) for action_name in action_list:
except AttributeError: debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
debug.error("target have no 'un_install_package' instruction") ret = None;
elif action_name[:3] == "run": if action_name == "install":
if len(action_name) > 3: try:
# we have option: self.install_package(module_name)
action_name2 = action_name.replace("\:", "1234COLUMN4321") except AttributeError:
option_list = action_name2.split(":") debug.error("target have no 'install_package' instruction")
if len(option_list) == 0: elif action_name == "uninstall":
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'") try:
option_list = [] self.un_install_package(module_name)
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
if len(action_name) > 3:
# we have option:
action_name2 = action_name.replace("\:", "1234COLUMN4321")
option_list = action_name2.split(":")
if len(option_list) == 0:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list_tmp = option_list[1:]
option_list = []
for elem in option_list_tmp:
option_list.append(elem.replace("1234COLUMN4321", ":"))
else: else:
option_list_tmp = option_list[1:]
option_list = [] option_list = []
for elem in option_list_tmp: #try:
option_list.append(elem.replace("1234COLUMN4321", ":")) self.run(module_name, option_list)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else: else:
option_list = [] present = self.load_if_needed(module_name, optionnal=optionnal)
#try: if present == False \
self.run(module_name, option_list) and optionnal == True:
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False]
else:
# clean requested
for mod in self.module_list:
if mod.name == module_name:
if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display(self)
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list = option_list[1:]
else:
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, None), True]
else:
ret = mod.build(self, None)
break
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False] ret = [heritage.HeritageList(), False]
break else:
if ret == None: for mod in self.module_list:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it") if mod.name == module_name:
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]") if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display(self)
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list = option_list[1:]
else:
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, None), True]
else:
ret = mod.build(self, None)
break
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
if len(action_list) == 1: if len(action_list) == 1:
return ret return ret