From: SONOLET Aymeric Date: Mon, 11 Dec 2023 09:31:25 +0000 (+0100) Subject: fix(upgrade): really check if sources are newer than compiled binary. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa9ff297a1e5111880b25478750275d55f5bf3b1;p=tools%2Fsat.git fix(upgrade): really check if sources are newer than compiled binary. --- diff --git a/commands/upgrade.py b/commands/upgrade.py index b6233e8..15aa755 100644 --- a/commands/upgrade.py +++ b/commands/upgrade.py @@ -39,14 +39,6 @@ parser.add_option( "products", _("Optional: products to upgrade. This option accepts a comma separated list."), ) -parser.add_option( - "f", - "force", - "boolean", - "force", - "Optional: force the compilation of product, even if it is already " - "installed. The BUILD directory is cleaned before compilation.", -) parser.add_option( "", "with_fathers", @@ -207,22 +199,9 @@ def log_res_step(logger, res): logger.flush() -def upgrade_all_products( +def clean_before_build( sat, config, options, products_infos, all_products_dict, all_products_graph, logger ): - """Execute the proper configuration commands - in each product build directory. - - :param config Config: The global configuration - :param products_info list: List of - (str, Config) => (product_name, product_info) - :param all_products_dict: Dict of all products - :param all_products_graph: graph of all products - :param logger Logger: The logger instance to use for the display and logging - :return: the number of failing commands. - :rtype: int - """ - # first loop for the cleaning check_salome_configuration = False updated_products = [] for p_name_info in products_infos: @@ -238,16 +217,6 @@ def upgrade_all_products( ): continue - # Clean the the install directory - # if the corresponding option was called - if options.force: - sat.clean( - config.VARS.application + " --products " + p_name + " --build", - batch=True, - verbose=0, - logger_add_link=logger, - ) - if src.product.product_is_vcs(p_info): try: do_update = False @@ -270,7 +239,10 @@ def upgrade_all_products( if do_update: updated_products.append(p_name) sat.clean( - config.VARS.application + " --products " + p_name + " --install", + config.VARS.application + + " --products " + + p_name + + " --install", batch=True, verbose=0, logger_add_link=logger, @@ -310,6 +282,34 @@ def upgrade_all_products( res += 1 if res > 0: return res # error configure dependency : we stop the compilation + return 0 + + +def upgrade_all_products( + sat, config, options, products_infos, all_products_dict, all_products_graph, logger +): + """Execute the proper configuration commands + in each product build directory. + + :param config Config: The global configuration + :param products_info list: List of + (str, Config) => (product_name, product_info) + :param all_products_dict: Dict of all products + :param all_products_graph: graph of all products + :param logger Logger: The logger instance to use for the display and logging + :return: the number of failing commands. + :rtype: int + """ + # first loop for the cleaning + clean_before_build( + sat, + config, + options, + products_infos, + all_products_dict, + all_products_graph, + logger, + ) # second loop to upgrade res = 0 @@ -367,7 +367,7 @@ def upgrade_all_products( # if we don't force compilation, check if the was already successfully installed. # we don't compile in this case. - if (not options.force) and src.product.check_installation(config, p_info): + if src.product.check_installation(config, p_info): logger.write(_("Already installed")) logger.write(_(" in %s" % p_info.install_dir), 4) logger.write(_("\n")) @@ -833,9 +833,6 @@ def run(args, runner, logger): # Parse the options (options, args) = parser.parse_args(args) - if options.force: - options.update = False # update is useless in this case - # check that the command has been called with an application src.check_config_has_application(runner.cfg) @@ -867,8 +864,10 @@ def run(args, runner, logger): runner.cfg.APPLICATION.products, runner.cfg ) all_products_graph = get_dependencies_graph(all_products_infos) - # logger.write("Dependency graph of all application products : %s\n" % all_products_graph, 6) - DBG.write("Dependency graph of all application products : ", all_products_graph) + logger.write( + "Dependency graph of all application products : %s\n" % all_products_graph, 6 + ) + # DBG.write("Dependency graph of all application products : ", all_products_graph) # Get the list of products we have to upgrade products_infos = src.product.get_products_list(options, runner.cfg, logger)