# substitute some character with _ in order to get the correct definition
# in config.PRODUCTS. This is done because the pyconf tool does not handle
# the . and - characters
- for c in ".-": vv = vv.replace(c, "_")
+ for c in ".-/": vv = vv.replace(c, "_")
prod_info = None
if product_name in config.PRODUCTS:
# message to the user in case of non existing path.)
prod_info.install_dir = version
prod_info.get_source = "fixed"
+ prod_info.install_mode = "fixed"
# Check if the product is defined as native in the application
if prod_info is not None:
prod_info.install_dir = prod_info.install_dir_save
# Set the install_dir key
- prod_info.install_dir = get_install_dir(config, version, prod_info)
+ prod_info.install_dir,prod_info.install_mode = get_install_dir(config, version, prod_info)
return prod_info
:param product_info Config: The configuration specific to
the product
- :return: The path of the product installation
- :rtype: str
+ :return: The path of the product installation and the mode of the install directory (base/implicit/fixed/value)
+ :rtype: str,str
"""
install_dir = ""
in_base = False
+
# prod_info.base : corresponds to what is specified in application pyconf (either from the global key base, or from a product dict)
# prod_info.install_dir : corresponds to what is specified in product pyconf (usually "base" for prerequisites)
if ( ("install_dir" in prod_info and prod_info.install_dir == "base") # product is declared as base in its own config
if in_base:
install_dir = get_base_install_dir(config, prod_info, version)
+ install_mode = "base"
else:
- if "install_dir" not in prod_info or prod_info.install_dir == "base":
+ if ("install_mode" in prod_info and prod_info.install_mode in ["implicit", "base"]) or\
+ ("install_dir" not in prod_info or prod_info.install_dir == "base"):
+ # the check to "base" comes from the package case were base mode is changed dynamically
+ # to create a package launcher.
+
# Set it to the default value (in application directory)
+ install_mode = "implicit"
if ( src.appli_test_property(config,"single_install_dir", "yes") and
src.product.product_test_property(prod_info,"single_install_dir", "yes")):
# when single_install_dir mode is activated in tha application
prod_info.name)
else:
install_dir = prod_info.install_dir
+ install_mode = "value"
- return install_dir
+ return install_dir,install_mode
def get_base_install_dir(config, prod_info, version):
"""Compute the installation directory of a product in base
return res
-def get_product_dependencies(config, product_info):
+def get_product_dependencies(config, product_name, product_info):
"""\
- Get recursively the list of products that are
+ Get the list of products that are
in the product_info dependencies
:param config Config: The global configuration
:return: the list of products in dependence
:rtype: list
"""
- depend_all=[]
- if "depend" in product_info:
- for d in product_info.depend:
- depend_all.append(d)
- if "build_depend" in product_info:
- for d in product_info.build_depend:
- depend_all.append(d)
-
- if len(depend_all) == 0:
- return []
-
- res = []
- for prod in depend_all:
- if prod == product_info.name:
- continue
- if prod not in res:
- res.append(prod)
- prod_info = get_product_config(config, prod)
- dep_prod = get_product_dependencies(config, prod_info)
- for prod_in_dep in dep_prod:
- if prod_in_dep not in res:
- res.append(prod_in_dep)
- return res
+ from compile import get_dependencies_graph, depth_search_graph
+ all_products_infos = get_products_infos(
+ config.APPLICATION.products,
+ config)
+ all_products_graph=get_dependencies_graph(all_products_infos)
+ res=[]
+ res=depth_search_graph(all_products_graph, product_name, res)
+ return res[1:] # remove the product himself (in first position)
def check_installation(config, product_info):
"""\
if product_is_native(product_info):
# check a system product
check_cmd=src.system.get_pkg_check_cmd(config.VARS.dist_name)
- run_pkg,build_pkg=src.product.check_system_dep(check_cmd, product_info)
+ run_pkg,build_pkg=src.product.check_system_dep(config.VARS.dist, check_cmd, product_info)
build_dep_ko=[]
for pkg in build_pkg:
if "KO" in build_pkg[pkg]:
return True
install_dir = product_info.install_dir
- filename = CONFIG_FILENAME + product_info.name + ".pyconf"
- if not os.path.exists(os.path.join(install_dir, filename)):
- return False
+ if src.product.product_is_fixed(product_info):
+ # we check directly the install dir only for fixed products
+ # (there is no pyconf file in that case)
+ if not os.path.exists(install_dir):
+ return False
+ else:
+ filename = CONFIG_FILENAME + product_info.name + ".pyconf"
+ if not os.path.exists(os.path.join(install_dir, filename)):
+ return False
# check extra files if specified in present_files.install section
if ("present_files" in product_info and
result = eval(eval_expression)
return result
-def check_system_dep(check_cmd, product_info):
+def check_system_dep(distrib, check_cmd, product_info):
"""Search for system dependencies, check if installed
+ :param dist : The linux ditribution (CO7,DB10...)
:param check_cmd Config: The command to use for checking (rpm/apt)
:param product_info Config: The configuration specific to the product
:rtype: two dictionnaries for runtime and compile time dependencies with text status
"""
runtime_dep={}
build_dep={}
+
if "system_info" in product_info:
+
+ sysinfo=product_info.system_info
+ additional_sysinfo = None
+
+ for key in sysinfo :
+ if distrib in key :
+ additional_sysinfo = sysinfo[key]
+
if check_cmd[0]=="rpm":
- if "rpm" in product_info.system_info:
- for pkg in product_info.system_info.rpm:
+ if "rpm" in sysinfo:
+ for pkg in sysinfo.rpm:
runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
- if "rpm_dev" in product_info.system_info:
- for pkg in product_info.system_info.rpm_dev:
+ if "rpm_dev" in sysinfo:
+ for pkg in sysinfo.rpm_dev:
build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ if additional_sysinfo :
+ if "rpm" in additional_sysinfo:
+ for pkg in additional_sysinfo.rpm:
+ runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ if "rpm_dev" in additional_sysinfo:
+ for pkg in additional_sysinfo.rpm_dev:
+ build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
if check_cmd[0]=="apt":
- if "apt" in product_info.system_info:
- for pkg in product_info.system_info.apt:
+ if "apt" in sysinfo:
+ for pkg in sysinfo.apt:
runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
- if "apt_dev" in product_info.system_info:
- for pkg in product_info.system_info.apt_dev:
+ if "apt_dev" in sysinfo:
+ for pkg in sysinfo.apt_dev:
build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ if additional_sysinfo :
+ if "apt" in additional_sysinfo:
+ for pkg in additional_sysinfo.apt:
+ runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ if "apt_dev" in additional_sysinfo:
+ for pkg in additional_sysinfo.apt_dev:
+ build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+
return runtime_dep,build_dep