Reland "Build API: Refactor service/lib and commands.py to use artifacts.BundleFirmware"
This reverts commit 568ec138fbbc3d967f8bf934b13007ad728bd1dd to reland
the BUILD API refactor but now directly calls the service rather than calling
the Build API -- this avoids tip of tree code trying to execute old code via
Build API invocation. This change also takes advantage of the @validate
library.
Reason for revert: Reland refactor in a way that avoids breaking legacy
builder.
BUG=chromium:954300
TEST=manual, run_tests
Original change's description:
> Revert "Build API: Refactor service/lib and commands.py to use artifacts.BundleFirmware"
>
> BUG=b:136134313
> TEST=manual, run_tests
>
> This reverts commit 3df9c76a49990d758076452ea8aef60da7916085.
>
> Reason for revert: Causing failures for atlas (b/136134313)
>
> Original change's description:
> > Build API: Refactor service/lib and commands.py to use artifacts.BundleFirmware
> >
> > BUG=chromium:954300
> > TEST=manual, run_tests
> >
> > Change-Id: I50d45449ed775cd8a1fc563f678a4f773a7cbd98
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1667502
> > Tested-by: Michael Mortensen <mmortensen@google.com>
> > Reviewed-by: Andrew Lamb <andrewlamb@chromium.org>
> > Reviewed-by: Alex Klein <saklein@chromium.org>
> > Commit-Queue: Michael Mortensen <mmortensen@google.com>
>
> Bug: chromium:954300
> Change-Id: I8fde3807bf6fff767d90d11739cf01db47d5503b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1680449
> Reviewed-by: Alex Klein <saklein@chromium.org>
> Reviewed-by: David Burger <dburger@chromium.org>
> Commit-Queue: Alex Klein <saklein@chromium.org>
> Commit-Queue: Michael Mortensen <mmortensen@google.com>
> Tested-by: Michael Mortensen <mmortensen@google.com>
Bug: b:136134313, chromium:954300
Change-Id: I980a4a38340ff4ebb36f1cbc29567cd9895ba0c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1681002
Tested-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Andrew Lamb <andrewlamb@chromium.org>
Commit-Queue: Michael Mortensen <mmortensen@google.com>
diff --git a/api/controller/artifacts.py b/api/controller/artifacts.py
index d7c2b64..6b49ba3 100644
--- a/api/controller/artifacts.py
+++ b/api/controller/artifacts.py
@@ -206,6 +206,7 @@
pinned_image.uri = pin.uri
+@validate.require('output_dir', 'sysroot.path')
def BundleFirmware(input_proto, output_proto):
"""Tar the firmware images for a build target.
@@ -213,16 +214,16 @@
input_proto (BundleRequest): The input proto.
output_proto (BundleResponse): The output proto.
"""
- target = input_proto.build_target.name
output_dir = input_proto.output_dir
- build_root = constants.SOURCE_ROOT
-
- # TODO(crbug.com/954300): Replace with a chromite/service implementation.
- archive = commands.BuildFirmwareArchive(build_root, target, output_dir)
+ chroot = controller_util.ParseChroot(input_proto.chroot)
+ sysroot_path = input_proto.sysroot.path
+ sysroot = sysroot_lib.Sysroot(sysroot_path)
+ archive = artifacts.BuildFirmwareArchive(chroot, sysroot, output_dir)
if archive is None:
cros_build_lib.Die(
- 'Could not create firmware archive. No firmware found for %s.', target)
+ 'Could not create firmware archive. No firmware found for %s.',
+ sysroot_path)
output_proto.artifacts.add().path = os.path.join(output_dir, archive)