OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import argparse | 6 import argparse |
7 import json | 7 import json |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import urllib | 10 import urllib |
(...skipping 20 matching lines...) Expand all Loading... |
31 "format": "json", | 31 "format": "json", |
32 } | 32 } |
33 params = urllib.urlencode(params) | 33 params = urllib.urlencode(params) |
34 search_url = "https://codereview.chromium.org/search" | 34 search_url = "https://codereview.chromium.org/search" |
35 result = self.ReadURL(search_url, params, wait_plan=[5, 20]) | 35 result = self.ReadURL(search_url, params, wait_plan=[5, 20]) |
36 if self.ContainsChromiumRoll(json.loads(result)["results"]): | 36 if self.ContainsChromiumRoll(json.loads(result)["results"]): |
37 print "Stop due to existing Chromium roll." | 37 print "Stop due to existing Chromium roll." |
38 return True | 38 return True |
39 | 39 |
40 | 40 |
41 class DetectLastPush(Step): | |
42 MESSAGE = "Detect commit ID of the last push to candidates." | |
43 | |
44 def RunStep(self): | |
45 self.vc.Fetch() | |
46 push_hash = self.FindLastCandidatesPush( | |
47 branch="origin/candidates", include_patches=True) | |
48 self["last_push"] = self.GetCommitPositionNumber(push_hash) | |
49 | |
50 | |
51 class DetectLastRoll(Step): | 41 class DetectLastRoll(Step): |
52 MESSAGE = "Detect commit ID of the last Chromium roll." | 42 MESSAGE = "Detect commit ID of the last Chromium roll." |
53 | 43 |
54 def RunStep(self): | 44 def RunStep(self): |
| 45 # The revision that should be rolled. |
| 46 latest_release = self.GetLatestRelease() |
| 47 |
55 # Interpret the DEPS file to retrieve the v8 revision. | 48 # Interpret the DEPS file to retrieve the v8 revision. |
56 # TODO(machenbach): This should be part or the roll-deps api of | 49 # TODO(machenbach): This should be part or the roll-deps api of |
57 # depot_tools. | 50 # depot_tools. |
58 Var = lambda var: '%s' | 51 Var = lambda var: '%s' |
59 exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) | 52 exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) |
60 last_roll = self.GetCommitPositionNumber(vars['v8_revision']) | 53 |
61 # FIXME(machenbach): When rolling from master and from candidates there | 54 # The revision rolled last. |
62 # will be different commit numbers here. Better use version? | 55 last_roll = vars['v8_revision'] |
63 if int(last_roll) >= int(self["last_push"]): | 56 |
| 57 # TODO(machenbach): It is possible that the auto-push script made a new |
| 58 # fast-forward release (e.g. 4.2.3) while somebody patches the last |
| 59 # candidate (e.g. 4.2.2.1). In this case, the auto-roller would pick |
| 60 # the fast-forward release. Should there be a way to prioritize the |
| 61 # patched version? |
| 62 |
| 63 if latest_release == last_roll: |
| 64 # We always try to roll if the latest revision is not the revision in |
| 65 # chromium. |
64 print("There is no newer v8 revision than the one in Chromium (%s)." | 66 print("There is no newer v8 revision than the one in Chromium (%s)." |
65 % last_roll) | 67 % last_roll) |
66 return True | 68 return True |
67 | 69 |
68 | 70 |
69 class CheckClusterFuzz(Step): | 71 class CheckClusterFuzz(Step): |
70 MESSAGE = "Check ClusterFuzz api for new problems." | 72 MESSAGE = "Check ClusterFuzz api for new problems." |
71 | 73 |
72 def RunStep(self): | 74 def RunStep(self): |
73 if not os.path.exists(self.Config("CLUSTERFUZZ_API_KEY_FILE")): | 75 if not os.path.exists(self.Config("CLUSTERFUZZ_API_KEY_FILE")): |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 126 |
125 def _Config(self): | 127 def _Config(self): |
126 return { | 128 return { |
127 "PERSISTFILE_BASENAME": "/tmp/v8-auto-roll-tempfile", | 129 "PERSISTFILE_BASENAME": "/tmp/v8-auto-roll-tempfile", |
128 "CLUSTERFUZZ_API_KEY_FILE": ".cf_api_key", | 130 "CLUSTERFUZZ_API_KEY_FILE": ".cf_api_key", |
129 } | 131 } |
130 | 132 |
131 def _Steps(self): | 133 def _Steps(self): |
132 return [ | 134 return [ |
133 CheckActiveRoll, | 135 CheckActiveRoll, |
134 DetectLastPush, | |
135 DetectLastRoll, | 136 DetectLastRoll, |
136 CheckClusterFuzz, | 137 CheckClusterFuzz, |
137 RollChromium, | 138 RollChromium, |
138 ] | 139 ] |
139 | 140 |
140 | 141 |
141 if __name__ == "__main__": # pragma: no cover | 142 if __name__ == "__main__": # pragma: no cover |
142 sys.exit(AutoRoll().Run()) | 143 sys.exit(AutoRoll().Run()) |
OLD | NEW |