Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import argparse | 5 import argparse |
| 6 import datetime | 6 import datetime |
| 7 import difflib | 7 import difflib |
| 8 import random | 8 import random |
| 9 import re | 9 import re |
| 10 import urllib | 10 import urllib |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 if self.should_upload_build: | 408 if self.should_upload_build: |
| 409 self.upload_isolated_json() | 409 self.upload_isolated_json() |
| 410 | 410 |
| 411 def _compare_gyp_defines(self, mb_output): | 411 def _compare_gyp_defines(self, mb_output): |
| 412 """Compare infra gyp flags with client gyp flags. | 412 """Compare infra gyp flags with client gyp flags. |
| 413 | 413 |
| 414 Returns the difference as a list of strings or an empty list if there is | 414 Returns the difference as a list of strings or an empty list if there is |
| 415 none. | 415 none. |
| 416 """ | 416 """ |
| 417 | 417 |
| 418 def gyp_defines_to_dict(gyp_defines): | 418 def gyp_defines_to_dict(gyp_defines): |
|
tandrii(chromium)
2016/06/21 08:16:56
example string as comment for understanding code b
| |
| 419 return dict(tuple(x.split('=', 1)) for x in gyp_defines.split()) | 419 result = [] |
| 420 for x in gyp_defines.split(): | |
| 421 kv = x.split('=', 1) | |
| 422 if len(kv) == 1: | |
|
tandrii(chromium)
2016/06/21 08:16:56
maybe add # '=' not in kv
| |
| 423 result[-1][1] += (' ' + kv[0]) | |
| 424 else: | |
| 425 result.append(kv) | |
| 426 return dict(tuple(kv) for kv in result) | |
| 420 | 427 |
| 421 infra_flags = gyp_defines_to_dict( | 428 infra_flags = gyp_defines_to_dict( |
| 422 self.m.chromium.c.gyp_env.as_jsonish()['GYP_DEFINES']) | 429 self.m.chromium.c.gyp_env.as_jsonish()['GYP_DEFINES']) |
| 423 | 430 |
| 424 # Get the client's gyp flags from MB's output. | 431 # Get the client's gyp flags from MB's output. |
| 425 match = re.search('^GYP_DEFINES=\'(.*)\'$', mb_output, re.M) | 432 match = re.search('^GYP_DEFINES=\'(.*)\'$', mb_output, re.M) |
| 426 | 433 |
| 427 # This won't match in the gn case. | 434 # This won't match in the gn case. |
| 428 if match: | 435 if match: |
| 429 client_flags = gyp_defines_to_dict(match.group(1)) | 436 client_flags = gyp_defines_to_dict(match.group(1)) |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1244 def report_culprits(self, culprit_range): | 1251 def report_culprits(self, culprit_range): |
| 1245 assert culprit_range | 1252 assert culprit_range |
| 1246 if len(culprit_range) > 1: | 1253 if len(culprit_range) > 1: |
| 1247 text = 'Suspecting multiple commits' | 1254 text = 'Suspecting multiple commits' |
| 1248 else: | 1255 else: |
| 1249 text = 'Suspecting %s' % culprit_range[0][:8] | 1256 text = 'Suspecting %s' % culprit_range[0][:8] |
| 1250 | 1257 |
| 1251 step_result = self.m.step(text, cmd=None) | 1258 step_result = self.m.step(text, cmd=None) |
| 1252 for culprit in culprit_range: | 1259 for culprit in culprit_range: |
| 1253 step_result.presentation.links[culprit[:8]] = COMMIT_TEMPLATE % culprit | 1260 step_result.presentation.links[culprit[:8]] = COMMIT_TEMPLATE % culprit |
| OLD | NEW |