Store hashes of current and previous shipped V8 version
authorhablich <hablich@chromium.org>
Thu, 16 Apr 2015 12:51:51 +0000 (05:51 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 16 Apr 2015 12:51:42 +0000 (12:51 +0000)
Will be used for calculating changes between versions

BUG=
NOTRY=true

Review URL: https://codereview.chromium.org/1095483002

Cr-Commit-Position: refs/heads/master@{#27882}

tools/release/git_recipes.py
tools/release/releases.py
tools/release/test_scripts.py

index 1a57380..89fd7c9 100644 (file)
@@ -280,3 +280,6 @@ class GitRecipesMixin(object):
         return match.group(1)
     raise GitFailedException("Couldn't determine commit position for %s" %
                              git_hash)
+
+  def GitGetHashOfTag(self, tag_name, **kwargs):
+    return self.Git("rev-list -1 " + tag_name).strip().encode("ascii", "ignore")
index e7000ac..a82da2b 100755 (executable)
@@ -60,6 +60,7 @@ DEPS_RE = re.compile(r"""^\s*(?:["']v8_revision["']: ["']"""
 BLEEDING_EDGE_TAGS_RE = re.compile(
     r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)")
 
+OMAHA_PROXY_URL = "http://omahaproxy.appspot.com/"
 
 def SortBranches(branches):
   """Sort branches with version number names."""
@@ -440,7 +441,7 @@ class RetrieveInformationOnChromeReleases(Step):
 
     params = None
     result_raw = self.ReadURL(
-                             "http://omahaproxy.appspot.com/all.json",
+                             OMAHA_PROXY_URL + "all.json",
                              params,
                              wait_plan=[5, 20]
                              )
@@ -450,19 +451,47 @@ class RetrieveInformationOnChromeReleases(Step):
 
     for current_os in recent_releases:
       for current_version in current_os["versions"]:
-        current_candidate = {
-                            "chrome_version": current_version["version"],
-                           "os": current_version["os"],
-                           "release_date": current_version["current_reldate"],
-                           "v8_version": current_version["v8_version"],
-                           }
+        if current_version["channel"] != "canary":
+          continue
 
-        if current_version["channel"] == "canary":
-          canaries.append(current_candidate)
+        current_candidate = self._CreateCandidate(current_version)
+        canaries.append(current_candidate)
 
     chrome_releases = {"canaries": canaries}
     self["chrome_releases"] = chrome_releases
 
+  def _GetGitHashForV8Version(self, v8_version):
+    if v8_version.split(".")[3]== "0":
+      return self.GitGetHashOfTag(v8_version[:-2])
+
+    return self.GitGetHashOfTag(v8_version)
+
+  def _CreateCandidate(self, current_version):
+    params = None
+    url_to_call = (OMAHA_PROXY_URL + "v8.json?version="
+                   + current_version["previous_version"])
+    result_raw = self.ReadURL(
+                         url_to_call,
+                         params,
+                         wait_plan=[5, 20]
+                         )
+    previous_v8_version = json.loads(result_raw)["v8_version"]
+    v8_previous_version_hash = self._GetGitHashForV8Version(previous_v8_version)
+
+    current_v8_version = current_version["v8_version"]
+    v8_version_hash = self._GetGitHashForV8Version(current_v8_version)
+
+    current_candidate = {
+                        "chrome_version": current_version["version"],
+                        "os": current_version["os"],
+                        "release_date": current_version["current_reldate"],
+                        "v8_version": current_v8_version,
+                        "v8_version_hash": v8_version_hash,
+                        "v8_previous_version": previous_v8_version,
+                        "v8_previous_version_hash": v8_previous_version_hash,
+                       }
+    return current_candidate
+
 
 class CleanUp(Step):
   MESSAGE = "Clean up."
index 95cdcc0..dc6f097 100644 (file)
@@ -1422,13 +1422,20 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
       URL("http://omahaproxy.appspot.com/all.json", """[{
         "os": "win",
         "versions": [{
-          "version": "1.1.1.1",
-          "v8_version": "2.2.2.2",
+          "version": "2.2.2.2",
+          "v8_version": "22.2.2.2",
           "current_reldate": "04/09/15",
           "os": "win",
-          "channel": "canary"
+          "channel": "canary",
+          "previous_version": "1.1.1.0"
           }]
         }]"""),
+      URL("http://omahaproxy.appspot.com/v8.json?version=1.1.1.0", """{
+        "chromium_version": "1.1.1.0",
+        "v8_version": "11.1.1.0"
+        }"""),
+      Cmd("git rev-list -1 11.1.1", "v8_previous_version_hash"),
+      Cmd("git rev-list -1 22.2.2.2", "v8_version_hash"),
       Cmd("git checkout -f origin/master", ""),
       Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "")
     ])
@@ -1449,10 +1456,13 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
     expected_json = {"chrome_releases":{
                                         "canaries": [
                                                      {
-                           "chrome_version": "1.1.1.1",
+                           "chrome_version": "2.2.2.2",
                            "os": "win",
                            "release_date": "04/09/15",
-                           "v8_version": "2.2.2.2",
+                           "v8_version": "22.2.2.2",
+                           "v8_version_hash": "v8_version_hash",
+                           "v8_previous_version": "11.1.1.0",
+                           "v8_previous_version_hash": "v8_previous_version_hash"
                            }]},
                      "releases":[
       {