From ff68dd8aa348d5ed25add94242947a9933dc2918 Mon Sep 17 00:00:00 2001 From: crouzet Date: Wed, 5 Feb 2020 11:01:15 +0100 Subject: [PATCH] add warning message after the check --- commands/config.py | 34 ++++++++++++++++++++++++++++++---- src/product.py | 6 ------ src/system.py | 9 ++++----- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/commands/config.py b/commands/config.py index 4b2be31..744cb5a 100644 --- a/commands/config.py +++ b/commands/config.py @@ -797,6 +797,8 @@ def check_install_system(config, logger): check_cmd=src.system.get_pkg_check_cmd() logger.write("\nCheck the system dependencies declared in the application\n",1) pkgmgr=check_cmd[0] + run_dep_ko=[] # list of missing run time dependencies + build_dep_ko=[] # list of missing compile time dependencies for product in sorted(config.APPLICATION.products): try: product_info = src.product.get_product_config(config, product) @@ -806,15 +808,39 @@ def check_install_system(config, logger): 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) + logger.write("\n - "+pkg + " : " + run_pkg[pkg], 1) + if "KO" in run_pkg[pkg]: + run_dep_ko.append(pkg) for pkg in build_pkg: - logger.write(build_pkg[pkg], 1) + logger.write("\n - "+pkg + " : " + build_pkg[pkg], 1) + if "KO" in build_pkg[pkg]: + build_dep_ko.append(pkg) # 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)) + msg = "\nproblem with the check of system prerequisite %s\n%s\n" % (product, str(e)) logger.error(msg) - + raise Exception(msg) + + logger.write("\n\n",1) + if run_dep_ko: + msg="Some run time system dependencies are missing!\n"+\ + "Please install them with %s before running salome" % pkgmgr + logger.warning(msg) + logger.write("missing run time dependencies : ",1) + for md in run_dep_ko: + logger.write(md+" ",1) + logger.write("\n\n") + + if build_dep_ko: + msg="Some compile time system dependencies are missing!\n"+\ + "Please install them with %s before compiling salome" % pkgmgr + logger.warning(msg) + logger.write("missing compile time dependencies : ",1) + for md in build_dep_ko: + logger.write(md+" ",1) + logger.write("\n\n") + def show_install_dir(config, logger): '''Prints all the used installed directories in the application. diff --git a/src/product.py b/src/product.py index 2d829dc..d38241a 100644 --- a/src/product.py +++ b/src/product.py @@ -1195,12 +1195,6 @@ def check_system_dep(check_cmd, product_info): if "apt_dev" in product_info.system_info: for pkg in product_info.system_info.apt_dev: build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg) - #for pkg in runtime_dep: - # print "CNC check for ", pkg - # runtime_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg) - #for pkg in build_dep: - # build_dep[pkg]=src.system.check_system_pkg(check_cmd,pkg) - #print "CNC runtime_dep=", runtime_dep return runtime_dep,build_dep diff --git a/src/system.py b/src/system.py index 8836383..eeb2a9a 100644 --- a/src/system.py +++ b/src/system.py @@ -370,13 +370,12 @@ def check_system_pkg(check_cmd,pkg): output, err = p.communicate() rc = p.returncode if rc==0: - check_res=src.printcolors.printcSuccess("OK") + msg_status=src.printcolors.printcSuccess("OK") if check_cmd[0]=="rpm": # apt output is too messy for being used - check_res+=" (" + output.replace('\n',' ') + ")\n" # remove output trailing \n + msg_status+=" (" + output.replace('\n',' ') + ")\n" # remove output trailing \n else: - check_res=src.printcolors.printcError("KO") - check_res+=" (package is not installed!)\n" + msg_status=src.printcolors.printcError("KO") + msg_status+=" (package is not installed!)\n" - msg_status="\n - "+pkg + " : " + check_res return msg_status -- 2.39.2