Improve external library management error handling
authorCaiwen Zhang <caiwen.zhang@intel.com>
Thu, 12 Feb 2015 02:31:49 +0000 (10:31 +0800)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Thu, 12 Feb 2015 18:56:27 +0000 (18:56 +0000)
Change-Id: I2a0b7003f0bd2987fa101285977fa0621688017b
Signed-off-by: Caiwen Zhang<caiwen.zhang@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/327
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
build_common/tools/UnpackAll.py

index 4e24c58..0df17e4 100644 (file)
@@ -161,8 +161,15 @@ def __message( s, target, source, env ) :
 # @param source extracted files
 # @param env environment object
 def __action( target, source, env ) :
+    cwd = os.path.realpath('.')
     extractor = __getExtractor([File(source)], env)
     if not extractor :
+        print '''******************************* Error *****************************************
+*
+* Doesn't support auto extracting [%s], please extract it to [%s].
+*                                                                             *
+*******************************************************************************
+''' % (source, cwd)
         raise SCons.Errors.StopError( "can not find any extractor value for the source file [%s]" % (source) )
 
     extractor_cmd = extractor["EXTRACTCMD"]
@@ -175,7 +182,6 @@ def __action( target, source, env ) :
     handle = None
 
     cmd = env.subst(extractor_cmd, source=source, target=target)
-    cwd = os.path.realpath('.')
 
     if env["UNPACK"]["VIWEXTRACTOUTPUT"] :
         handle  = subprocess.Popen( cmd, shell=True )
@@ -186,12 +192,12 @@ def __action( target, source, env ) :
     if handle.wait() <> 0 :
         print '''******************************* Error *****************************************
 *
-* Fail to unpack (%s). It should be due to it isn't downloaded completely.
-* Please download it manually or delete it and let the script auto
-* download again.
-*
+* Fail to unpack [%s]. It should be due to it isn't downloaded completely.
+* Please download it manually or delete it and let the script auto download it*
+* again.                                                                      *
+*                                                                             *
 *******************************************************************************
-'''
+''' % (source)
         raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source) )
 
 # emitter function for getting the files