| 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 sys | 7 import sys |
| 8 | 8 |
| 9 from . import loader | 9 from . import loader |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 'Ignore a recipe package (e.g. recipe_engine). Can be passed ' | 41 'Ignore a recipe package (e.g. recipe_engine). Can be passed ' |
| 42 'multiple times')) | 42 'multiple times')) |
| 43 depgraph_p.add_argument( | 43 depgraph_p.add_argument( |
| 44 '--recipe-filter', default='', | 44 '--recipe-filter', default='', |
| 45 help=( | 45 help=( |
| 46 'A recipe substring to examine. If present, the depgraph will ' | 46 'A recipe substring to examine. If present, the depgraph will ' |
| 47 'include a recipe section containing recipes whose names contain ' | 47 'include a recipe section containing recipes whose names contain ' |
| 48 'this substring. It will also filter all nodes of the graph to only ' | 48 'this substring. It will also filter all nodes of the graph to only ' |
| 49 'include modules touched by the filtered recipes.')) | 49 'include modules touched by the filtered recipes.')) |
| 50 | 50 |
| 51 depgraph_p.set_defaults(command='depgraph', func=main) | 51 depgraph_p.set_defaults(func=main) |
| 52 | 52 |
| 53 | 53 |
| 54 def main(package_deps, args): | 54 def main(package_deps, args): |
| 55 universe = loader.RecipeUniverse(package_deps, args.package) | 55 universe = loader.RecipeUniverse(package_deps, args.package) |
| 56 own_package = package_deps.root_package | 56 own_package = package_deps.root_package |
| 57 | 57 |
| 58 module_to_package = {} | 58 module_to_package = {} |
| 59 | 59 |
| 60 # All deps maps a tuple of (is_recipe, id) to deps (list of ids). is_recipe is | 60 # All deps maps a tuple of (is_recipe, id) to deps (list of ids). is_recipe is |
| 61 # a boolean, all ids are strings. | 61 # a boolean, all ids are strings. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 print(' subgraph "cluster_%s" { label="%s"; %s; }' % ( | 142 print(' subgraph "cluster_%s" { label="%s"; %s; }' % ( |
| 143 package, package, '; '.join(modules)), file=args.output) | 143 package, package, '; '.join(modules)), file=args.output) |
| 144 | 144 |
| 145 if args.recipe_filter and recipe_to_package: | 145 if args.recipe_filter and recipe_to_package: |
| 146 recipe_names = [ | 146 recipe_names = [ |
| 147 '"recipe %s"' % name for name in recipe_to_package.keys()] | 147 '"recipe %s"' % name for name in recipe_to_package.keys()] |
| 148 print(' subgraph "cluster_recipes" { label="recipes"; %s; }' % ( | 148 print(' subgraph "cluster_recipes" { label="recipes"; %s; }' % ( |
| 149 '; '.join(recipe_names)), file=args.output) | 149 '; '.join(recipe_names)), file=args.output) |
| 150 | 150 |
| 151 print(_GRAPH_FOOTER, file=args.output) | 151 print(_GRAPH_FOOTER, file=args.output) |
| OLD | NEW |