From: Nabil Ghodbane Date: Fri, 10 May 2024 07:00:49 +0000 (+0200) Subject: spns #40779: implement some minor fixes X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fspns%2F40779;p=tools%2Fsat.git spns #40779: implement some minor fixes --- diff --git a/commands/compile.py b/commands/compile.py index 0c5fd5e..4648742 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -167,8 +167,8 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict p_name, p_info = p_name_info if src.product.product_is_salome(p_info): check_salome_configuration=True - - if src.product.product_test_property(p_info,"is_opensource", "no") and not src.check_git_server_has_non_opensource(config, config.APPLICATION.properties.git_server): + # if product is closed source and git server is public skip the current product + if src.product.product_is_not_opensource(p_info) and not src.git_server_has_all_repositories(config, config.APPLICATION.properties.git_server): continue # nothing to clean for native or fixed products if (not src.product.product_compiles(p_info)) or\ @@ -277,7 +277,10 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict log_step(logger, header, "ignored") logger.write("\n", 3, False) continue - if src.product.product_test_property(p_info,"is_opensource", "no") and not src.check_git_server_has_non_opensource(config, config.APPLICATION.properties.git_server): + + # skip product if git server does not host all git repositories + # product is not opensource and git server does not have all repositories (closed and open sources) + if src.product.product_is_not_opensource(p_info) and not src.git_server_has_all_repositories(config, config.APPLICATION.properties.git_server): log_step(logger, header, "ignored") logger.write("\n", 3, False) continue @@ -304,7 +307,7 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict is_pip= (src.appli_test_property(config,"pip", "yes") and src.product.product_test_property(p_info,"pip", "yes")) # don't check sources with option --show # or for products managed by pip (there sources are in wheels stored in LOCAL.ARCHIVE - if not (options.no_compile or is_pip): + if not (options.no_compile or is_pip): if not check_source: logger.write(_("Sources of product not found (try 'sat -h prepare') \n")) res += 1 # one more error diff --git a/commands/package.py b/commands/package.py index 52f8c96..b7f5b41 100644 --- a/commands/package.py +++ b/commands/package.py @@ -686,7 +686,7 @@ def binary_package(config, logger, options, tmp_working_dir): if src.get_property_in_product_cfg(prod_info, "not_in_package") == "yes": continue - if src.product.product_is_not_opensource(prod_info) and src.check_git_server_has_non_opensource( cfg, git_server): + if src.product.product_is_not_opensource(prod_info) and not src.git_server_has_all_repositories( cfg, git_server): continue # Add the sources of the products that have the property @@ -1000,8 +1000,7 @@ def get_archives(config, logger): # skip product if git server misses non opensource products is_not_prod_opensource = src.product.product_is_not_opensource(p_info) git_server = src.get_git_server(config,logger) - has_git_server_non_opensource = src.check_git_server_has_non_opensource( config, git_server) - if has_git_server_non_opensource and is_not_prod_opensource: + if src.product.product_is_not_opensource(p_info) and not src.git_server_has_all_repositories(config, git_server): logger.warning("%s is a closed-source software and is not available on %s" % (product, git_server)) logger.flush() continue diff --git a/commands/prepare.py b/commands/prepare.py index 061c5e8..5b65d5d 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -103,7 +103,8 @@ def run(args, runner, logger): git_server = src.get_git_server(runner.cfg,logger) - if src.check_git_server_has_non_opensource( runner.cfg, git_server): + # current git server hosts only opensource repositories - then remove products which are not hosted + if not src.git_server_has_all_repositories(runner.cfg, git_server): not_opensource_products = [p for p in products_infos if src.product.product_is_not_opensource(p[1])] listProd = [p for p in listProd if p not in [name for name, tmp in not_opensource_products]] logger.flush() diff --git a/src/__init__.py b/src/__init__.py index a935525..651606e 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -635,17 +635,16 @@ def activate_mesa_property(config): config.APPLICATION.addMapping( 'properties', pyconf.Mapping(), None ) config.APPLICATION.properties.use_mesa="yes" -def check_git_server_has_non_opensource( config, the_git_server): - """check that the git server contains non public repositories +def git_server_has_all_repositories( config, the_git_server): + """check that the git server contains all repositories (closed and open) :param config class 'common.pyconf.Config': The config. :param logger Logger: The logging instance to use for the prints. """ if 'opensource_git_servers' in config.VARS: for git_server in config.VARS['opensource_git_servers']: if git_server == the_git_server: - return True - return False - return + return False + return True def get_git_server(config, logger): the_git_server= None diff --git a/src/environment.py b/src/environment.py index 33623c2..16bc005 100644 --- a/src/environment.py +++ b/src/environment.py @@ -604,11 +604,9 @@ class SalomeEnviron: # src.appli_test_property(self.cfg,"pip_install_dir", "python") ): # return - # skip product if git server misses non opensource products - is_not_prod_opensource = src.product.product_is_not_opensource(pi) + # skip product if git server does not host all git repositories git_server= src.get_git_server(self.cfg, logger) - has_git_server_non_opensource = src.check_git_server_has_non_opensource( self.cfg, git_server) - if has_git_server_non_opensource and is_not_prod_opensource: + if src.product.product_is_not_opensource(pi) and not src.git_server_has_all_repositories( self.cfg, git_server): logger.warning("%s is a closed-source software and is not available on %s" % (pi.name, git_server)) return diff --git a/src/product.py b/src/product.py index 75e10d4..2971036 100644 --- a/src/product.py +++ b/src/product.py @@ -804,13 +804,11 @@ def get_products_list(options, cfg, logger): logger.error("%s does not have associated information" % (product)) continue if 'get_source' in prod_info and prod_info.get_source == 'git': - is_prod_opensource = not src.product.product_is_not_opensource(prod_info) git_server = src.get_git_server(cfg,logger) else: git_server = cfg.VARS['default_git_server_dev'] - has_git_server_non_opensource = src.check_git_server_has_non_opensource( cfg, git_server) - if has_git_server_non_opensource and not is_prod_opensource: + if src.product.product_is_not_opensource(prod_info) and not src.git_server_has_all_repositories(cfg, git_server): logger.warning("%s is a closed-source software and is not available on %s" % (product, git_server)) logger.flush() continue