| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2017 The LUCI Authors. All rights reserved. | 2 # Copyright 2017 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 """Bundles a universe_view into a standalone folder. | 6 """Bundles a universe_view into a standalone folder. |
| 7 | 7 |
| 8 This captures the result of doing all the network operations that recipe_engine | 8 This captures the result of doing all the network operations that recipe_engine |
| 9 might do at startup to fetch repo code. | 9 might do at startup to fetch repo code. |
| 10 | 10 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 help='Create a hermetically runnable recipe bundle.', | 631 help='Create a hermetically runnable recipe bundle.', |
| 632 description=( | 632 description=( |
| 633 'Create a hermetically runnable recipe bundle. This captures the result' | 633 'Create a hermetically runnable recipe bundle. This captures the result' |
| 634 ' of all network operations the recipe_engine might normally do to' | 634 ' of all network operations the recipe_engine might normally do to' |
| 635 ' bootstrap itself.')) | 635 ' bootstrap itself.')) |
| 636 bundle_p.add_argument( | 636 bundle_p.add_argument( |
| 637 '--destination', default='./bundle', | 637 '--destination', default='./bundle', |
| 638 type=os.path.abspath, | 638 type=os.path.abspath, |
| 639 help='The directory of where to put the bundle (default: %(default)r).') | 639 help='The directory of where to put the bundle (default: %(default)r).') |
| 640 | 640 |
| 641 bundle_p.set_defaults(command='bundle', func=main) | 641 bundle_p.set_defaults(func=main) |
| 642 | 642 |
| 643 | 643 |
| 644 def main(package_deps, args): | 644 def main(package_deps, args): |
| 645 """ | 645 """ |
| 646 Args: | 646 Args: |
| 647 root_package (package.Package) - The recipes script in the produced bundle | 647 root_package (package.Package) - The recipes script in the produced bundle |
| 648 will be tuned to run commands using this package. | 648 will be tuned to run commands using this package. |
| 649 universe (loader.RecipeUniverse) - All of the recipes necessary to support | 649 universe (loader.RecipeUniverse) - All of the recipes necessary to support |
| 650 root_package. | 650 root_package. |
| 651 destination (str) - Path to the bundle output folder. This folder should not | 651 destination (str) - Path to the bundle output folder. This folder should not |
| 652 exist before calling this function. | 652 exist before calling this function. |
| 653 """ | 653 """ |
| 654 universe = loader.RecipeUniverse(package_deps, args.package) | 654 universe = loader.RecipeUniverse(package_deps, args.package) |
| 655 destination = args.destination | 655 destination = args.destination |
| 656 root_package = package_deps.root_package | 656 root_package = package_deps.root_package |
| 657 | 657 |
| 658 logging.basicConfig() | 658 logging.basicConfig() |
| 659 destination = prepare_destination(args.destination) | 659 destination = prepare_destination(args.destination) |
| 660 for pkg in universe.packages: | 660 for pkg in universe.packages: |
| 661 export_package(pkg, destination, pkg == root_package) | 661 export_package(pkg, destination, pkg == root_package) |
| 662 prep_recipes_py(universe, root_package, destination) | 662 prep_recipes_py(universe, root_package, destination) |
| 663 LOGGER.info('done!') | 663 LOGGER.info('done!') |
| OLD | NEW |