| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Tool to interact with recipe repositories. | 6 """Tool to interact with recipe repositories. |
| 7 | 7 |
| 8 This tool operates on the nearest ancestor directory containing an | 8 This tool operates on the nearest ancestor directory containing an |
| 9 infra/config/recipes.cfg. | 9 infra/config/recipes.cfg. |
| 10 """ | 10 """ |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 _, config_file = get_package_config(args) | 321 _, config_file = get_package_config(args) |
| 322 universe = loader.RecipeUniverse(package_deps, config_file) | 322 universe = loader.RecipeUniverse(package_deps, config_file) |
| 323 universe_view = loader.UniverseView(universe, package_deps.root_package) | 323 universe_view = loader.UniverseView(universe, package_deps.root_package) |
| 324 | 324 |
| 325 doc.main(universe_view) | 325 doc.main(universe_view) |
| 326 | 326 |
| 327 | 327 |
| 328 def info(args): | 328 def info(args): |
| 329 from recipe_engine import package | 329 from recipe_engine import package |
| 330 repo_root, config_file = get_package_config(args) | 330 _, config_file = get_package_config(args) |
| 331 package_spec = package.PackageSpec.load_proto(config_file) | 331 package_spec = package.PackageSpec.load_proto(config_file) |
| 332 | 332 |
| 333 if args.recipes_dir: | 333 if args.recipes_dir: |
| 334 print package_spec.recipes_path | 334 print package_spec.recipes_path |
| 335 | 335 |
| 336 | 336 |
| 337 # Map of arguments_pb2.Property "value" oneof conversion functions. | 337 # Map of arguments_pb2.Property "value" oneof conversion functions. |
| 338 # | 338 # |
| 339 # The fields here should be kept in sync with the "value" oneof field names in | 339 # The fields here should be kept in sync with the "value" oneof field names in |
| 340 # the arguments_pb2.Arguments.Property protobuf message. | 340 # the arguments_pb2.Arguments.Property protobuf message. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 582 |
| 583 if args.deps_path: | 583 if args.deps_path: |
| 584 logging.warning('(Not Bad) Using custom deps path: %s', args.deps_path) | 584 logging.warning('(Not Bad) Using custom deps path: %s', args.deps_path) |
| 585 | 585 |
| 586 # If we're bootstrapping, construct our bootstrap environment. If we're | 586 # If we're bootstrapping, construct our bootstrap environment. If we're |
| 587 # using a custom deps path, install our enviornment there too. | 587 # using a custom deps path, install our enviornment there too. |
| 588 if args.use_bootstrap and not os.environ.pop('RECIPES_RUN_BOOTSTRAP', None): | 588 if args.use_bootstrap and not os.environ.pop('RECIPES_RUN_BOOTSTRAP', None): |
| 589 # Propagate our deps path, if specified, so we re-use our temporary | 589 # Propagate our deps path, if specified, so we re-use our temporary |
| 590 # directory. | 590 # directory. |
| 591 if args.deps_path: | 591 if args.deps_path: |
| 592 env_path = os.path.join(args.deps_path, '.ENV') | 592 venv_root = os.path.join(args.deps_path, '.virtualenv') |
| 593 env_path = os.path.join(venv_root, 'ENV') |
| 594 bootstrap_cache_path = os.path.join(venv_root, 'bootstrap_cache') |
| 593 os.environ['RECIPES_RUN_BOOTSTRAP_DEPS_DIR'] = args.deps_path | 595 os.environ['RECIPES_RUN_BOOTSTRAP_DEPS_DIR'] = args.deps_path |
| 594 else: | 596 else: |
| 595 env_path = os.path.join(ROOT_DIR, 'ENV') | 597 env_path = os.path.join(ROOT_DIR, 'ENV') |
| 598 bootstrap_cache_path = os.path.join(ROOT_DIR, '.bootstrap_cache') |
| 596 | 599 |
| 597 logging.debug('Installing bootstrap environment into: %s', env_path) | 600 logging.debug('Installing bootstrap environment into: %s', env_path) |
| 598 subprocess.check_call( | 601 subprocess.check_call( |
| 599 [ | 602 [ |
| 600 sys.executable, | 603 sys.executable, |
| 601 os.path.join(ROOT_DIR, 'bootstrap', 'bootstrap.py'), | 604 os.path.join(ROOT_DIR, 'bootstrap', 'bootstrap.py'), |
| 602 '--deps-file', os.path.join(ROOT_DIR, 'bootstrap', 'deps.pyl'), | 605 '--deps-file', os.path.join(ROOT_DIR, 'bootstrap', 'deps.pyl'), |
| 606 '--cache-root', bootstrap_cache_path, |
| 603 env_path, | 607 env_path, |
| 604 ], | 608 ], |
| 605 cwd=ROOT_DIR) | 609 cwd=ROOT_DIR) |
| 606 | 610 |
| 607 # Mark that we're bootstrapping, so the next invocation falls through to | 611 # Mark that we're bootstrapping, so the next invocation falls through to |
| 608 # standard recipe operation. | 612 # standard recipe operation. |
| 609 os.environ['RECIPES_RUN_BOOTSTRAP'] = '1' | 613 os.environ['RECIPES_RUN_BOOTSTRAP'] = '1' |
| 610 args = sys.argv | 614 args = sys.argv |
| 611 return subprocess.call( | 615 return subprocess.call( |
| 612 [ | 616 [ |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 710 |
| 707 if not isinstance(ret, int): | 711 if not isinstance(ret, int): |
| 708 if ret is None: | 712 if ret is None: |
| 709 ret = 0 | 713 ret = 0 |
| 710 else: | 714 else: |
| 711 print >> sys.stderr, ret | 715 print >> sys.stderr, ret |
| 712 ret = 1 | 716 ret = 1 |
| 713 sys.stdout.flush() | 717 sys.stdout.flush() |
| 714 sys.stderr.flush() | 718 sys.stderr.flush() |
| 715 os._exit(ret) | 719 os._exit(ret) |
| OLD | NEW |