diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 19:00:34 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 19:00:34 +0000 |
commit | 7f238151b275f1f4c13bd9c61e59bcc2a34b6442 (patch) | |
tree | 3b00800855050304b7841bf7da0f07dc76f2acaa /PRESUBMIT.py | |
parent | e74073af3c4ad6b8e890d07aef3ff2cdd23f9b20 (diff) | |
download | chromium_src-7f238151b275f1f4c13bd9c61e59bcc2a34b6442.zip chromium_src-7f238151b275f1f4c13bd9c61e59bcc2a34b6442.tar.gz chromium_src-7f238151b275f1f4c13bd9c61e59bcc2a34b6442.tar.bz2 |
Make the try job presubmit check (CheckTryJobExecution) less verbose.
Also clean up the Tree is closed presubmit check (CheckTreeIsOpen).
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/165251
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rwxr-xr-x | PRESUBMIT.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 47fd2e3..d1a8a39 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -62,10 +62,12 @@ def CheckChangeOnCommit(input_api, output_api): input_api, output_api)) # Make sure the tree is 'open'. # TODO(maruel): Run it in a separate thread to parallelize checks? - results.extend(CheckTreeIsOpen(input_api, output_api, - 'http://chromium-status.appspot.com/status', - '0', - 'http://chromium-status.appspot.com/current')) + results.extend(CheckTreeIsOpen( + input_api, + output_api, + 'http://chromium-status.appspot.com/status', + '0', + 'http://chromium-status.appspot.com/current?format=raw')) results.extend(CheckTryJobExecution(input_api, output_api)) return results @@ -76,28 +78,28 @@ def CheckTryJobExecution(input_api, output_api): return outputs url = "http://codereview.chromium.org/%d/get_build_results/%d" % ( input_api.change.issue, input_api.change.patchset) + PLATFORMS = ('win', 'linux', 'mac') try: connection = input_api.urllib2.urlopen(url) # platform|status|url values = [item.split('|', 2) for item in connection.read().splitlines()] connection.close() - statuses = map(lambda x: x[1], values) + # Reformat as an dict of platform: [status, url] + values = dict([[v[0], [v[1], v[2]]] for v in values]) + for platform in PLATFORMS: + values.setdefault(platform, ['not started', '']) message = None - if 'failure' in statuses: - failures = filter(lambda x: x[1] != 'success', values) - long_text = '\n'.join("% 5s: % 7s %s" % (item[0], item[1], item[2]) - for item in failures) - message = 'You had try job failures. Are you sure you want to check-in?\n' - elif 'pending' in statuses or len(values) != 3: - long_text = '\n'.join("% 5s: % 7s %s" % (item[0], item[1], item[2]) - for item in values) - message = 'You should try the patch first (and wait for it to finish).\n' + non_success = [k.upper() for k,v in values.iteritems() if v[0] != 'success'] + if 'failure' in [v[0] for v in values.itervalues()]: + message = 'Try job failures on %s!\n' % ', '.join(non_success) + elif non_success: + message = ('Unfinished (or not even started) try jobs on ' + '%s.\n') % ', '.join(non_success) if message: message += ( 'Is try server wrong or broken? Please notify maruel@chromium.org. ' 'Thanks.\n') - outputs.append(output_api.PresubmitPromptWarning(message=message, - long_text=long_text)) + outputs.append(output_api.PresubmitPromptWarning(message=message)) except input_api.urllib2.HTTPError, e: if e.code == 404: # Fallback to no try job. @@ -127,12 +129,8 @@ def CheckTreeIsOpen(input_api, output_api, url, closed, url_text): long_text = status + '\n' + url try: connection = input_api.urllib2.urlopen(url_text) - text = connection.read() + long_text = connection.read().strip() connection.close() - match = input_api.re.search(r"\<div class\=\"Notice\"\>(.*)\<\/div\>", - text) - if match: - long_text = match.group(1).strip() except IOError: pass return [output_api.PresubmitError("The tree is closed.", |