From: Nabil Ghodbane Date: Mon, 18 Mar 2024 15:00:16 +0000 (+0100) Subject: support github X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d461e10d13aead7ddffb03b283b541e1b8ad27ba;p=tools%2Fsat.git support github --- diff --git a/commands/compile.py b/commands/compile.py index 0368549..afdad9b 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -168,6 +168,8 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict if src.product.product_is_salome(p_info): check_salome_configuration=True + if config.APPLICATION.properties.github == 'yes' and src.product.product_test_property(p_info,"is_opensource", "no"): + continue # nothing to clean for native or fixed products if (not src.product.product_compiles(p_info)) or\ src.product.product_is_native(p_info) or\ @@ -275,6 +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 config.APPLICATION.properties.github == 'yes' and src.product.product_test_property(p_info,"is_opensource", "no"): + log_step(logger, header, "ignored") + logger.write("\n", 3, False) + continue # Do nothing if the product is native if src.product.product_is_native(p_info): @@ -303,7 +309,6 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict logger.write(_("Sources of product not found (try 'sat -h prepare') \n")) res += 1 # one more error continue - # 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): @@ -311,12 +316,12 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict logger.write(_(" in %s" % p_info.install_dir), 4) logger.write(_("\n")) continue - + # If the show option was called, do not launch the compilation if options.no_compile: logger.write(_("Not installed in %s\n" % p_info.install_dir)) continue - + # Check if the dependencies are installed l_depends_not_installed = check_dependencies(config, p_name_info, all_products_dict) if len(l_depends_not_installed) > 0: @@ -327,7 +332,7 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict logger.write(src.printcolors.printcError(prod_name + " ")) logger.write("\n") continue - + # Call the function to compile the product res_prod, len_end_line, error_step = compile_product( sat, p_name_info, config, options, logger, header, len_end_line) @@ -744,7 +749,7 @@ def run(args, runner, logger): 'directories of the products of ' 'the application %s\n') % src.printcolors.printcLabel(runner.cfg.VARS.application), 1) - + info = [ (_("SOURCE directory"), os.path.join(runner.cfg.APPLICATION.workdir, 'SOURCES')), diff --git a/commands/package.py b/commands/package.py index f91476e..7ae351d 100644 --- a/commands/package.py +++ b/commands/package.py @@ -685,6 +685,10 @@ def binary_package(config, logger, options, tmp_working_dir): if src.get_property_in_product_cfg(prod_info, "not_in_package") == "yes": continue + # skip product if github and product is not opensource + if config.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(prod_info, "is_opensource") == "no": + continue + # Add the sources of the products that have the property # sources_in_package : "yes" if src.get_property_in_product_cfg(prod_info, @@ -992,6 +996,11 @@ def get_archives(config, logger): if (src.product.product_is_native(p_info) or src.product.product_is_fixed(p_info)): continue + + # skip product if github and product is not opensource + if config.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(prod_info, "is_opensource") == "no": + continue + if p_info.get_source == "archive": archive_path = p_info.archive_info.archive_name archive_name = os.path.basename(archive_path) diff --git a/commands/prepare.py b/commands/prepare.py index 71a44a8..d147699 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -36,7 +36,6 @@ parser.add_option('c', 'complete', 'boolean', 'complete', _("Optional: completion mode, only prepare products not present in SOURCES dir."), False) - def find_products_already_prepared(l_products): '''function that returns the list of products that have an existing source directory. @@ -92,13 +91,15 @@ def run(args, runner, logger): src.check_platform_is_supported( runner.cfg, logger ) products_infos = src.product.get_products_list(options, runner.cfg, logger) - # Construct the arguments to pass to the clean, source and patch commands args_appli = runner.cfg.VARS.application + " " # useful whitespace if options.products: listProd = list(options.products) else: # no product interpeted as all products listProd = [name for name, tmp in products_infos] + if runner.cfg.APPLICATION.properties.github == 'yes': + 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]] if options.complete: # remove products that are already prepared 'completion mode) @@ -156,7 +157,6 @@ Use the --force_patch option to overwrite it. args_clean = args_appli + args_product_opt_clean + " --sources" args_source = args_appli + args_product_opt args_patch = args_appli + args_product_opt_patch - # Initialize the results to a running status res_clean = 0 res_source = 0 diff --git a/commands/source.py b/commands/source.py index 832e484..9ed87ed 100644 --- a/commands/source.py +++ b/commands/source.py @@ -86,11 +86,12 @@ def get_source_from_git(config, # The str to display coflag = 'git' - use_repo_dev=False + use_repo_dev = "APPLICATION" in config and "properties" in config.APPLICATION and "github" in config.APPLICATION.properties and not config.APPLICATION.properties.github == "yes" if ("APPLICATION" in config and "properties" in config.APPLICATION and "repo_dev" in config.APPLICATION.properties and - config.APPLICATION.properties.repo_dev == "yes") : + config.APPLICATION.properties.repo_dev == "yes" and + use_repo_dev == True ) : use_repo_dev=True # Get the repository address. diff --git a/src/environment.py b/src/environment.py index a706d5d..b928f93 100644 --- a/src/environment.py +++ b/src/environment.py @@ -604,6 +604,10 @@ class SalomeEnviron: # src.appli_test_property(self.cfg,"pip_install_dir", "python") ): # return + # skip product if github and product is not opensource + if self.cfg.APPLICATION.properties.github == "yes" and src.get_property_in_product_cfg(pi, "is_opensource") == "no": + return + # skip mesa products (if any) at run time, # unless use_mesa property was activated if not self.forBuild: diff --git a/src/product.py b/src/product.py index a679e44..8bce492 100644 --- a/src/product.py +++ b/src/product.py @@ -1097,6 +1097,18 @@ def product_is_cpp(product_info): "cpp" in product_info.properties and product_info.properties.cpp == "yes") +def product_is_not_opensource(product_info): + """Check if a given product is not open + + :param product_info Config: The configuration specific to + the product + :return: True if the product is an opensource, False otherwise + :rtype: boolean + """ + return ("properties" in product_info and + "is_opensource" in product_info.properties and + product_info.properties.is_opensource == "no") + def product_compiles(product_info): """\ Know if a product compiles or not