summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2011-03-30 08:59:59 +0200
committerjasplin <qt-info@nokia.com>2011-03-30 08:59:59 +0200
commit660b96ea46529dbe2780460e09281853d77a4c98 (patch)
treeddd7ffb3e6c24006abf9bba74c850707581c6d07
parent736660edd3f861e5e4ca19f7078c1fec25dfeb5e (diff)
Keep repo with 'testable snapshots' file away from externals.
-rwxr-xr-xscripts/uploadresults.py57
1 files changed, 42 insertions, 15 deletions
diff --git a/scripts/uploadresults.py b/scripts/uploadresults.py
index 045e787..f373c85 100755
--- a/scripts/uploadresults.py
+++ b/scripts/uploadresults.py
@@ -334,17 +334,18 @@ def execComputeRankings(options, new_context):
sys.stdout.write(" stderr: >" + stderr.strip() + "<\n")
-# Executes an external command. Exits program upon failure.
+# Executes an external command. Returns True iff the return code of the
+# command is zero.
def runCommand(cmd):
p = Popen(cmd, stdout = PIPE, stderr = PIPE)
stdout, stderr = p.communicate()
- if (p.returncode != 0):
+ if p.returncode != 0:
print "\nfailed to run command", cmd
print " return code:", p.returncode
print " stdout: >%s<" % stdout.strip()
print " stderr: >%s<" % stderr.strip()
- print "exiting ..."
- sys.exit(1)
+ return False
+ return True
def updateTestableSnapshotsFile():
@@ -390,19 +391,45 @@ def updateTestableSnapshotsFile():
# --- END create XML structure ---
- # Dump XML structure to file in tiny repo on gitestr:
- f = open('/tmp/bmtestable.xml', 'w')
+ # Dump XML structure to local file:
+ file_name = "bmtestable.xml"
+ tmp_abs_fpath = "/tmp/" + file_name
+ f = open(tmp_abs_fpath, 'w')
f.write(doc.toprettyxml(indent=' '))
f.close()
- runCommand(
- ["scp", "/tmp/bmtestable.xml",
- "qt@gitestr.nokia.troll.no:bmtestable/bmtestable.xml"])
- runCommand(["rm", "/tmp/bmtestable.xml"])
-
- # Add new revision:
- runCommand(
- ["ssh", "qt@gitestr.nokia.troll.no",
- "cd bmtestable", "git commit -a -m update"])
+
+ # Add new revision (for source control):
+ repo_user_at_host = "qt@bmc.test.qt.nokia.com"
+ repo_dir = "bmtestable"
+ if not runCommand(
+ ["scp", tmp_abs_fpath,
+ repo_user_at_host + ":" + repo_dir + "/" + file_name]):
+ sys.stderr.write("exiting ...\n")
+ sys.exit(1)
+ if not runCommand(
+ ["ssh", repo_user_at_host, "cd " + repo_dir,
+ "; git commit -a -m update"]): # Note semicolon!
+ sys.stderr.write(
+ file_name + " was expected to change, but apparently did not\n")
+ sys.stderr.write("exiting ...\n")
+ sys.exit(1)
+
+ # Install at destination (accessible to external clients):
+ # (note: the installation is done in two steps in order to minimize the
+ # likelihood of a client reading an incomplete file)
+ dest_user_at_host = "qt@gitestr.nokia.troll.no"
+ if not runCommand(
+ ["scp", tmp_abs_fpath, dest_user_at_host + ":" + tmp_abs_fpath]):
+ sys.stderr.write("exiting ...\n")
+ sys.exit(1)
+ if not runCommand(
+ ["ssh", dest_user_at_host, "mv " + tmp_abs_fpath + " " + file_name]):
+ sys.stderr.write("exiting ...\n")
+ sys.exit(1)
+
+ # Clean up local file:
+ runCommand(["rm", "-f", tmp_abs_fpath])
+
# --- END Global functions ----------------------------------------------