Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: gclient.py

Issue 462363004: Only clear cache locks if the cache exists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Meta checkout manager supporting both Subversion and GIT.""" 6 """Meta checkout manager supporting both Subversion and GIT."""
7 # Files 7 # Files
8 # .gclient : Current client configuration, written by 'config' command. 8 # .gclient : Current client configuration, written by 'config' command.
9 # Format is a Python script defining 'solutions', a list whose 9 # Format is a Python script defining 'solutions', a list whose
10 # entries each are maps binding the strings "name" and "url" 10 # entries each are maps binding the strings "name" and "url"
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 if config_dict.get('target_os_only', False): 1215 if config_dict.get('target_os_only', False):
1216 self._enforced_os = tuple(set(target_os)) 1216 self._enforced_os = tuple(set(target_os))
1217 else: 1217 else:
1218 self._enforced_os = tuple(set(self._enforced_os).union(target_os)) 1218 self._enforced_os = tuple(set(self._enforced_os).union(target_os))
1219 1219
1220 cache_dir = config_dict.get('cache_dir') 1220 cache_dir = config_dict.get('cache_dir')
1221 if cache_dir: 1221 if cache_dir:
1222 cache_dir = os.path.join(self.root_dir, cache_dir) 1222 cache_dir = os.path.join(self.root_dir, cache_dir)
1223 cache_dir = os.path.abspath(cache_dir) 1223 cache_dir = os.path.abspath(cache_dir)
1224 # If running on a bot, force break any stale git cache locks. 1224 # If running on a bot, force break any stale git cache locks.
1225 if os.environ.get('CHROME_HEADLESS'): 1225 if os.path.exists(cache_dir) and os.environ.get('CHROME_HEADLESS'):
1226 subprocess2.check_call(['git', 'cache', 'unlock', '--cache-dir', 1226 subprocess2.check_call(['git', 'cache', 'unlock', '--cache-dir',
1227 cache_dir, '--force', '--all']) 1227 cache_dir, '--force', '--all'])
1228 gclient_scm.GitWrapper.cache_dir = cache_dir 1228 gclient_scm.GitWrapper.cache_dir = cache_dir
1229 git_cache.Mirror.SetCachePath(cache_dir) 1229 git_cache.Mirror.SetCachePath(cache_dir)
1230 1230
1231 if not target_os and config_dict.get('target_os_only', False): 1231 if not target_os and config_dict.get('target_os_only', False):
1232 raise gclient_utils.Error('Can\'t use target_os_only if target_os is ' 1232 raise gclient_utils.Error('Can\'t use target_os_only if target_os is '
1233 'not specified') 1233 'not specified')
1234 1234
1235 deps_to_add = [] 1235 deps_to_add = []
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 print >> sys.stderr, 'Error: %s' % str(e) 2197 print >> sys.stderr, 'Error: %s' % str(e)
2198 return 1 2198 return 1
2199 finally: 2199 finally:
2200 gclient_utils.PrintWarnings() 2200 gclient_utils.PrintWarnings()
2201 2201
2202 2202
2203 if '__main__' == __name__: 2203 if '__main__' == __name__:
2204 sys.exit(Main(sys.argv[1:])) 2204 sys.exit(Main(sys.argv[1:]))
2205 2205
2206 # vim: ts=2:sw=2:tw=80:et: 2206 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698