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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py

Issue 2188733003: Implement functionality to cc relevant owners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: corrections Created 4 years, 4 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Pull latest revisions of a W3C test repo and make a local commit.""" 5 """Pull latest revisions of a W3C test repo and make a local commit."""
6 6
7 import argparse 7 import argparse
8 import json
8 import time 9 import time
9 10
10 from webkitpy.common.webkit_finder import WebKitFinder 11 from webkitpy.common.webkit_finder import WebKitFinder
11 12
12 # Import destination directories (under LayoutTests/imported/). 13 # Import destination directories (under LayoutTests/imported/).
13 WPT_DEST_NAME = 'wpt' 14 WPT_DEST_NAME = 'wpt'
14 CSS_DEST_NAME = 'csswg-test' 15 CSS_DEST_NAME = 'csswg-test'
15 16
16 POLL_DELAY_SECONDS = 300 17 POLL_DELAY_SECONDS = 300
17 18
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 elif self.target == 'css': 59 elif self.target == 'css':
59 import_commitish = self.update( 60 import_commitish = self.update(
60 CSS_DEST_NAME, 61 CSS_DEST_NAME,
61 'https://chromium.googlesource.com/external/w3c/csswg-test.git') 62 'https://chromium.googlesource.com/external/w3c/csswg-test.git')
62 else: 63 else:
63 raise AssertionError("Unsupported target %s" % self.target) 64 raise AssertionError("Unsupported target %s" % self.target)
64 65
65 self.commit_changes_if_needed(chromium_commitish, import_commitish) 66 self.commit_changes_if_needed(chromium_commitish, import_commitish)
66 if self.auto_update: 67 if self.auto_update:
67 try_bots = self.host.builders.all_try_builder_names() 68 try_bots = self.host.builders.all_try_builder_names()
69 data_file_path = self.finder.path_from_webkit_base('Tools', 'Scripts ', 'webkitpy', 'w3c', 'directory_owners.json')
70 with open(data_file_path) as data_file:
71 directory_dict = parse_directory_owners(json.load(data_file))
72 self.print_('Gathering directory owners email to CC')
qyearsley 2016/07/28 23:46:33 To be consistent with other lines that are printed
73 _, out = self.run(['git', 'diff', 'master', '--name-only'])
74 email_list = self.generate_email_list(out, directory_dict)
68 self.print_('## Uploading change list.') 75 self.print_('## Uploading change list.')
69 self.check_run(['git', 'cl', 'upload', '-f', '-m', 'W3C auto test im porter']) 76 self.check_run(['git', 'cl', 'upload', '-f', '-m', 'W3C auto test im porter'] + ['--cc' + email for email in email_list])
70 self.print_('## Triggering try jobs.') 77 self.print_('## Triggering try jobs.')
71 for try_bot in try_bots: 78 for try_bot in try_bots:
72 self.run(['git', 'cl', 'try', '-b', try_bot]) 79 self.run(['git', 'cl', 'try', '-b', try_bot])
73 self.print_('## Waiting for Try Job Results') 80 self.print_('## Waiting for Try Job Results')
74 has_failing_results = False 81 has_failing_results = False
75 while True: 82 while True:
76 time.sleep(POLL_DELAY_SECONDS) 83 time.sleep(POLL_DELAY_SECONDS)
77 _, out = self.run(['git', 'cl', 'try-results']) 84 _, out = self.run(['git', 'cl', 'try-results'])
78 results = self.parse_try_job_results(out) 85 results = self.parse_try_job_results(out)
79 if results.get('Started') or results.get('Scheduled'): 86 if results.get('Started') or results.get('Scheduled'):
80 continue 87 continue
81 if results.get('Failures'): 88 if results.get('Failures'):
82 has_failing_results = True 89 has_failing_results = True
83 break 90 break
84 if has_failing_results: 91 if has_failing_results:
85 self.print_('## Adding test expectations lines to LayoutTests/Te stExpectations') 92 self.print_('## Adding test expectations lines to LayoutTests/Te stExpectations')
86 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'up date-w3c-test-expectations') 93 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'up date-w3c-test-expectations')
87 self.run([self.host.executable, script_path]) 94 self.run([self.host.executable, script_path])
88 self.check_run(['git', 'commit', '-a', '-m', '\'Modified Test Ex pectations from W3C Test Auto-roller\'']) 95 self.check_run(['git', 'commit', '-a', '-m', '\'Modified Test Ex pectations from W3C Test Auto-roller\''])
89 self.check_run(['git', 'cl', 'upload', '-m', '\'Wrote lines to T estExpectations\'']) 96 self.check_run(['git', 'cl', 'upload', '-m', '\'Wrote lines to T estExpectations\''])
90 else: 97 else:
91 self.print_('No Failures, committing patch.') 98 self.print_('No Failures, landing patch.')
92 quit() 99 quit()
93 self.run(['git', 'cl', 'land', '-f']) 100 self.run(['git', 'cl', 'land', '-f'])
94 return 0 101 return 0
95 102
96 def parse_args(self, argv): 103 def parse_args(self, argv):
97 parser = argparse.ArgumentParser() 104 parser = argparse.ArgumentParser()
98 parser.description = __doc__ 105 parser.description = __doc__
99 parser.add_argument('-v', '--verbose', action='store_true', 106 parser.add_argument('-v', '--verbose', action='store_true',
100 help='log what we are doing') 107 help='log what we are doing')
101 parser.add_argument('--allow-local-commits', action='store_true', 108 parser.add_argument('--allow-local-commits', action='store_true',
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 line = line.strip() 297 line = line.strip()
291 if line[-1] == ':': 298 if line[-1] == ':':
292 result_type = line[:-1] 299 result_type = line[:-1]
293 sets[result_type] = set() 300 sets[result_type] = set()
294 elif line.split()[0] == 'Total:': 301 elif line.split()[0] == 'Total:':
295 break 302 break
296 else: 303 else:
297 sets[result_type].add(line.split()[0]) 304 sets[result_type].add(line.split()[0])
298 return sets 305 return sets
299 306
307 def generate_email_list(self, changed_files, directory_dict):
308 """Generates a list of emails to be cc'd for current import
309
310 Turns the output from git cl try-results into a usable format.
qyearsley 2016/07/28 23:46:33 Nit: The body of the docstring should be lined up
311
312 Args:
313 changed_files: The files that have been modified at some
314 point in the import process.
315 directory_dict: A mapping of directories in imported to the
316 email address of the point of contact of it
qyearsley 2016/07/28 23:46:33 Nit: missing period. Also, you can probably remove
317
318 Returns:
319 A list of the email addresses to be notified for the current
320 import.
321 """
322 email_list = []
323 directories = set()
324 for line in changed_files.splitlines():
325 layout_tests_relative_path = self.fs.relpath(self.finder.layout_test s_dir(), self.finder.chromium_base())
326 test_path = self.fs.relpath(line, layout_tests_relative_path)
327 test_path = self.fs.dirname(test_path)
328 test_path = test_path.strip('../')
qyearsley 2016/07/28 23:46:33 Side note: Be careful with strip, it probably does
329 if test_path in directory_dict and test_path not in directories:
330 email_list.append(directory_dict[test_path])
331 directories.add(test_path)
332 return email_list
333
300 def check_run(self, command): 334 def check_run(self, command):
301 return_code, out = self.run(command) 335 return_code, out = self.run(command)
302 if return_code: 336 if return_code:
303 raise Exception('%s failed with exit code %d.' % ' '.join(command), return_code) 337 raise Exception('%s failed with exit code %d.' % ' '.join(command), return_code)
304 return out 338 return out
339
340
341 def parse_directory_owners(decoded_data_file):
342 directory_dict = {}
343 for dict_set in decoded_data_file:
344 if dict_set['notification-email']:
345 directory_dict[dict_set['directory']] = dict_set['notification-email ']
346 return directory_dict
qyearsley 2016/07/28 23:46:33 BTW, if you wanted to keep this in the class (for
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698