build: define mbedtls_version before use
authorMats Wichmann <mats@linux.com>
Sun, 9 Jul 2017 13:50:58 +0000 (07:50 -0600)
committerPhil Coval <philippe.coval@osg.samsung.com>
Mon, 10 Jul 2017 14:27:26 +0000 (14:27 +0000)
A recent change tried to centralize the mbedtls version into one
setting, but the setting is currently done after it is used in
an error message.  Move the assignment up above first use.

Change-Id: I3887c3f036fb0d22c4f4f60436ff75306fd7eb73
Signed-off-by: Mats Wichmann <mats@linux.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21331
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
extlibs/mbedtls/SConscript

index cc50d91..9517042 100644 (file)
@@ -32,6 +32,9 @@ mbedtls_dir = os.path.join(root_dir, 'extlibs', 'mbedtls', 'mbedtls')
 start_dir = os.getcwd()
 mbedtls_config_file = 'config-iotivity.h' if target_os != 'windows' else 'config-iotivity_windows.h'
 
+# The mbedtls_revision tag here must match the one in extlibs/mbedtls/prep.sh.
+mbedtls_revision = 'mbedtls-2.4.2'
+
 if not os.path.exists(mbedtls_dir):
     msg = '''
 *********************************** Error: ************************************
@@ -50,8 +53,6 @@ os.chdir(mbedtls_dir)
 # the script will always conclude the repo is not up to date because a tag
 # with that name doesn't exist.
 # Tizen uses its own process to prepare the mbedTLS repo in gbsbuild.sh.
-# The mbedtls_revision tag here must match the one in extlibs/mbedtls/prep.sh.
-mbedtls_revision = 'mbedtls-2.4.2'
 if os.path.exists('.git/HEAD'):
     out = subprocess.check_output('git tag -l ' + mbedtls_revision, shell=True)
     if mbedtls_revision not in out:
@@ -92,6 +93,7 @@ if found:
 if not found:
     if os.path.exists('.git/HEAD'):
         # Apply ocf patch on git revision
+        print "Syncing/patching mbedtls external project..."
         cmd = 'git checkout -f development && git reset --hard ' + mbedtls_revision + ' && git clean -f && git apply --whitespace=fix ../ocf.patch'
         res = os.system(cmd)
     else:
@@ -114,8 +116,8 @@ mbedtls_config = os.path.join(root_dir, 'extlibs', 'mbedtls', 'mbedtls',
 try:
     copyfile(iotivity_config, mbedtls_config)
 except:
-    print 'mbedtls SConscript: cannot copy ' + iotivity_config + ' to ' + mbedtls_config
-    msg = 'error: ' + str(sys.exc_info()[0])
+    msg = 'mbedtls SConscript: cannot copy ' + iotivity_config + ' to ' + mbedtls_config
+    msg += 'error: ' + str(sys.exc_info()[0])
     Exit(msg)
 else:
     print 'Copied IoTivity version of config.h to ' + mbedtls_config