- '''Prints all the used patchs in the application.
-
- :param config Config: the global configuration.
- :param logger Logger: The logger instance to use for the display
- '''
- len_max = max([len(p) for p in config.APPLICATION.products]) + 2
- for product in config.APPLICATION.products:
- product_info = src.product.get_product_config(config, product)
- if src.product.product_has_patches(product_info):
- logger.write("%s: " % product, 1)
- logger.write(src.printcolors.printcInfo(
- " " * (len_max - len(product) -2) +
- "%s\n" % product_info.patches[0]),
- 1)
- if len(product_info.patches) > 1:
- for patch in product_info.patches[1:]:
- logger.write(src.printcolors.printcInfo(len_max*" " +
- "%s\n" % patch), 1)
- logger.write("\n", 1)
+ '''Prints all the used patchs in the application.
+
+ :param config Config: the global configuration.
+ :param logger Logger: The logger instance to use for the display
+ '''
+ oneOrMore = False
+ for product in sorted(config.APPLICATION.products):
+ try:
+ product_info = src.product.get_product_config(config, product)
+ if src.product.product_has_patches(product_info):
+ oneOrMore = True
+ logger.write("%s:\n" % product, 1)
+ for i in product_info.patches:
+ logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
+ except Exception as e:
+ msg = "problem on product %s\n%s\n" % (product, str(e))
+ logger.error(msg)
+
+ if oneOrMore:
+ logger.write("\n", 1)
+ else:
+ logger.write("No patchs found\n", 1)
+
+def check_install_system(config, logger):
+ '''Check the installation of all (declared) system products
+
+ :param config Config: the global configuration.
+ :param logger Logger: The logger instance to use for the display
+ '''
+ # get the command to use for checking the system dependencies
+ # (either rmp or apt)
+ check_cmd=src.system.get_pkg_check_cmd()
+ logger.write("\nCheck the system dependencies declared in the application\n",1)
+ pkgmgr=check_cmd[0]
+ for product in sorted(config.APPLICATION.products):
+ try:
+ product_info = src.product.get_product_config(config, product)
+ if src.product.product_is_native(product_info):
+ # if the product is native, get (in two dictionnaries the runtime and compile time
+ # system dependencies with the status (OK/KO)
+ run_pkg,build_pkg=src.product.check_system_dep(check_cmd, product_info)
+ #logger.write("\n*** %s ***\n" % product, 1)
+ for pkg in run_pkg:
+ logger.write(run_pkg[pkg], 1)
+ for pkg in build_pkg:
+ logger.write(build_pkg[pkg], 1)
+ # logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
+
+ except Exception as e:
+ msg = "problem with the check of system prerequisite %s\n%s\n" % (product, str(e))
+ logger.error(msg)
+
+
+def show_install_dir(config, logger):
+ '''Prints all the used installed directories in the application.
+
+ :param config Config: the global configuration.
+ :param logger Logger: The logger instance to use for the display
+ '''
+ for product in sorted(config.APPLICATION.products):
+ try:
+ product_info = src.product.get_product_config(config, product)
+ install_path=src.Path(product_info.install_dir)
+ if (src.product.product_is_native(product_info)):
+ install_path="Native"
+ elif (src.product.product_is_fixed(product_info)):
+ install_path+=" (Fixed)"
+ logger.write("%s : %s\n" % (product, install_path) , 1)
+ except Exception as e:
+ msg = "problem on product %s\n%s\n" % (product, str(e))
+ logger.error(msg)
+ logger.write("\n", 1)
+
+
+def show_properties(config, logger):
+ '''Prints all the used properties in the application.
+
+ :param config Config: the global configuration.
+ :param logger Logger: The logger instance to use for the display
+ '''
+ if "properties" in config.APPLICATION:
+ # some properties are defined at application level, we display them
+ logger.write("Application properties:\n", 1)
+ for prop in config.APPLICATION.properties:
+ logger.write(src.printcolors.printcInfo(" %s : %s\n" % (prop, config.APPLICATION.properties[prop])), 1)
+ oneOrMore = False
+ for product in sorted(config.APPLICATION.products):
+ try:
+ product_info = src.product.get_product_config(config, product)
+ done = False
+ try:
+ for prop in product_info.properties:
+ if not done:
+ logger.write("%s:\n" % product, 1)
+ done = True
+ oneOrMore = True
+ logger.write(src.printcolors.printcInfo(" %s : %s\n" % (prop, product_info.properties[prop])), 1)
+ except Exception as e:
+ pass
+ except Exception as e:
+ # logger.write(src.printcolors.printcInfo(" %s\n" % "no properties"), 1)
+ msg = "problem on product %s\n%s\n" % (product, e)
+ logger.error(msg)
+
+ if oneOrMore:
+ logger.write("\n", 1)
+ else:
+ logger.write("No properties found\n", 1)