Chromium Code Reviews| Index: infra/libs/buildbot/master.py |
| diff --git a/infra/libs/buildbot/master.py b/infra/libs/buildbot/master.py |
| index 816a3caa3e65bf29ada8108f545a110f1cabe688..966cffdde096d232e2ab1a56eea364899ae40539 100644 |
| --- a/infra/libs/buildbot/master.py |
| +++ b/infra/libs/buildbot/master.py |
| @@ -93,10 +93,12 @@ def get_last_no_new_builds(directory): |
| return last_no_new_builds |
| -def get_mastermap_data(directory): |
| - """Get mastermap JSON from a master directory.""" |
| +def _call_mastermap(build_dir): |
| + """Given a build/ directory, obtain the full mastermap.json. |
| - build_dir = os.path.join(directory, os.pardir, os.pardir, os.pardir, 'build') |
| + This checks if build_internal/ is checked out next to build/ and uses |
| + mastermap_internal.py if present. |
| + """ |
| runit = os.path.join(build_dir, 'scripts', 'tools', 'runit.py') |
| build_internal_dir = os.path.join(build_dir, os.pardir, 'build_internal') |
| @@ -105,9 +107,22 @@ def get_mastermap_data(directory): |
| script_path = os.path.join( |
| build_internal_dir, 'scripts', 'tools', 'mastermap_internal.py') |
| - script_data = json.loads(subprocess.check_output( |
| + return json.loads(subprocess.check_output( |
|
iannucci
2015/05/06 23:48:05
if this gets called a bunch in the same process, i
ghost stip (do not use)
2015/05/07 06:50:56
only twice. I'd like to introduce a @memoize decor
|
| [runit, script_path, '-f', 'json'])) |
| + |
| +def get_mastermap_for_host(build_dir, hostname): |
| + """Get mastermap JSON for all masters on a specific host.""" |
| + script_data = _call_mastermap(build_dir) |
| + return [x for x in script_data if x.get('fullhost') == hostname] |
| + |
| + |
| +def get_mastermap_data(directory): |
| + """Get mastermap JSON for a specific master.""" |
| + |
| + build_dir = os.path.join(directory, os.pardir, os.pardir, os.pardir, 'build') |
|
iannucci
2015/05/06 23:48:05
would much rather use dirname than pardir (assumin
ghost stip (do not use)
2015/05/07 06:50:57
Done.
|
| + script_data = _call_mastermap(build_dir) |
| + |
| short_dirname = os.path.basename(directory) |
| matches = [x for x in script_data if x.get('dirname') == short_dirname] |
| assert len(matches) < 2, ( |