| 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 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 'obj.target', 'src', '.deps', | 1891 'obj.target', 'src', '.deps', |
| 1892 # scons build cruft | 1892 # scons build cruft |
| 1893 '.sconsign.dblite', | 1893 '.sconsign.dblite', |
| 1894 # build helper, not needed on testers | 1894 # build helper, not needed on testers |
| 1895 'mksnapshot', | 1895 'mksnapshot', |
| 1896 ] | 1896 ] |
| 1897 | 1897 |
| 1898 return all_platforms | 1898 return all_platforms |
| 1899 | 1899 |
| 1900 | 1900 |
| 1901 def DatabaseSetup(buildmaster_config, require_dbconfig=False): | 1901 def DatabaseSetup(buildmaster_config): |
| 1902 """Configure the database settings for the buildbot master.""" | 1902 """Configure the database settings for the buildbot master.""" |
| 1903 | 1903 |
| 1904 # By default nothing is ever deleted from the database. We set a | 1904 # By default nothing is ever deleted from the database. We set a |
| 1905 # changeHorizon here to put an upper bound on the database size. | 1905 # changeHorizon here to put an upper bound on the database size. |
| 1906 if 'changeHorizon' not in buildmaster_config: | 1906 if 'changeHorizon' not in buildmaster_config: |
| 1907 buildmaster_config['changeHorizon'] = 3000 | 1907 buildmaster_config['changeHorizon'] = 3000 |
| 1908 | 1908 |
| 1909 # Read database credentials in the master directory. | 1909 # Read database credentials in the master directory. |
| 1910 if os.path.isfile('.dbconfig'): | 1910 if os.path.isfile('.dbconfig'): |
| 1911 values = {} | 1911 values = {} |
| 1912 execfile('.dbconfig', values) | 1912 execfile('.dbconfig', values) |
| 1913 if 'password' not in values: | 1913 if 'password' not in values: |
| 1914 raise Exception('could not get db password') | 1914 raise Exception('could not get db password') |
| 1915 | 1915 |
| 1916 buildmaster_config['db_url'] = 'postgresql://%s:%s@%s/%s' % ( | 1916 buildmaster_config['db_url'] = 'postgresql://%s:%s@%s/%s' % ( |
| 1917 values['username'], values['password'], | 1917 values['username'], values['password'], |
| 1918 values.get('hostname', 'localhost'), values['dbname']) | 1918 values.get('hostname', 'localhost'), values['dbname']) |
| 1919 else: | |
| 1920 assert not require_dbconfig | |
| 1921 | 1919 |
| 1922 | 1920 |
| 1923 def ReadBuildersFile(builders_path): | 1921 def ReadBuildersFile(builders_path): |
| 1924 with open(builders_path) as fp: | 1922 with open(builders_path) as fp: |
| 1925 contents = fp.read() | 1923 contents = fp.read() |
| 1926 return ParseBuildersFileContents(builders_path, contents) | 1924 return ParseBuildersFileContents(builders_path, contents) |
| 1927 | 1925 |
| 1928 | 1926 |
| 1929 def ParseBuildersFileContents(path, contents): | 1927 def ParseBuildersFileContents(path, contents): |
| 1930 builders = ast.literal_eval(contents) | 1928 builders = ast.literal_eval(contents) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 return False | 2037 return False |
| 2040 # Matches e.g. "cl_x86 = path/to/clang-cl.exe" | 2038 # Matches e.g. "cl_x86 = path/to/clang-cl.exe" |
| 2041 clang_cl_re = re.compile( | 2039 clang_cl_re = re.compile( |
| 2042 r'^cl_x\d\d\s+\=\s+(?P<compiler_path>[^ ]+)\s.*$', | 2040 r'^cl_x\d\d\s+\=\s+(?P<compiler_path>[^ ]+)\s.*$', |
| 2043 re.VERBOSE) | 2041 re.VERBOSE) |
| 2044 for line in open(build_file): | 2042 for line in open(build_file): |
| 2045 m = clang_cl_re.match(line) | 2043 m = clang_cl_re.match(line) |
| 2046 if m: | 2044 if m: |
| 2047 return 'clang' in m.group('compiler_path') | 2045 return 'clang' in m.group('compiler_path') |
| 2048 return False | 2046 return False |
| OLD | NEW |