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

Side by Side Diff: scripts/master/cros_try_job_git.py

Issue 8305010: Add ChromiumOS Trybot support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: '' Created 9 years, 2 months 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import tempfile
6
7 import buildbot
8 from twisted.python import log
9
10 from master import tryjob_git_poller
11 from master.try_job_base import TryJobBase
12
13 buildbot_0_8 = int(buildbot.version.split('.')[1]) >= 8
14 if buildbot_0_8:
15 from master.try_job_base_bb8 import BadJobfile
16 else:
17 from master.try_job_base_bb7 import BadJobfile
18
19 class CrOSTryJobGit(TryJobBase):
20 """Poll a Git server to grab patches to try."""
21 def __init__(self, name, pools, repo_url, properties=None):
22 TryJobBase.__init__(self, name, pools, properties, None, None)
23 self.repo_url = repo_url
24 self.watcher = tryjob_git_poller.GitPoller(
25 repourl=repo_url,
26 workdir=tempfile.mkdtemp(prefix='gitpoller'),
27 pollinterval=10)
28 self.watcher.setServiceParent(self)
29
30 def ParseJob(self, stuff_tuple):
31 _, contents = stuff_tuple
32 # TODO: item.partition if python > 2.5.
33 options = dict(item.split('=') for item in contents.splitlines())
34 log.msg('Tryjob dict:\n%s' % str(options))
35
36 if not options.get('gerrit_patches', None):
37 raise BadJobfile('No patches specified!')
38
39 if not options.get('bot'):
40 raise BadJobfile('No configs specified!')
41
42 return TryJobBase.ParseJob(self, options)
43
44 def get_props(self, options):
45 base_props = TryJobBase.get_props(self, options)
46 base_props.setProperty('gerrit_patches', options.get('gerrit_patches'),
47 'Scheduler')
48 log.msg('props[clobber]=%s' % base_props.getProperty('clobber'))
49 return base_props
50
51 def addChange(self, change):
52 """Process the received data and send the queue buildset."""
53 # Implicitly skips over non-files like directories.
54 if len(change.files) != 1:
55 # We only accept changes with 1 diff file.
56 log.msg("Tryjob with too many files %s" % (','.join(change.files)))
57 return
58
59 output = self.watcher.get_file_contents(change.files[0])
60 log.msg('Tryjob contents:\n%s' % output)
61 self.SubmitJob((change.comments, output))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698