Add packages handling to builds call / GetBuildDependency.

Add optional packages contraint in the builds call and
GetBuildDependency call along with routing from the controller to enable
checking the dependency graph in the case of only building a limited
number of packages. See the attached bug for motivation.

TEST=./run_tests
BUG=chromium:1011436

Change-Id: I970e39c2f6dfb0ebb4470f35a5fe65062835881b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1848192
Tested-by: David Burger <dburger@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/packages.py b/api/controller/packages.py
index d0b06e5..04f87bf 100644
--- a/api/controller/packages.py
+++ b/api/controller/packages.py
@@ -141,5 +141,6 @@
 def BuildsChrome(input_proto, output_proto, _config):
   """Check if the board builds chrome."""
   build_target = controller_util.ParseBuildTarget(input_proto.build_target)
-  builds_chrome = packages.builds(constants.CHROME_CP, build_target)
+  cpvs = [controller_util.PackageInfoToCPV(pi) for pi in input_proto.packages]
+  builds_chrome = packages.builds(constants.CHROME_CP, build_target, cpvs)
   output_proto.builds_chrome = builds_chrome