OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 import re | 7 import re |
8 | 8 |
9 from buildbot import buildset | 9 from buildbot import buildset |
10 from buildbot.changes.changes import Change | 10 from buildbot.changes.changes import Change |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 raise BadJobfile("'%s' is an invalid email address!" % email) | 43 raise BadJobfile("'%s' is an invalid email address!" % email) |
44 | 44 |
45 diff = options.get('patch', None) | 45 diff = options.get('patch', None) |
46 root = options.get('root', None) | 46 root = options.get('root', None) |
47 clobber = options.get('clobber') | 47 clobber = options.get('clobber') |
48 # -pN argument to patch. | 48 # -pN argument to patch. |
49 patchlevel = int(options.get('patchlevel', 0)) | 49 patchlevel = int(options.get('patchlevel', 0)) |
50 branch = options.get('branch', None) | 50 branch = options.get('branch', None) |
51 revision = options.get('revision', None) | 51 revision = options.get('revision', None) |
52 buildset_id = options.get('reason', '%s: %s' % (user, job_name)) | 52 buildset_id = options.get('reason', '%s: %s' % (user, job_name)) |
53 tests = [item for item in options.get('tests', '').split(',') if item] | 53 testfilters = [item for item in options.get('testfilter', '').split(',') |
| 54 if item] |
54 project = options.get('project', self.pools.default_pool_name) | 55 project = options.get('project', self.pools.default_pool_name) |
55 | 56 |
56 # Code review infos. Enforce numbers. | 57 # Code review infos. Enforce numbers. |
57 patchset = options.get('patchset', None) | 58 patchset = options.get('patchset', None) |
58 if patchset: | 59 if patchset: |
59 patchset = int(patchset) | 60 patchset = int(patchset) |
60 issue = options.get('issue', None) | 61 issue = options.get('issue', None) |
61 if issue: | 62 if issue: |
62 issue = int(issue) | 63 issue = int(issue) |
63 | 64 |
(...skipping 21 matching lines...) Expand all Loading... |
85 changes=fake_changes, | 86 changes=fake_changes, |
86 last_good_url=last_good_url, | 87 last_good_url=last_good_url, |
87 code_review_site=code_review_site, | 88 code_review_site=code_review_site, |
88 job_name=job_name, patchset=patchset, issue=issue) | 89 job_name=job_name, patchset=patchset, issue=issue) |
89 # Current job extra properties that are not related to the source stamp. | 90 # Current job extra properties that are not related to the source stamp. |
90 # Initialize with the Scheduler's base properties. | 91 # Initialize with the Scheduler's base properties. |
91 props = Properties() | 92 props = Properties() |
92 props.updateFromProperties(self.properties) | 93 props.updateFromProperties(self.properties) |
93 if clobber: | 94 if clobber: |
94 props.setProperty('clobber', True, 'Scheduler') | 95 props.setProperty('clobber', True, 'Scheduler') |
95 if tests: | 96 if testfilters: |
96 props.setProperty('tests', tests, 'Scheduler') | 97 props.setProperty('testfilters', testfilters, 'Scheduler') |
97 return builder_names, jobstamp, buildset_id, props | 98 return builder_names, jobstamp, buildset_id, props |
98 | 99 |
99 def SubmitJob(self, options): | 100 def SubmitJob(self, options): |
100 """Queues the buildset. | 101 """Queues the buildset. |
101 | 102 |
102 Args: | 103 Args: |
103 options: an optparse set of options. | 104 options: an optparse set of options. |
104 | 105 |
105 Returns: an HTTP error code. | 106 Returns: an HTTP error code. |
106 | 107 |
107 The content of options is decoded by ParseJob. If the file 'disable_try' | 108 The content of options is decoded by ParseJob. If the file 'disable_try' |
108 exists in the current directory, the try server is disabled. | 109 exists in the current directory, the try server is disabled. |
109 """ | 110 """ |
110 if os.path.exists('disable_try'): | 111 if os.path.exists('disable_try'): |
111 log.msg('Try job cancelled because the server is disabled!') | 112 log.msg('Try job cancelled because the server is disabled!') |
112 return http.SERVICE_UNAVAILABLE | 113 return http.SERVICE_UNAVAILABLE |
113 | 114 |
114 try: | 115 try: |
115 builder_names, jobstamp, buildset_id, props = self.ParseJob(options) | 116 builder_names, jobstamp, buildset_id, props = self.ParseJob(options) |
116 except BadJobfile: | 117 except BadJobfile: |
117 log.msg('%s reports a bad job connection' % (self)) | 118 log.msg('%s reports a bad job connection' % (self)) |
118 log.err() | 119 log.err() |
119 return http.BAD_REQUEST | 120 return http.BAD_REQUEST |
120 reason = "'%s' try job" % buildset_id | 121 reason = "'%s' try job" % buildset_id |
121 bs = buildset.BuildSet(builder_names, jobstamp, reason=reason, | 122 bs = buildset.BuildSet(builder_names, jobstamp, reason=reason, |
122 bsid=buildset_id, properties=props) | 123 bsid=buildset_id, properties=props) |
123 self.parent.submitBuildSet(bs) | 124 self.parent.submitBuildSet(bs) |
124 return http.OK | 125 return http.OK |
OLD | NEW |