Salome HOME
spns #40779: implement some minor fixes spns/40779 17/head
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Fri, 10 May 2024 07:00:49 +0000 (09:00 +0200)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Fri, 10 May 2024 07:00:49 +0000 (09:00 +0200)
commands/compile.py
commands/package.py
commands/prepare.py
src/__init__.py
src/environment.py
src/product.py

index 0c5fd5e8c3b09b4f3aad91592648ebd8f0d16dcb..4648742d93e7221dd968861037231435e8c53d2b 100644 (file)
@@ -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
index 52f8c96a9b7738ca0034bc13984e118b5e1c47e4..b7f5b41b62b25d0ede6f1522ea1c3b1e6812da36 100644 (file)
@@ -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
index 061c5e8b39c0b009435a292c9b0fdd1df6b79db5..5b65d5d6b6f611a22403addaf2c89dfd91a2f36a 100644 (file)
@@ -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()
index a935525da5d320e18ecffdfded487616987e5dee..651606e51ffb7f54ea51f1492b60680d73113fb4 100644 (file)
@@ -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
index 33623c2e29b7984e39e096c00b3a46b67d7fad72..16bc00518a2ec264c72208c367f8ea746b17977d 100644 (file)
@@ -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
 
index 75e10d4faaf6f49c35c96758316d16f0e5bfd245..2971036dac1b21431ce99c5e56a553e7d3a51a4b 100644 (file)
@@ -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