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

Side by Side Diff: tools/push-to-trunk/auto_roll.py

Issue 70373002: Add initial auto-roll script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following
11 # disclaimer in the documentation and/or other materials provided
12 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import optparse
30 import re
31 import sys
32 import urllib2
33
34 from common_includes import *
35
36 CONFIG = {
37 PERSISTFILE_BASENAME: "/tmp/v8-auto-roll-tempfile",
38 DOT_GIT_LOCATION: ".git",
39 }
40
41
42 class Preparation(Step):
43 def __init__(self):
44 Step.__init__(self, "Preparation.")
45
46 def RunStep(self):
47 self.InitialEnvironmentChecks()
48 self.CommonPrepare()
49
50
51 class FetchLatestRevision(Step):
52 def __init__(self):
53 Step.__init__(self, "Fetching latest V8 revision.")
54
55 def RunStep(self):
56 log = self.Git("svn log -1 --oneline").strip()
57 match = re.match(r"^r(\d+) ", log)
58 if not match:
59 self.Die("Could not extract current svn revision from log.")
60 self.Persist("latest", match.group(1))
61
62
63 class FetchLKGR(Step):
64 def __init__(self):
65 Step.__init__(self, "Fetching V8 LKGR.")
66
67 def RunStep(self):
68 lkgr_url = "https://v8-status.appspot.com/lkgr"
69 try:
70 # pylint: disable=E1121
71 url_fh = urllib2.urlopen(lkgr_url, None, 60)
72 except urllib2.URLError:
73 self.Die("URLException while fetching %s" % lkgr_url)
74 try:
75 self.Persist("lkgr", url_fh.read())
76 finally:
77 url_fh.close()
78
79
80 class PushToTrunk(Step):
81 def __init__(self):
82 Step.__init__(self, "Pushing to trunk if possible.")
83
84 def RunStep(self):
85 self.RestoreIfUnset("latest")
86 self.RestoreIfUnset("lkgr")
87 latest = int(self._state["latest"])
88 lkgr = int(self._state["lkgr"])
89 if latest == lkgr:
90 print "ToT (r%d) is clean. Pushing to trunk." % latest
91 # TODO(machenbach): Call push to trunk script.
92 else:
93 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk."
94 % (latest, lkgr))
95
96
97 def BuildOptions():
98 result = optparse.OptionParser()
99 result.add_option("-s", "--step", dest="s",
100 help="Specify the step where to start work. Default: 0.",
101 default=0, type="int")
102 return result
103
104
105 def Main():
106 parser = BuildOptions()
107 (options, args) = parser.parse_args()
108
109 step_classes = [
110 Preparation,
111 FetchLatestRevision,
112 FetchLKGR,
113 PushToTrunk,
114 ]
115
116 RunScript(step_classes, CONFIG, options, DEFAULT_SIDE_EFFECT_HANDLER)
117
118 if __name__ == "__main__":
119 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698