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

Side by Side Diff: toolchain_build/command.py

Issue 355883002: The toolchain_build git cache is now referenced as a git-alternate. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: rebase Created 6 years, 5 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 | « pynacl/repo_tools.py ('k') | toolchain_build/substituter.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client 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 """Class capturing a command invocation as data.""" 6 """Class capturing a command invocation as data."""
7 7
8 import inspect 8 import inspect
9 import glob 9 import glob
10 import hashlib 10 import hashlib
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 (updated_push_url != tracked_push_url)): 367 (updated_push_url != tracked_push_url)):
368 logging.warn('Your git repo is using an old mirror: %s', abs_dir) 368 logging.warn('Your git repo is using an old mirror: %s', abs_dir)
369 logging.warn('Updating git repo using known mirror:') 369 logging.warn('Updating git repo using known mirror:')
370 logging.warn(' [FETCH] %s -> %s', 370 logging.warn(' [FETCH] %s -> %s',
371 tracked_fetch_url, updated_fetch_url) 371 tracked_fetch_url, updated_fetch_url)
372 logging.warn(' [PUSH] %s -> %s', 372 logging.warn(' [PUSH] %s -> %s',
373 tracked_push_url, updated_push_url) 373 tracked_push_url, updated_push_url)
374 pynacl.repo_tools.GitSetRemoteRepo(updated_fetch_url, abs_dir, 374 pynacl.repo_tools.GitSetRemoteRepo(updated_fetch_url, abs_dir,
375 push_url=updated_push_url) 375 push_url=updated_push_url)
376 376
377
378 def populate_cache(subst, git_cache, url): 377 def populate_cache(subst, git_cache, url):
379 if git_cache: 378 if git_cache:
380 abs_git_cache = subst.SubstituteAbsPaths(git_cache) 379 abs_git_cache = subst.SubstituteAbsPaths(git_cache)
381 if abs_git_cache: 380 if abs_git_cache:
382 pynacl.repo_tools.PopulateGitCache(abs_git_cache, [url]) 381 pynacl.repo_tools.PopulateGitCache(abs_git_cache, [url])
383 382
384 def validate(subst, url, directory, git_cache): 383 def validate(subst, url, directory):
385 expected_url = url 384 pynacl.repo_tools.ValidateGitRepo(url,
386 if git_cache:
387 abs_git_cache = subst.SubstituteAbsPaths(git_cache)
388 if abs_git_cache:
389 expected_url = pynacl.repo_tools.GetGitCacheURL(abs_git_cache, url)
390
391 pynacl.repo_tools.ValidateGitRepo(expected_url,
392 subst.SubstituteAbsPaths(directory), 385 subst.SubstituteAbsPaths(directory),
393 clobber_mismatch=True) 386 clobber_mismatch=True)
394 387
395 def sync(subst, url, dest, revision, reclone, clean, pathspec, git_cache, 388 def sync(subst, url, dest, revision, reclone, clean, pathspec, git_cache,
396 push_url): 389 push_url):
397 abs_dest = subst.SubstituteAbsPaths(dest) 390 abs_dest = subst.SubstituteAbsPaths(dest)
398 if git_cache: 391 if git_cache:
399 git_cache = subst.SubstituteAbsPaths(git_cache) 392 git_cache = subst.SubstituteAbsPaths(git_cache)
400 393
401 try: 394 try:
(...skipping 24 matching lines...) Expand all
426 return True 419 return True
427 return cmd_opts.IsBot() 420 return cmd_opts.IsBot()
428 421
429 commands = [] 422 commands = []
430 if git_cache: 423 if git_cache:
431 commands.append(Runnable(run_cond, populate_cache, git_cache, url)) 424 commands.append(Runnable(run_cond, populate_cache, git_cache, url))
432 425
433 commands.extend([Runnable(run_cond, update_valid_mirrors, url, push_url, 426 commands.extend([Runnable(run_cond, update_valid_mirrors, url, push_url,
434 destination, known_mirrors, push_mirrors), 427 destination, known_mirrors, push_mirrors),
435 Runnable(ClobberInvalidRepoCondition, validate, url, 428 Runnable(ClobberInvalidRepoCondition, validate, url,
436 destination, git_cache), 429 destination),
437 Runnable(run_cond, sync, url, destination, revision, reclone, 430 Runnable(run_cond, sync, url, destination, revision, reclone,
438 clean, pathspec, git_cache, push_url)]) 431 clean, pathspec, git_cache, push_url)])
439 return commands 432 return commands
440 433
441 434
442 def CleanGitWorkingDir(directory, path, run_cond=None): 435 def CleanGitWorkingDir(directory, path, run_cond=None):
443 """Clean a path in a git checkout, if the checkout directory exists.""" 436 """Clean a path in a git checkout, if the checkout directory exists."""
444 def clean(subst, directory, path): 437 def clean(subst, directory, path):
445 directory = subst.SubstituteAbsPaths(directory) 438 directory = subst.SubstituteAbsPaths(directory)
446 if os.path.exists(directory) and len(os.listdir(directory)) > 0: 439 if os.path.exists(directory) and len(os.listdir(directory)) > 0:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 # It describes how to unpack and apply patches to produce the source 525 # It describes how to unpack and apply patches to produce the source
533 # tree of the %(name)s component of a toolchain targetting Native Client. 526 # tree of the %(name)s component of a toolchain targetting Native Client.
534 527
535 # Source: %(upstream-name)s.tar 528 # Source: %(upstream-name)s.tar
536 """ 529 """
537 % info) 530 % info)
538 for patch in patch_files: 531 for patch in patch_files:
539 f.write('\n# %s\n%s\n' % patch) 532 f.write('\n# %s\n%s\n' % patch)
540 533
541 return Runnable(run_cond, generatePatches, git_dir, info) 534 return Runnable(run_cond, generatePatches, git_dir, info)
OLDNEW
« no previous file with comments | « pynacl/repo_tools.py ('k') | toolchain_build/substituter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698