+def product_is_compile_time(product_info):
+ """Know if a product is only used at compile time
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product is only used at compile time
+ :rtype: boolean
+ """
+ return ("properties" in product_info and
+ "compile_time" in product_info.properties and
+ product_info.properties.compile_time == "yes")
+
+def product_is_compile_and_runtime(product_info):
+ """Know if a product is only used at compile time
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product is only used at compile time
+ :rtype: boolean
+ """
+ return ("properties" in product_info and
+ "compile_and_runtime" in product_info.properties and
+ product_info.properties.compile_and_runtime == "yes")
+
+
+
+def product_test_property(product_info, property_name, property_value):
+ """Generic function to test if a product has a property set to a value
+
+ :param product_info Config: The configuration specific to
+ the product
+ :param property_name : The name of the property to check
+ :param property_value : The value of the property to test
+ :return: True if the product has the property and the property is set to property_value
+ :rtype: boolean
+ """
+ # first check if product has the property
+ if not ("properties" in product_info and
+ property_name in product_info.properties):
+ return False
+
+ # then check to the property is set to property_value
+ eval_expression = 'product_info.properties.%s == "%s"' % (property_name,property_value)
+ result = eval(eval_expression)
+ return result
+
+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 sysinfo:
+ for pkg in sysinfo.rpm:
+ runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ 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 sysinfo:
+ for pkg in sysinfo.apt:
+ runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg)
+ 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
+
+