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 json | 7 import json |
8 import os | 8 import os |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 def fetch(repo_root, package_spec): | 101 def fetch(repo_root, package_spec): |
102 """ | 102 """ |
103 Just fetch the recipes to the newly configured version. | 103 Just fetch the recipes to the newly configured version. |
104 """ | 104 """ |
105 # Use _local_ recipes.py, so that it checks out the pinned recipe engine, | 105 # Use _local_ recipes.py, so that it checks out the pinned recipe engine, |
106 # rather than running recipe engine which may be at a different revision | 106 # rather than running recipe engine which may be at a different revision |
107 # than the pinned one. | 107 # than the pinned one. |
108 args = [ | 108 args = [ |
109 sys.executable, | 109 sys.executable, |
110 os.path.join(repo_root, package_spec.recipes_path, 'recipes.py'), | 110 os.path.join(repo_root, package_spec.recipes_path, 'recipes.py'), |
| 111 # Invoked recipes.py should not re-bootstrap (to avoid issues on bots). |
| 112 '--disable-bootstrap', |
111 'fetch', | 113 'fetch', |
112 ] | 114 ] |
113 subprocess.check_call(args) | 115 subprocess.check_call(args) |
114 | 116 |
115 | 117 |
116 def run_simulation_test(repo_root, package_spec, additional_args=None, | 118 def run_simulation_test(repo_root, package_spec, additional_args=None, |
117 allow_fetch=False): | 119 allow_fetch=False): |
118 """ | 120 """ |
119 Runs recipe simulation test for given package. | 121 Runs recipe simulation test for given package. |
120 | 122 |
121 Returns a tuple of exit code and output. | 123 Returns a tuple of exit code and output. |
122 """ | 124 """ |
123 # Use _local_ recipes.py, so that it checks out the pinned recipe engine, | 125 # Use _local_ recipes.py, so that it checks out the pinned recipe engine, |
124 # rather than running recipe engine which may be at a different revision | 126 # rather than running recipe engine which may be at a different revision |
125 # than the pinned one. | 127 # than the pinned one. |
126 args = [ | 128 args = [ |
127 sys.executable, | 129 sys.executable, |
128 os.path.join(repo_root, package_spec.recipes_path, 'recipes.py'), | 130 os.path.join(repo_root, package_spec.recipes_path, 'recipes.py'), |
| 131 # Invoked recipes.py should not re-bootstrap (to avoid issues on bots). |
| 132 '--disable-bootstrap', |
129 ] | 133 ] |
130 if not allow_fetch: | 134 if not allow_fetch: |
131 args.append('--no-fetch') | 135 args.append('--no-fetch') |
132 args.append('test') | 136 args.append('test') |
133 if additional_args: | 137 if additional_args: |
134 args.extend(additional_args) | 138 args.extend(additional_args) |
135 p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 139 p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
136 output, _ = p.communicate() | 140 output, _ = p.communicate() |
137 rc = p.returncode | 141 rc = p.returncode |
138 return rc, output | 142 return rc, output |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 config_file.write(package_spec.dump()) | 272 config_file.write(package_spec.dump()) |
269 run_simulation_test(context.repo_root, package_spec, ['train'], | 273 run_simulation_test(context.repo_root, package_spec, ['train'], |
270 allow_fetch=True) | 274 allow_fetch=True) |
271 | 275 |
272 if args.output_json: | 276 if args.output_json: |
273 with open(args.output_json, 'w') as f: | 277 with open(args.output_json, 'w') as f: |
274 json.dump( | 278 json.dump( |
275 results, f, default=default_json_encode, sort_keys=True, indent=4) | 279 results, f, default=default_json_encode, sort_keys=True, indent=4) |
276 | 280 |
277 return 0 | 281 return 0 |
OLD | NEW |