Chromium Code Reviews| 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 copy | 8 import copy |
| 9 import cStringIO | 9 import cStringIO |
| 10 import errno | 10 import errno |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 """Parses all the slaves.cfg and returns the name of the active master | 1222 """Parses all the slaves.cfg and returns the name of the active master |
| 1223 determined by the hostname. Returns None otherwise. | 1223 determined by the hostname. Returns None otherwise. |
| 1224 | 1224 |
| 1225 It will be matched against *both* the 'slavename' and 'hostname' fields | 1225 It will be matched against *both* the 'slavename' and 'hostname' fields |
| 1226 in slaves.cfg. | 1226 in slaves.cfg. |
| 1227 """ | 1227 """ |
| 1228 slavename = slavename or GetActiveSlavename() | 1228 slavename = slavename or GetActiveSlavename() |
| 1229 for slave in GetAllSlaves(): | 1229 for slave in GetAllSlaves(): |
| 1230 if slavename == EntryToSlaveName(slave): | 1230 if slavename == EntryToSlaveName(slave): |
| 1231 return slave['master'] | 1231 return slave['master'] |
| 1232 return default | 1232 # TESTING. DO NOT SUBMIT. |
|
ghost stip (do not use)
2014/09/09 02:20:06
lol
| |
| 1233 return 'chromium.perf' | |
| 1234 #return default | |
| 1233 | 1235 |
| 1234 | 1236 |
| 1235 def ParsePythonCfg(cfg_filepath, fail_hard=False): | 1237 def ParsePythonCfg(cfg_filepath, fail_hard=False): |
| 1236 """Retrieves data from a python config file.""" | 1238 """Retrieves data from a python config file.""" |
| 1237 if not os.path.exists(cfg_filepath): | 1239 if not os.path.exists(cfg_filepath): |
| 1238 return None | 1240 return None |
| 1239 base_path = os.path.dirname(os.path.abspath(cfg_filepath)) | 1241 base_path = os.path.dirname(os.path.abspath(cfg_filepath)) |
| 1240 old_sys_path = sys.path | 1242 old_sys_path = sys.path |
| 1241 sys.path = sys.path + [base_path] | 1243 sys.path = sys.path + [base_path] |
| 1242 old_cwd = os.getcwd() | 1244 old_cwd = os.getcwd() |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1706 values = {} | 1708 values = {} |
| 1707 execfile('.dbconfig', values) | 1709 execfile('.dbconfig', values) |
| 1708 if 'password' not in values: | 1710 if 'password' not in values: |
| 1709 raise Exception('could not get db password') | 1711 raise Exception('could not get db password') |
| 1710 | 1712 |
| 1711 buildmaster_config['db_url'] = 'postgresql://%s:%s@%s/%s' % ( | 1713 buildmaster_config['db_url'] = 'postgresql://%s:%s@%s/%s' % ( |
| 1712 values['username'], values['password'], | 1714 values['username'], values['password'], |
| 1713 values.get('hostname', 'localhost'), values['dbname']) | 1715 values.get('hostname', 'localhost'), values['dbname']) |
| 1714 else: | 1716 else: |
| 1715 assert(not require_dbconfig) | 1717 assert(not require_dbconfig) |
| OLD | NEW |