Commit 6198bbc5 authored by hablich's avatar hablich Committed by Commit bot

Retrieval of information by release channel

Polls omahaproxy for data about Chrome releases

BUG=
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#27841}
parent 3a814e4c
...@@ -381,7 +381,7 @@ class RetrieveChromiumV8Releases(Step): ...@@ -381,7 +381,7 @@ class RetrieveChromiumV8Releases(Step):
# TODO(machenbach): Unify common code with method above. # TODO(machenbach): Unify common code with method above.
class RietrieveChromiumBranches(Step): class RetrieveChromiumBranches(Step):
MESSAGE = "Retrieve Chromium branch information." MESSAGE = "Retrieve Chromium branch information."
def RunStep(self): def RunStep(self):
...@@ -433,6 +433,37 @@ class RietrieveChromiumBranches(Step): ...@@ -433,6 +433,37 @@ class RietrieveChromiumBranches(Step):
releases_dict.get(revision, {})["chromium_branch"] = ranges releases_dict.get(revision, {})["chromium_branch"] = ranges
class RetrieveInformationOnChromeReleases(Step):
MESSAGE = 'Retrieves relevant information on the latest Chrome releases'
def Run(self):
params = None
result_raw = self.ReadURL(
"http://omahaproxy.appspot.com/all.json",
params,
wait_plan=[5, 20]
)
recent_releases = json.loads(result_raw)
canaries = []
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":
canaries.append(current_candidate)
chrome_releases = {"canaries": canaries}
self["chrome_releases"] = chrome_releases
class CleanUp(Step): class CleanUp(Step):
MESSAGE = "Clean up." MESSAGE = "Clean up."
...@@ -444,6 +475,12 @@ class WriteOutput(Step): ...@@ -444,6 +475,12 @@ class WriteOutput(Step):
MESSAGE = "Print output." MESSAGE = "Print output."
def Run(self): def Run(self):
output = {
"releases": self["releases"],
"chrome_releases": self["chrome_releases"],
}
if self._options.csv: if self._options.csv:
with open(self._options.csv, "w") as f: with open(self._options.csv, "w") as f:
writer = csv.DictWriter(f, writer = csv.DictWriter(f,
...@@ -455,9 +492,9 @@ class WriteOutput(Step): ...@@ -455,9 +492,9 @@ class WriteOutput(Step):
writer.writerow(release) writer.writerow(release)
if self._options.json: if self._options.json:
with open(self._options.json, "w") as f: with open(self._options.json, "w") as f:
f.write(json.dumps(self["releases"])) f.write(json.dumps(output))
if not self._options.csv and not self._options.json: if not self._options.csv and not self._options.json:
print self["releases"] # pragma: no cover print output # pragma: no cover
class Releases(ScriptsBase): class Releases(ScriptsBase):
...@@ -486,12 +523,14 @@ class Releases(ScriptsBase): ...@@ -486,12 +523,14 @@ class Releases(ScriptsBase):
} }
def _Steps(self): def _Steps(self):
return [ return [
Preparation, Preparation,
RetrieveV8Releases, RetrieveV8Releases,
UpdateChromiumCheckout, UpdateChromiumCheckout,
RetrieveChromiumV8Releases, RetrieveChromiumV8Releases,
RietrieveChromiumBranches, RetrieveChromiumBranches,
RetrieveInformationOnChromeReleases,
CleanUp, CleanUp,
WriteOutput, WriteOutput,
] ]
......
...@@ -1419,8 +1419,18 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1} ...@@ -1419,8 +1419,18 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir), Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir),
Cmd("git show refs/branch-heads/7:DEPS", c_deps % "hash_345", Cmd("git show refs/branch-heads/7:DEPS", c_deps % "hash_345",
cwd=chrome_dir), cwd=chrome_dir),
URL("http://omahaproxy.appspot.com/all.json", """[{
"os": "win",
"versions": [{
"version": "1.1.1.1",
"v8_version": "2.2.2.2",
"current_reldate": "04/09/15",
"os": "win",
"channel": "canary"
}]
}]"""),
Cmd("git checkout -f origin/master", ""), Cmd("git checkout -f origin/master", ""),
Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "")
]) ])
args = ["-c", TEST_CONFIG["CHROMIUM"], args = ["-c", TEST_CONFIG["CHROMIUM"],
...@@ -1436,7 +1446,15 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1} ...@@ -1436,7 +1446,15 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
"3.3.1.1,3.3,234,,abc12\r\n") "3.3.1.1,3.3,234,,abc12\r\n")
self.assertEquals(csv, FileToText(csv_output)) self.assertEquals(csv, FileToText(csv_output))
expected_json = [ expected_json = {"chrome_releases":{
"canaries": [
{
"chrome_version": "1.1.1.1",
"os": "win",
"release_date": "04/09/15",
"v8_version": "2.2.2.2",
}]},
"releases":[
{ {
"revision": "1", "revision": "1",
"revision_git": "hash_456", "revision_git": "hash_456",
...@@ -1493,8 +1511,8 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1} ...@@ -1493,8 +1511,8 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
"date": "18:15", "date": "18:15",
"chromium_branch": "", "chromium_branch": "",
"revision_link": "https://code.google.com/p/v8/source/detail?r=234", "revision_link": "https://code.google.com/p/v8/source/detail?r=234",
}, },],
] }
self.assertEquals(expected_json, json.loads(FileToText(json_output))) self.assertEquals(expected_json, json.loads(FileToText(json_output)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment