# 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
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
# 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:
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
# 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
- 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 = """\
+ 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))
+ 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):
"""\
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