From 26575dce964cddf4ccfc5e5a531bba06ea6be478 Mon Sep 17 00:00:00 2001 From: crouzet Date: Thu, 18 Jun 2020 11:41:54 +0200 Subject: [PATCH] sat #18350 : option -f pour forcer la (re)compilation d'un produit, independamment de l'existence du repertoire d'installation --- commands/compile.py | 18 ++++++++++++++++-- complete_sat.sh | 2 +- doc/src/commands/compile.rst | 4 ++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/commands/compile.py b/commands/compile.py index 885223e..f814c88 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -34,6 +34,8 @@ except NameError: parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', _('Optional: products to compile. 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', 'boolean', 'fathers', _("Optional: build all necessary products to the given product (KERNEL is " "build before building GUI)."), False) @@ -194,6 +196,17 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict verbose=0, logger_add_link = logger) + # Clean the the install directory + # if the corresponding option was called + if options.force and not options.clean_all: + log_step(logger, header, "CLEAN BUILD ") + sat.clean(config.VARS.application + + " --products " + p_name + + " --build", + batch=True, + verbose=0, + logger_add_link = logger) + # Recompute the product information to get the right install_dir # (it could change if there is a clean of the install directory) p_info = src.product.get_product_config(config, p_name) @@ -234,8 +247,9 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict res += 1 continue - # Check if it was already successfully installed - if src.product.check_installation(config, p_info): + # 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): logger.write(_("Already installed")) logger.write(_(" in %s" % p_info.install_dir), 4) logger.write(_("\n")) diff --git a/complete_sat.sh b/complete_sat.sh index b499b1e..53dbdb4 100755 --- a/complete_sat.sh +++ b/complete_sat.sh @@ -207,7 +207,7 @@ _salomeTools_complete() return 0 ;; compile) - opts="--products --properties --with_fathers --with_children --clean_all --clean_make --install_flags --show --stop_first_fail --check --clean_build_after" + opts="--products --force --properties --with_fathers --with_children --clean_all --clean_make --install_flags --show --stop_first_fail --check --clean_build_after" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/doc/src/commands/compile.rst b/doc/src/commands/compile.rst index 55c77f9..b646fe0 100644 --- a/doc/src/commands/compile.rst +++ b/doc/src/commands/compile.rst @@ -31,6 +31,10 @@ Usage sat compile --products med --with_children +* Force the compilation of a module, even if it is already installed. This option clean the build before compiling: :: + + sat compile --products med --force + * Clean the build and install directories before starting compilation: :: sat compile --products GEOM --clean_all -- 2.39.2