OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 18 matching lines...) Expand all Loading... |
29 import argparse | 29 import argparse |
30 import json | 30 import json |
31 import os | 31 import os |
32 import re | 32 import re |
33 import sys | 33 import sys |
34 import urllib | 34 import urllib |
35 | 35 |
36 from common_includes import * | 36 from common_includes import * |
37 import push_to_candidates | 37 import push_to_candidates |
38 | 38 |
39 PUSH_MESSAGE_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$") | |
40 | 39 |
41 class Preparation(Step): | 40 class Preparation(Step): |
42 MESSAGE = "Preparation." | 41 MESSAGE = "Preparation." |
43 | 42 |
44 def RunStep(self): | 43 def RunStep(self): |
45 self.InitialEnvironmentChecks(self.default_cwd) | 44 self.InitialEnvironmentChecks(self.default_cwd) |
46 self.CommonPrepare() | 45 self.CommonPrepare() |
47 | 46 |
48 | 47 |
49 class FetchCandidate(Step): | 48 class FetchCandidate(Step): |
50 MESSAGE = "Fetching V8 roll candidate ref." | 49 MESSAGE = "Fetching V8 roll ref." |
51 | 50 |
52 def RunStep(self): | 51 def RunStep(self): |
53 self.Git("fetch origin +refs/heads/candidate:refs/heads/candidate") | 52 # The roll ref points to the candidate to be rolled. |
54 self["candidate"] = self.Git("show-ref -s refs/heads/candidate").strip() | 53 self.Git("fetch origin +refs/heads/roll:refs/heads/roll") |
| 54 self["candidate"] = self.Git("show-ref -s refs/heads/roll").strip() |
55 | 55 |
56 | 56 |
57 class CheckLastPush(Step): | 57 class LastReleaseBailout(Step): |
58 MESSAGE = "Checking last V8 push to candidates." | 58 MESSAGE = "Checking last V8 release base." |
59 | 59 |
60 def RunStep(self): | 60 def RunStep(self): |
61 last_push = self.FindLastCandidatesPush() | 61 last_release = self.GetLatestReleaseBase() |
| 62 commits = self.GitLog( |
| 63 format="%H", git_hash="%s..%s" % (last_release, self["candidate"])) |
62 | 64 |
63 # Retrieve the master revision of the last push from the text in | 65 if not commits: |
64 # the push commit message. | 66 print "Already pushed current candidate %s" % self["candidate"] |
65 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) | |
66 candidate = PUSH_MESSAGE_RE.match(last_push_title).group(1) | |
67 | |
68 if not candidate: # pragma: no cover | |
69 self.Die("Could not retrieve master revision for candidates push %s" | |
70 % last_push) | |
71 | |
72 if self["candidate"] == candidate: | |
73 print "Already pushed current candidate %s" % candidate | |
74 return True | 67 return True |
75 | 68 |
76 | 69 |
77 class PushToCandidates(Step): | 70 class PushToCandidates(Step): |
78 MESSAGE = "Pushing to candidates if specified." | 71 MESSAGE = "Pushing to candidates if specified." |
79 | 72 |
80 def RunStep(self): | 73 def RunStep(self): |
81 print "Pushing candidate %s to candidates." % self["candidate"] | 74 print "Pushing candidate %s to candidates." % self["candidate"] |
82 | 75 |
83 args = [ | 76 args = [ |
(...skipping 27 matching lines...) Expand all Loading... |
111 | 104 |
112 def _Config(self): | 105 def _Config(self): |
113 return { | 106 return { |
114 "PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile", | 107 "PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile", |
115 } | 108 } |
116 | 109 |
117 def _Steps(self): | 110 def _Steps(self): |
118 return [ | 111 return [ |
119 Preparation, | 112 Preparation, |
120 FetchCandidate, | 113 FetchCandidate, |
121 CheckLastPush, | 114 LastReleaseBailout, |
122 PushToCandidates, | 115 PushToCandidates, |
123 ] | 116 ] |
124 | 117 |
125 | 118 |
126 if __name__ == "__main__": # pragma: no cover | 119 if __name__ == "__main__": # pragma: no cover |
127 sys.exit(AutoPush().Run()) | 120 sys.exit(AutoPush().Run()) |
OLD | NEW |