]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
add warning message after the check
authorcrouzet <nicolas.crouzet@cea.fr>
Wed, 5 Feb 2020 10:01:15 +0000 (11:01 +0100)
committercrouzet <nicolas.crouzet@cea.fr>
Wed, 5 Feb 2020 10:01:15 +0000 (11:01 +0100)
commands/config.py
src/product.py
src/system.py

index 4b2be310e53136ff2e6a094cb634c6d662b9d162..744cb5aa292fc336846c2e8cbc5abb8239213597 100644 (file)
@@ -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.
index 2d829dc29f046e9c0e3c1c859d3a7ca7d1147710..d38241a3f8f19cc83eef8e6a89b9fdc0f6923d22 100644 (file)
@@ -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
 
 
index 8836383ab4e67dd2da2c33586e657bc2ed6b2a81..eeb2a9ab9ccf617d61a1ddbbaa5fb6f06545fe5b 100644 (file)
@@ -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