+def add_compile_config_file(p_info, config):
+ '''Execute the proper configuration command(s)
+ in the product build directory.
+
+ :param p_info Config: The specific config of the product
+ :param config Config: The global configuration
+ '''
+ # Create the compile config
+ # DBG.write("add_compile_config_file", p_info, True)
+ res = src.pyconf.Config()
+ res.addMapping(p_info.name, src.pyconf.Mapping(res), "")
+ res[p_info.name]= p_info.version
+
+ for prod_name in p_info.depend:
+ if prod_name not in res:
+ res.addMapping(prod_name, src.pyconf.Mapping(res), "")
+ prod_dep_info = src.product.get_product_config(config, prod_name, False)
+ res[prod_name] = prod_dep_info.version
+ # Write it in the install directory of the product
+ # This file is for automatic reading/checking
+ # see check_config_exists method
+ afilename = CONFIG_FILENAME + p_info.name + ".pyconf"
+ aFile = os.path.join(p_info.install_dir, afilename)
+ with open(aFile, 'w') as f:
+ res.__save__(f)
+
+ # this file is not mandatory, is for human eye reading
+ afilename = PRODUCT_FILENAME + p_info.name + ".pyconf"
+ aFile = os.path.join(p_info.install_dir, afilename)
+ try:
+ with open(aFile, 'w') as f:
+ p_info.__save__(f, evaluated=True) # evaluated expressions mode
+ except:
+ # sometime some information cannot be evaluated.
+ # for example, in the context of non VCS archives, information on git server is not available.
+ DBG.write("Warning : sat was not able to evaluate and write down some information in file %s" % aFile)
+
+
+def check_config_exists(config, prod_dir, prod_info, verbose=False):
+ """\
+ Verify that the installation directory of a product in a base exists.
+ Check all the config-<i>/sat-config.py files found for correspondence
+ with current config and prod_info depend-version-tags