| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2008 The Chromium 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 os | 6 import os |
| 7 | 7 |
| 8 from buildbot import buildset | 8 from buildbot import buildset |
| 9 from buildbot.scheduler import BadJobfile | 9 from buildbot.scheduler import BadJobfile |
| 10 from buildbot.scheduler import TryBase | 10 from buildbot.scheduler import TryBase |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 pools.setParent(self) | 22 pools.setParent(self) |
| 23 TryBase.__init__(self, name, pools.listBuilderNames(), properties) | 23 TryBase.__init__(self, name, pools.listBuilderNames(), properties) |
| 24 self.svn_url = svn_url | 24 self.svn_url = svn_url |
| 25 self.watcher = chromium_changes.SVNPoller( | 25 self.watcher = chromium_changes.SVNPoller( |
| 26 svnurl=svn_url, | 26 svnurl=svn_url, |
| 27 pollinterval=10, | 27 pollinterval=10, |
| 28 svnbin=config.Master.svn_binary_path) | 28 svnbin=config.Master.svn_binary_path) |
| 29 self.watcher.setServiceParent(self) | 29 self.watcher.setServiceParent(self) |
| 30 | 30 |
| 31 def parseJob(self, comment, diff): | 31 def parseJob(self, comment, diff): |
| 32 builderNames = [] | |
| 33 options = dict(item.split('=') for item in comment.splitlines()) | 32 options = dict(item.split('=') for item in comment.splitlines()) |
| 34 job_name = options.get('name', 'Unnamed') | 33 job_name = options.get('name', 'Unnamed') |
| 35 user = options.get('user', 'John Doe') | 34 user = options.get('user', 'John Doe') |
| 36 email = options.get('email', None) | 35 email = options.get('email', None) |
| 37 if 'user' in options and not email: | 36 if 'user' in options and not email: |
| 38 email = '%s@%s' % (user, config.Master.master_domain) | 37 email = '%s@%s' % (user, config.Master.master_domain) |
| 39 root = options.get('root', None) | 38 root = options.get('root', None) |
| 40 clobber = options.get('clobber', False) | 39 clobber = options.get('clobber', False) |
| 41 # -pN argument to patch. | 40 # -pN argument to patch. |
| 42 patchlevel = options.get('patchlevel', 0) | 41 patchlevel = options.get('patchlevel', 0) |
| 43 branch = options.get('branch', None) | 42 branch = options.get('branch', None) |
| 44 revision = options.get('revision', None) | 43 revision = options.get('revision', None) |
| 45 buildsetID = options.get('reason', "%s: %s" % (user, job_name)) | 44 buildsetID = options.get('reason', "%s: %s" % (user, job_name)) |
| 46 builderNames = [] | 45 builderNames = [] |
| 47 if 'bot' in options: | 46 if 'bot' in options: |
| 48 builderNames = [ options['bot'] ] | 47 builderNames = options['bot'].split(',') |
| 49 # TODO(maruel): Don't select the builders right now if not specified. | 48 # TODO(maruel): Don't select the builders right now if not specified. |
| 50 builderNames = self.pools.Select(builderNames) | 49 builderNames = self.pools.Select(builderNames) |
| 51 tests = options.get('tests', None) | 50 tests = options.get('tests', None) |
| 52 log.msg('Choose %s for job %s' % (",".join(builderNames), buildsetID)) | 51 log.msg('Choose %s for job %s' % (",".join(builderNames), buildsetID)) |
| 53 if diff: | 52 if diff: |
| 54 patch = (patchlevel, diff, root) | 53 patch = (patchlevel, diff, root) |
| 55 else: | 54 else: |
| 56 patch = None | 55 patch = None |
| 57 jobstamp = TryJobStamp(branch=branch, revision=revision, patch=patch, | 56 jobstamp = TryJobStamp(branch=branch, revision=revision, patch=patch, |
| 58 author_name=user, author_emails=email, | 57 author_name=user, author_emails=email, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 builderNames, job_stamp, buildsetID = self.parseJob(change.comments, | 75 builderNames, job_stamp, buildsetID = self.parseJob(change.comments, |
| 77 diff_content) | 76 diff_content) |
| 78 except BadJobfile: | 77 except BadJobfile: |
| 79 log.msg("%s reports a bad job connection" % (self)) | 78 log.msg("%s reports a bad job connection" % (self)) |
| 80 log.err() | 79 log.err() |
| 81 return | 80 return |
| 82 reason = "'%s' try job" % buildsetID | 81 reason = "'%s' try job" % buildsetID |
| 83 bs = buildset.BuildSet(builderNames, job_stamp, reason=reason, | 82 bs = buildset.BuildSet(builderNames, job_stamp, reason=reason, |
| 84 bsid=buildsetID) | 83 bsid=buildsetID) |
| 85 self.parent.submitBuildSet(bs) | 84 self.parent.submitBuildSet(bs) |
| OLD | NEW |