sysroot_controller: Ignore package versions in InstallPackages.
The version is included from the depgraph, but we don't use it for
install packages. Ignore the version when it exists.
BUG=chromium:1124093
TEST=./run_tests
Change-Id: Ib1cca7f406968eb5d11c35d0586512556fe70397
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2392045
Commit-Queue: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Navil Perez <navil@google.com>
diff --git a/api/controller/sysroot.py b/api/controller/sysroot.py
index d632f06..c55e757 100644
--- a/api/controller/sysroot.py
+++ b/api/controller/sysroot.py
@@ -162,8 +162,15 @@
target_sysroot = sysroot_lib.Sysroot(input_proto.sysroot.path)
build_target = controller_util.ParseBuildTarget(
input_proto.sysroot.build_target)
- packages = [controller_util.PackageInfoToString(x)
+
+ # Get the package atom for each specified package. The field is optional, so
+ # error only when we cannot parse an atom for each of the given packages.
+ packages = [controller_util.PackageInfoToCPV(x).cp
for x in input_proto.packages]
+ if input_proto.packages and not all(packages):
+ cros_build_lib.Die(
+ 'Invalid package(s) specified. Unable to parse atom from all packages.')
+
package_indexes = [
binpkg.PackageIndexInfo.from_protobuf(x)
for x in input_proto.package_indexes