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

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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = self.parse_directory_owners(data_file)
qyearsley 2016/07/28 22:31:18 To make `parse_directory_owners` more single-purpo
72 self.print_('Gathering directory owners email to CC')
73 _, out = self.run(['git', 'diff', 'master', '--name-only'])
74 email_list = self.parse_imported_test_changes(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'] + 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 parse_imported_test_changes(self, results, directory_dict):
qyearsley 2016/07/28 22:31:18 Some things which may make this function easier to
308 email_list = []
309 directories = set()
310 for line in results.splitlines():
311 layout_tests_relative_path = self.fs.relpath(self.finder.layout_test s_dir(), self.finder.chromium_base())
312 test_path = self.fs.relpath(line, layout_tests_relative_path)
313 print test_path
314 test_path = self.fs.dirname(test_path)
315 print test_path
qyearsley 2016/07/28 22:31:18 Remember to remove debugging print lines :-)
316 test_path = test_path.strip('../')
317 if test_path in directory_dict and test_path not in directories:
318 email_list.append('--cc=' + directory_dict[test_path])
qyearsley 2016/07/28 22:31:18 The name email_list sounds like it's just a list o
319 directories.add(test_path)
320 return email_list
321
322 def parse_directory_owners(self, data_file):
323 directory_dict = {}
324 data = json.load(data_file)
325 for dict_set in data:
326 if dict_set['notification-email']:
327 directory_dict[dict_set['directory']] = dict_set['notification-e mail']
328 return directory_dict
329
300 def check_run(self, command): 330 def check_run(self, command):
301 return_code, out = self.run(command) 331 return_code, out = self.run(command)
302 if return_code: 332 if return_code:
303 raise Exception('%s failed with exit code %d.' % ' '.join(command), return_code) 333 raise Exception('%s failed with exit code %d.' % ' '.join(command), return_code)
304 return out 334 return out
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698