X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=commands%2Fconfig.py;h=4b2be310e53136ff2e6a094cb634c6d662b9d162;hb=b2159bc7bba132874a632d438d41b2a0f7651d79;hp=c089074dc8fec98974bbd2959041db698cde0fd6;hpb=1136b600d92b4193c208c061fc8db0182d58e526;p=tools%2Fsat.git diff --git a/commands/config.py b/commands/config.py index c089074..4b2be31 100644 --- a/commands/config.py +++ b/commands/config.py @@ -57,6 +57,8 @@ parser.add_option('', 'show_install', 'boolean', 'show_install', _("Optional: synthetic list of all install directories in the application")) parser.add_option('', 'show_properties', 'boolean', 'show_properties', _("Optional: synthetic list of all properties used in the application")) +parser.add_option('', 'check_system', 'boolean', 'check_system', + _("Optional: check if system products are installed")) parser.add_option('c', 'copy', 'boolean', 'copy', _("""Optional: copy a config file to the personal config files directory. WARNING: the included files are not copied. @@ -527,6 +529,8 @@ class ConfigManager: if "APPLICATION" in cfg and "rm_products" in cfg.APPLICATION: for prod_to_remove in cfg.APPLICATION.rm_products: cfg.APPLICATION.products.__delitem__(prod_to_remove) + # remove rm_products section after usage + cfg.APPLICATION.__delitem__("rm_products") return cfg def set_user_config_file(self, config): @@ -782,6 +786,35 @@ def show_patchs(config, logger): else: logger.write("No patchs found\n", 1) +def check_install_system(config, logger): + '''Check the installation of all (declared) system products + + :param config Config: the global configuration. + :param logger Logger: The logger instance to use for the display + ''' + # get the command to use for checking the system dependencies + # (either rmp or apt) + check_cmd=src.system.get_pkg_check_cmd() + logger.write("\nCheck the system dependencies declared in the application\n",1) + pkgmgr=check_cmd[0] + for product in sorted(config.APPLICATION.products): + try: + product_info = src.product.get_product_config(config, product) + if src.product.product_is_native(product_info): + # if the product is native, get (in two dictionnaries the runtime and compile time + # system dependencies with the status (OK/KO) + run_pkg,build_pkg=src.product.check_system_dep(check_cmd, product_info) + #logger.write("\n*** %s ***\n" % product, 1) + for pkg in run_pkg: + logger.write(run_pkg[pkg], 1) + for pkg in build_pkg: + logger.write(build_pkg[pkg], 1) + # logger.write(src.printcolors.printcInfo(" %s\n" % i), 1) + + except Exception as e: + msg = "problem with the check of system prerequisite %s\n%s\n" % (product, str(e)) + logger.error(msg) + def show_install_dir(config, logger): '''Prints all the used installed directories in the application. @@ -810,18 +843,23 @@ def show_properties(config, logger): :param config Config: the global configuration. :param logger Logger: The logger instance to use for the display ''' + if "properties" in config.APPLICATION: + # some properties are defined at application level, we display them + logger.write("Application properties:\n", 1) + for prop in config.APPLICATION.properties: + logger.write(src.printcolors.printcInfo(" %s : %s\n" % (prop, config.APPLICATION.properties[prop])), 1) oneOrMore = False for product in sorted(config.APPLICATION.products): try: product_info = src.product.get_product_config(config, product) done = False try: - for i in product_info.properties: + for prop in product_info.properties: if not done: logger.write("%s:\n" % product, 1) done = True oneOrMore = True - logger.write(src.printcolors.printcInfo(" %s\n" % i), 1) + logger.write(src.printcolors.printcInfo(" %s : %s\n" % (prop, product_info.properties[prop])), 1) except Exception as e: pass except Exception as e: @@ -1131,9 +1169,14 @@ def run(args, runner, logger): # case : give a synthetic view of all patches used in the application if options.show_properties: src.check_config_has_application(runner.cfg) + # Print some informations logger.write(_('Properties of application %s\n') % src.printcolors.printcLabel(runner.cfg.VARS.application), 3) logger.write("\n", 2, False) show_properties(runner.cfg, logger) + # check system prerequisites + if options.check_system: + check_install_system(runner.cfg, logger) + pass