OLD | NEW |
1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 from __future__ import print_function | 5 from __future__ import print_function |
6 | 6 |
7 import contextlib | 7 import contextlib |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 15 matching lines...) Expand all Loading... |
26 logging.info('Created temporary workdir %s', args.workdir) | 26 logging.info('Created temporary workdir %s', args.workdir) |
27 | 27 |
28 try: | 28 try: |
29 yield | 29 yield |
30 finally: | 30 finally: |
31 if workdir_tempdir: | 31 if workdir_tempdir: |
32 shutil.rmtree(args.workdir, ignore_errors=True) | 32 shutil.rmtree(args.workdir, ignore_errors=True) |
33 | 33 |
34 | 34 |
35 def add_subparser(parser): | 35 def add_subparser(parser): |
| 36 helpstr = 'Invoke a recipe command from specified repo and revision.' |
36 remote_p = parser.add_parser( | 37 remote_p = parser.add_parser( |
37 'remote', | 38 'remote', help=helpstr, description=helpstr) |
38 description='Invoke a recipe command from specified repo and revision') | |
39 remote_p.add_argument( | 39 remote_p.add_argument( |
40 '--repository', required=True, | 40 '--repository', required=True, |
41 help='URL of a git repository to fetch') | 41 help='URL of a git repository to fetch') |
42 remote_p.add_argument( | 42 remote_p.add_argument( |
43 '--revision', | 43 '--revision', |
44 help=( | 44 help=( |
45 'Git commit hash to check out; defaults to latest revision on master' | 45 'Git commit hash to check out; defaults to latest revision on master' |
46 ' (refs/heads/master)' | 46 ' (refs/heads/master)' |
47 )) | 47 )) |
48 remote_p.add_argument( | 48 remote_p.add_argument( |
(...skipping 29 matching lines...) Expand all Loading... |
78 package.InfraRepoConfig().to_recipes_cfg(checkout_dir)) | 78 package.InfraRepoConfig().to_recipes_cfg(checkout_dir)) |
79 cmd = [ | 79 cmd = [ |
80 sys.executable, | 80 sys.executable, |
81 os.path.join( | 81 os.path.join( |
82 checkout_dir, | 82 checkout_dir, |
83 recipes_cfg.read().recipes_path, | 83 recipes_cfg.read().recipes_path, |
84 'recipes.py'), | 84 'recipes.py'), |
85 ] + args.remote_args | 85 ] + args.remote_args |
86 logging.info('Running %r', cmd) | 86 logging.info('Running %r', cmd) |
87 return subprocess.call(cmd) | 87 return subprocess.call(cmd) |
OLD | NEW |