build: Add a way for auto_build.py to print actions without executing
authorMats Wichmann <mats@linux.com>
Sun, 9 Apr 2017 15:25:37 +0000 (09:25 -0600)
committerPhil Coval <philippe.coval@osg.samsung.com>
Mon, 26 Jun 2017 11:18:38 +0000 (11:18 +0000)
[Mats Wichmann]

EXEC_MODE={one of: False, false, 0} python auto_build.py args
will print what the script would do without actually running the actions
Found it hard to keep track of all the different targets,
this is a quick way to report.

[Philippe Coval]

Port from master to 1.3-rel

Conflicts:
auto_build.py

Change-Id: I6e03cc45ef4e51a5accde6f9866f7b62d3e002b7
Signed-off-by: Mats Wichmann <mats@linux.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18635
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Bug: https://jira.iotivity.org/browse/IOT-1745
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20789
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
auto_build.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 28da85e..596d8b6
@@ -35,11 +35,14 @@ def call_scons(build_options, extra_option_str):
 
     cmd_line += " " + str(extra_option_str)
 
-    print ("Running : " + cmd_line)
-    sys.stdout.flush()
-    exit_code = subprocess.Popen(cmd_line, shell=True).wait()
-    if exit_code != 0:
-        exit(exit_code)
+    if not EXEC_MODE:
+        print ("Would run : " + cmd_line)
+    else:
+        print ("Running : " + cmd_line)
+        sys.stdout.flush()
+        exit_code = subprocess.Popen(cmd_line, shell=True).wait()
+        if exit_code != 0:
+            exit(exit_code)
 
 def build_all(flag, extra_option_str):
     if platform.system() == "Linux":
@@ -386,10 +389,13 @@ def build_arduino(flag, extra_option_str):
 def build_tizen(flag, extra_option_str):
     print ("*********** Build for Tizen with options *************")
     cmd_line = os.getcwd() + "/gbsbuild.sh" + " " + extra_option_str
-    print ("Running : " + cmd_line)
-    exit_code = subprocess.Popen([cmd_line], shell=True).wait()
-    if exit_code != 0:
-        exit(exit_code)
+    if not EXEC_MODE:
+        print ("Would run : " + cmd_line)
+    else:
+        print ("Running : " + cmd_line)
+        exit_code = subprocess.Popen([cmd_line], shell=True).wait()
+        if exit_code != 0:
+            exit(exit_code)
 
     print ("*********** Build for Tizen octbstack lib and sample *************")
     build_extra_options = "-f resource/csdk/stack/samples/tizen/build/SConscript " + extra_option_str
@@ -530,6 +536,9 @@ script_name = sys.argv[0]
 
 # May be overridden in user's shell
 VERBOSE = os.getenv("VERBOSE", "1")
+EXEC_MODE = os.getenv("EXEC_MODE", True)
+if EXEC_MODE in ['false', 'False', '0']:
+    EXEC_MODE = False
 
 if arg_num == 1:
     build_all("true", "")