OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """ Set of basic operations/utilities that are used by the build. """ | 5 """ Set of basic operations/utilities that are used by the build. """ |
6 | 6 |
7 from contextlib import contextmanager | 7 from contextlib import contextmanager |
8 import ast | 8 import ast |
9 import copy | 9 import copy |
10 import cStringIO | 10 import cStringIO |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 BUILD_DIR, os.pardir, 'build_internal', 'masters/*/' + cue) | 1259 BUILD_DIR, os.pardir, 'build_internal', 'masters/*/' + cue) |
1260 path = os.path.join(BUILD_DIR, 'masters/*/' + cue) | 1260 path = os.path.join(BUILD_DIR, 'masters/*/' + cue) |
1261 filenames = [] | 1261 filenames = [] |
1262 if include_public: | 1262 if include_public: |
1263 filenames += glob.glob(path) | 1263 filenames += glob.glob(path) |
1264 if include_internal: | 1264 if include_internal: |
1265 filenames += glob.glob(path_internal) | 1265 filenames += glob.glob(path_internal) |
1266 return [os.path.abspath(os.path.dirname(f)) for f in filenames] | 1266 return [os.path.abspath(os.path.dirname(f)) for f in filenames] |
1267 | 1267 |
1268 | 1268 |
| 1269 def MasterPath(mastername, include_public=True, include_internal=True): |
| 1270 path = os.path.join(BUILD_DIR, 'masters', 'master.%s' % mastername) |
| 1271 path_internal = os.path.join( |
| 1272 BUILD_DIR, os.pardir, 'build_internal', 'masters', |
| 1273 'master.%s' % mastername) |
| 1274 if include_public and os.path.isdir(path): |
| 1275 return path |
| 1276 if include_internal and os.path.isdir(path_internal): |
| 1277 return path_internal |
| 1278 raise LookupError('Path for master %s not found' % mastername) |
| 1279 |
| 1280 |
1269 def ListMastersWithSlaves(include_public=True, include_internal=True): | 1281 def ListMastersWithSlaves(include_public=True, include_internal=True): |
1270 masters_path = ListMasters('builders.pyl', include_public, include_internal) | 1282 masters_path = ListMasters('builders.pyl', include_public, include_internal) |
1271 masters_path.extend(ListMasters('slaves.cfg', include_public, | 1283 masters_path.extend(ListMasters('slaves.cfg', include_public, |
1272 include_internal)) | 1284 include_internal)) |
1273 return masters_path | 1285 return masters_path |
1274 | 1286 |
1275 | 1287 |
1276 def GetSlavesFromMasterPath(path, fail_hard=False): | 1288 def GetSlavesFromMasterPath(path, fail_hard=False): |
1277 builders_path = os.path.join(path, 'builders.pyl') | 1289 builders_path = os.path.join(path, 'builders.pyl') |
1278 if os.path.exists(builders_path): | 1290 if os.path.exists(builders_path): |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 | 1864 |
1853 return slaves | 1865 return slaves |
1854 | 1866 |
1855 def GetSlaveNamesForBuilder(builders, builder_name): | 1867 def GetSlaveNamesForBuilder(builders, builder_name): |
1856 """Returns a list of slave hostnames for the given builder name.""" | 1868 """Returns a list of slave hostnames for the given builder name.""" |
1857 slaves = [] | 1869 slaves = [] |
1858 pool_names = builders['builders'][builder_name]['slave_pools'] | 1870 pool_names = builders['builders'][builder_name]['slave_pools'] |
1859 for pool_name in pool_names: | 1871 for pool_name in pool_names: |
1860 slaves.extend(builders['slave_pools'][pool_name]['slaves']) | 1872 slaves.extend(builders['slave_pools'][pool_name]['slaves']) |
1861 return slaves | 1873 return slaves |
OLD | NEW |