Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Unified Diff: tools/utils.py

Issue 1153033007: Add python based VERSION file generation for sdk bots (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix spelling Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/bots/dart_sdk.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/utils.py
diff --git a/tools/utils.py b/tools/utils.py
index 2189dbae60068a7dd88cbbf3e16ef0e7a85ad1cb..ec6312e0d871c4d8c7c07a020cc0b9e94070c4a0 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -6,6 +6,8 @@
# scripts.
import commands
+import datetime
+import json
import os
import platform
import re
@@ -318,6 +320,21 @@ def GetEclipseVersionQualifier():
def GetVersion():
return GetSemanticSDKVersion()
+
+# The editor used to produce the VERSION file put on gcs. We now produce this
+# in the bots archiving the sdk.
+# The content looks like this:
+#{
+# "date": "2015-05-28",
+# "version": "1.11.0-edge.131653",
+# "revision": "535394c2657ede445142d8a92486d3899bbf49b5"
+#}
+def GetVersionFileContent():
+ result = {"date": str(datetime.date.today()),
+ "version": GetVersion(),
+ "revision": GetGitRevision()}
+ return json.dumps(result, indent=2)
+
def GetChannel():
version = ReadVersionFile()
return version.channel
@@ -388,6 +405,19 @@ def GetArchiveVersion():
return GetGitNumber()
return GetSemanticSDKVersion()
+
+def GetGitRevision():
+ p = subprocess.Popen(['git', 'log', '-n', '1', '--pretty=format:%H'],
+ stdout = subprocess.PIPE,
+ stderr = subprocess.STDOUT, shell=IsWindows(),
+ cwd = DART_DIR)
+ output, _ = p.communicate()
+ # We expect a full git hash
+ if len(output) != 40:
+ print "Warning: could not parse git commit, output was %s" % output
+ return None
+ return output
+
# To eliminate clashing with older archived builds on bleding edge we add
# a base number bigger the largest svn revision (this also gives us an easy
# way of seeing if an archive comes from git based or svn based commits).
@@ -507,7 +537,8 @@ def Main():
print "GuessCpus() -> ", GuessCpus()
print "IsWindows() -> ", IsWindows()
print "GuessVisualStudioPath() -> ", GuessVisualStudioPath()
-
+ print "GetGitRevision() -> ", GetGitRevision()
+ print "GetVersionFileContent() -> ", GetVersionFileContent()
class Error(Exception):
pass
« no previous file with comments | « tools/bots/dart_sdk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698