| 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 base64 | 9 import base64 |
| 10 import cStringIO | 10 import cStringIO |
| (...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 basedir = os.path.dirname(os.path.abspath(path)) | 1845 basedir = os.path.dirname(os.path.abspath(path)) |
| 1846 master_dirname = os.path.basename(basedir) | 1846 master_dirname = os.path.basename(basedir) |
| 1847 master_name_comps = master_dirname.split('.')[1:] | 1847 master_name_comps = master_dirname.split('.')[1:] |
| 1848 buildbot_path = '.'.join(master_name_comps) | 1848 buildbot_path = '.'.join(master_name_comps) |
| 1849 master_classname = ''.join(c[0].upper() + c[1:] for c in master_name_comps) | 1849 master_classname = ''.join(c[0].upper() + c[1:] for c in master_name_comps) |
| 1850 builders['master_dirname'] = master_dirname | 1850 builders['master_dirname'] = master_dirname |
| 1851 builders.setdefault('master_classname', master_classname) | 1851 builders.setdefault('master_classname', master_classname) |
| 1852 builders.setdefault('buildbot_url', | 1852 builders.setdefault('buildbot_url', |
| 1853 'https://build.chromium.org/p/%s/' % buildbot_path) | 1853 'https://build.chromium.org/p/%s/' % buildbot_path) |
| 1854 | 1854 |
| 1855 builders.setdefault('buildbucket_bucket', None) |
| 1856 builders.setdefault('service_account_file', None) |
| 1857 |
| 1858 # The _str fields are printable representations of Python values: |
| 1859 # if builders['foo'] == "hello", then builders['foo_str'] == "'hello'". |
| 1860 # This allows them to be read back in by Python scripts properly. |
| 1861 builders['buildbucket_bucket_str'] = repr(builders['buildbucket_bucket']) |
| 1862 builders['service_account_file_str'] = repr(builders['service_account_file']) |
| 1863 |
| 1855 return builders | 1864 return builders |
| 1856 | 1865 |
| 1857 | 1866 |
| 1858 def GetSlavesFromBuildersFile(builders_path): | 1867 def GetSlavesFromBuildersFile(builders_path): |
| 1859 """Read builders_path and return a list of slave dicts.""" | 1868 """Read builders_path and return a list of slave dicts.""" |
| 1860 builders = ReadBuildersFile(builders_path) | 1869 builders = ReadBuildersFile(builders_path) |
| 1861 return GetSlavesFromBuilders(builders) | 1870 return GetSlavesFromBuilders(builders) |
| 1862 | 1871 |
| 1863 | 1872 |
| 1864 def GetSlavesFromBuilders(builders): | 1873 def GetSlavesFromBuilders(builders): |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 | 1905 |
| 1897 return slaves | 1906 return slaves |
| 1898 | 1907 |
| 1899 def GetSlaveNamesForBuilder(builders, builder_name): | 1908 def GetSlaveNamesForBuilder(builders, builder_name): |
| 1900 """Returns a list of slave hostnames for the given builder name.""" | 1909 """Returns a list of slave hostnames for the given builder name.""" |
| 1901 slaves = [] | 1910 slaves = [] |
| 1902 pool_names = builders['builders'][builder_name]['slave_pools'] | 1911 pool_names = builders['builders'][builder_name]['slave_pools'] |
| 1903 for pool_name in pool_names: | 1912 for pool_name in pool_names: |
| 1904 slaves.extend(builders['slave_pools'][pool_name]['slaves']) | 1913 slaves.extend(builders['slave_pools'][pool_name]['slaves']) |
| 1905 return slaves | 1914 return slaves |
| OLD | NEW |