chromite/api: stop read/write to the depgraph output file
BUG=chromium:957707
TEST=run `./bin/build_api chromite.api.DependencyService/GetBuildDependencyGraph --input-json=input.json --output-json=output.json` and verifies output.json file contains the depgraph data directly.
Change-Id: I5e1c505226b40ac57d6301303cdb4b5e084bfeb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1597128
Commit-Queue: Ned Nguyen <nednguyen@google.com>
Tested-by: Ned Nguyen <nednguyen@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
diff --git a/api/controller/board_build_dependency.py b/api/controller/board_build_dependency.py
index 3317d54..ee2c2ba 100644
--- a/api/controller/board_build_dependency.py
+++ b/api/controller/board_build_dependency.py
@@ -14,8 +14,6 @@
from chromite.lib import portage_util
from chromite.service import dependency
-from google.protobuf import json_format
-
def AugmentDepGraphProtoFromJsonMap(json_map, graph):
"""Augment package deps from |json_map| to graph object.
@@ -48,6 +46,7 @@
source_path = package_dep_info.dependency_source_paths.add()
source_path.path = path
+
def GetBuildDependencyGraph(input_proto, output_proto):
"""Create the build dependency graph.
@@ -56,18 +55,8 @@
output_proto (GetBuildDependencyGraphResponse): The empty output message.
"""
board = input_proto.build_target.name
- output_path = input_proto.output_path
assert board, 'Missing build target name'
- assert output_path, 'Missing output file'
-
json_map = dependency.GetBuildDependency(board)
AugmentDepGraphProtoFromJsonMap(json_map, output_proto.dep_graph)
-
- with open(output_path, 'w') as f:
- f.write(
- json_format.MessageToJson(output_proto.dep_graph,
- including_default_value_fields=True))
-
- output_proto.build_dependency_graph_file = output_path