X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fproduct.py;h=7ce6866b9b22172908a7c585b8a3ff4bed32c4fc;hb=fe93dec3df59f9238c50e52cce21d939fa4ccc1c;hp=f1fa34be852d349016ef7dd4e63a907164fe7433;hpb=e06d9a603359f19e1d1ac5af37a6579b49691f75;p=tools%2Fsat.git diff --git a/src/product.py b/src/product.py index f1fa34b..7ce6866 100644 --- a/src/product.py +++ b/src/product.py @@ -49,9 +49,6 @@ def get_product_config(config, product_name, with_install_dir=True): # Get the version of the product from the application definition version = config.APPLICATION.products[product_name] - # if no version, then take the default one defined in the application - if isinstance(version, bool): - version = config.APPLICATION.tag # Define debug and dev modes # Get the tag if a dictionary is given in APPLICATION.products for the @@ -61,6 +58,18 @@ def get_product_config(config, product_name, with_install_dir=True): verbose = 'no' base = 'maybe' section = None + + # if no version, then take the default one defined in the application + if isinstance(version, bool): + # in this case tag is mandatory, not debug, verbose, dev + version = config.APPLICATION.tag + if 'debug' in config.APPLICATION: + debug = config.APPLICATION.debug + if 'verbose' in config.APPLICATION: + verbose = config.APPLICATION.verbose + if 'dev' in config.APPLICATION: + dev = config.APPLICATION.dev + if isinstance(version, src.pyconf.Mapping): dic_version = version # Get the version/tag @@ -72,14 +81,20 @@ def get_product_config(config, product_name, with_install_dir=True): # Get the debug if any if 'debug' in dic_version: debug = dic_version.debug + elif 'debug' in config.APPLICATION: + debug = config.APPLICATION.debug # Get the verbose if any if 'verbose' in dic_version: verbose = dic_version.verbose + elif 'verbose' in config.APPLICATION: + verbose = config.APPLICATION.verbose # Get the dev if any if 'dev' in dic_version: dev = dic_version.dev + elif 'dev' in config.APPLICATION: + dev = config.APPLICATION.dev # Get the base if any if 'base' in dic_version: @@ -182,33 +197,23 @@ Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path} prod_info.addMapping("archive_info", src.pyconf.Mapping(prod_info), "") - if "archive_name" not in prod_info.archive_info: + if "archive_name" in prod_info.archive_info: + arch_name = prod_info.archive_info.archive_name + else: + # standard name arch_name = product_name + "-" + version + ".tar.gz" - arch_path = src.find_file_in_lpath(arch_name, - config.PATHS.ARCHIVEPATH) - if not arch_path: - msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ - {"1" : arch_name, "2" : prod_info.name} - DBG.tofix(msg, config.PATHS.ARCHIVEPATH) - prod_info.archive_info.archive_name = arch_name #without path - # raise src.SatException(msg) #may be a warning, continue #8646 - else: - prod_info.archive_info.archive_name = arch_path + + arch_path = src.find_file_in_lpath(arch_name, + config.PATHS.ARCHIVEPATH) + if not arch_path: + # arch_path is not found. It may generate an error in sat source, + # unless the archive is found in ftp serveur + msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ + {"1" : arch_name, "2" : prod_info.name} + DBG.tofix(msg, config.PATHS.ARCHIVEPATH) + prod_info.archive_info.archive_name = arch_name #without path else: - if (os.path.basename(prod_info.archive_info.archive_name) == - prod_info.archive_info.archive_name): - arch_name = prod_info.archive_info.archive_name - arch_path = src.find_file_in_lpath( - arch_name, - config.PATHS.ARCHIVEPATH) - if not arch_path: - msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \ - {"1" : arch_name, "2" : prod_info.name} - DBG.tofix(msg, config.PATHS.ARCHIVEPATH) #avoid 2 messages in compile - prod_info.archive_info.archive_name = arch_name #without path - # raise src.SatException(msg) #may be a warning, continue #8646 - else: - prod_info.archive_info.archive_name = arch_path + prod_info.archive_info.archive_name = arch_path # If the product compiles with a script, check the script existence @@ -480,12 +485,23 @@ def add_compile_config_file(p_info, config): with open(aFile, 'w') as f: res.__save__(f) - # this file is for human eye reading + # this file is not mandatory, is for human eye reading aFile = os.path.join(p_info.install_dir, PRODUCT_FILENAME) - with open(aFile, 'w') as f: - # f.write(DBG.getStrConfigDbg(p_info)) # debug mode - p_info.__save__(f, evaluated=True) # evaluated expressions mode - + try: + with open(aFile, 'w') as f: + p_info.__save__(f, evaluated=True) # evaluated expressions mode + except: + DBG.write("cannot evaluate product info - problem in file %s" % aFile, p_info, True) + # write DBG mode, as no problem if evaluation not possible + msg = """\ +# Some informations cannot be evaluated. +# for example: +# In the context of non VCS archives, information on git server is not available. + +""" + with open(aFile, 'w') as f: + f.write(msg) + f.write(DBG.getStrConfigDbg(p_info)) def check_config_exists(config, prod_dir, prod_info, verbose=False): """\ @@ -654,27 +670,6 @@ def get_products_list(options, cfg, logger): else: res = resAll # not existing properties as all accepted - - ok = [] - ko = [] - products_infos = [] - for p_name, p_info in res: - try: - if src.product.product_is_native(p_info) or src.product.product_is_fixed(p_info): - ko.append(p_name) - else: - products_infos.append((p_name, p_info)) - ok.append(p_name) - except: - msg = "problem on 'is_native' or 'is_fixed' for product %s" % p_name - raise Exception(msg) - - if len(ko) > 0: - logger.warning("on is_native or is_fixed\n products accepted:\n %s\n products rejected:\n %s\n" % - (PP.pformat(sorted(ok)), PP.pformat(sorted(ko)))) - - logger.debug("products selected:\n %s\n" % PP.pformat(sorted(ok))) - return res