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

Side by Side Diff: git_cache.py

Issue 825133002: Speculative fix for build on windows build bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: expected_root Created 5 years, 12 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
« no previous file with comments | « gclient_utils.py ('k') | recipes/android.py » ('j') | 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """A git command for managing a local cache of git repositories.""" 6 """A git command for managing a local cache of git repositories."""
7 7
8 from __future__ import print_function 8 from __future__ import print_function
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 with zipfile.ZipFile(filename, 'r') as f: 305 with zipfile.ZipFile(filename, 'r') as f:
306 f.printdir() 306 f.printdir()
307 f.extractall(directory) 307 f.extractall(directory)
308 except Exception as e: 308 except Exception as e:
309 self.print('Encountered error: %s' % str(e), file=sys.stderr) 309 self.print('Encountered error: %s' % str(e), file=sys.stderr)
310 retcode = 1 310 retcode = 1
311 else: 311 else:
312 retcode = 0 312 retcode = 0
313 finally: 313 finally:
314 # Clean up the downloaded zipfile. 314 # Clean up the downloaded zipfile.
315 gclient_utils.rmtree(tempdir) 315 gclient_utils.rm_file_or_tree(tempdir)
316 316
317 if retcode: 317 if retcode:
318 self.print( 318 self.print(
319 'Extracting bootstrap zipfile %s failed.\n' 319 'Extracting bootstrap zipfile %s failed.\n'
320 'Resuming normal operations.' % filename) 320 'Resuming normal operations.' % filename)
321 return False 321 return False
322 return True 322 return True
323 323
324 def exists(self): 324 def exists(self):
325 return os.path.isfile(os.path.join(self.mirror_path, 'config')) 325 return os.path.isfile(os.path.join(self.mirror_path, 'config'))
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 @classmethod 479 @classmethod
480 def UnlockAll(cls): 480 def UnlockAll(cls):
481 cachepath = cls.GetCachePath() 481 cachepath = cls.GetCachePath()
482 if not cachepath: 482 if not cachepath:
483 return 483 return
484 dirlist = os.listdir(cachepath) 484 dirlist = os.listdir(cachepath)
485 repo_dirs = set([os.path.join(cachepath, path) for path in dirlist 485 repo_dirs = set([os.path.join(cachepath, path) for path in dirlist
486 if os.path.isdir(os.path.join(cachepath, path))]) 486 if os.path.isdir(os.path.join(cachepath, path))])
487 for dirent in dirlist: 487 for dirent in dirlist:
488 if dirent.startswith('_cache_tmp') or dirent.startswith('tmp'): 488 if dirent.startswith('_cache_tmp') or dirent.startswith('tmp'):
489 gclient_utils.rmtree(os.path.join(cachepath, dirent)) 489 gclient_utils.rm_file_or_tree(os.path.join(cachepath, dirent))
490 elif (dirent.endswith('.lock') and 490 elif (dirent.endswith('.lock') and
491 os.path.isfile(os.path.join(cachepath, dirent))): 491 os.path.isfile(os.path.join(cachepath, dirent))):
492 repo_dirs.add(os.path.join(cachepath, dirent[:-5])) 492 repo_dirs.add(os.path.join(cachepath, dirent[:-5]))
493 493
494 unlocked_repos = [] 494 unlocked_repos = []
495 for repo_dir in repo_dirs: 495 for repo_dir in repo_dirs:
496 if cls.BreakLocks(repo_dir): 496 if cls.BreakLocks(repo_dir):
497 unlocked_repos.append(repo_dir) 497 unlocked_repos.append(repo_dir)
498 498
499 return unlocked_repos 499 return unlocked_repos
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 return options, args 684 return options, args
685 685
686 686
687 def main(argv): 687 def main(argv):
688 dispatcher = subcommand.CommandDispatcher(__name__) 688 dispatcher = subcommand.CommandDispatcher(__name__)
689 return dispatcher.execute(OptionParser(), argv) 689 return dispatcher.execute(OptionParser(), argv)
690 690
691 691
692 if __name__ == '__main__': 692 if __name__ == '__main__':
693 sys.exit(main(sys.argv[1:])) 693 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | recipes/android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698