From 74f67eb6e3c7aa14ae5cbc47d412a0b6fe9bbf44 Mon Sep 17 00:00:00 2001 From: crouzet Date: Wed, 31 Aug 2022 17:06:22 +0200 Subject: [PATCH] improve env setting for configuration module - add git tag description in product info --- commands/compile.py | 8 +++++--- src/environment.py | 18 ++++++++++++++++-- src/product.py | 12 ++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/commands/compile.py b/commands/compile.py index 252206d..043706b 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -245,9 +245,7 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict # for configuration modules, check if sources are present for prod in all_products_dict: product_name, product_info = all_products_dict[prod] - if ("properties" in product_info and - "configure_dependency" in product_info.properties and - product_info.properties.configure_dependency == "yes"): + if src.product.product_is_configuration(product_info): check_source = check_source and src.product.check_source(product_info) if not check_source: logger.write(_("\nERROR : SOURCES of %s not found! It is required for" @@ -464,6 +462,10 @@ def compile_product(sat, p_name_info, config, options, logger, header, len_end): # product that have been successfully compiled if res==0: logger.write(_("Add the config file in installation directory\n"), 5) + # for git bases : add the description of git tag + src_sha1=src.system.git_describe(p_info.source_dir) + if src_sha1: + p_info.git_tag_description=src_sha1 src.product.add_compile_config_file(p_info, config) if options.check: diff --git a/src/environment.py b/src/environment.py index 2deb565..a706d5d 100644 --- a/src/environment.py +++ b/src/environment.py @@ -411,10 +411,20 @@ class SalomeEnviron: :param product_info Config: The product description :param logger Logger: The logger instance to display messages """ - # set root dir DBG.write("set_salome_minimal_product_env", product_info) + + # set root dir root_dir = product_info.name + "_ROOT_DIR" - if 'install_dir' in product_info and product_info.install_dir: + + if src.product.product_is_configuration(product_info): + # configuration modules are not installed, root_dir points at source dir + if not self.for_package: + self.set(root_dir, product_info.source_dir) + else: + self.set(root_dir, os.path.join("out_dir_Path", + "SOURCES", + os.path.basename(product_info.source_dir))) + elif 'install_dir' in product_info and product_info.install_dir: self.set(root_dir, product_info.install_dir) elif not self.silent: logger.write(" " + _("No install_dir for product %s\n") % @@ -447,6 +457,10 @@ class SalomeEnviron: :param pi Config: The product description """ + if src.product.product_is_configuration(pi): + # configuration modules are not installed and should not be set like others + return + # Construct XXX_ROOT_DIR env_root_dir = self.get(pi.name + "_ROOT_DIR") l_binpath_libpath = [] diff --git a/src/product.py b/src/product.py index 0413d21..3b385b1 100644 --- a/src/product.py +++ b/src/product.py @@ -935,6 +935,18 @@ def product_is_salome(product_info): "is_SALOME_module" in product_info.properties and product_info.properties.is_SALOME_module == "yes") +def product_is_configuration(product_info): + """Know if a product is a configuration module + + :param product_info Config: The configuration specific to + the product + :return: True if the product is a configuration module, else False + :rtype: boolean + """ + return ("properties" in product_info and + "configure_dependency" in product_info.properties and + product_info.properties.configure_dependency == "yes") + def product_is_fixed(product_info): """Know if a product is fixed -- 2.39.2