Revert "Artifacts service: add support for license_credits.html"
This reverts commit 2ffee8ae6a2f012f1868bc902abf3b23adffcf99.
Reason for revert: Breaks all CQ / snapshot builder.
https://ci.chromium.org/ui/p/chromeos/builders/cq/cave-cq/b8843043761431824992/overview
NotADirectoryError: [Errno 20] Not a directory: '/b/s/w/ir/x/w/recipe_cleanup/chromiumos_workspace/src/build/images/cave/latest/license_credits.html'
(shutil.copytree doesn't work for a single file.)
Original change's description:
> Artifacts service: add support for license_credits.html
>
> BUG=b:191479981
> TEST=unit tests (no coverage for relevant endpoint, though)
>
> Change-Id: Ibf03f934ebed4d6f1ca537b8b2f24e79233bf1bc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2972282
> Reviewed-by: Alex Klein <saklein@chromium.org>
> Reviewed-by: George Engelbrecht <engeg@google.com>
> Tested-by: Jack Neus <jackneus@google.com>
> Commit-Queue: Jack Neus <jackneus@google.com>
Bug: b:191479981
Change-Id: I0ef950cd2ab4fc36bc5931e59c207bacb2d7f3e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2994320
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/api/controller/image.py b/api/controller/image.py
index cb20b28..32012d9 100644
--- a/api/controller/image.py
+++ b/api/controller/image.py
@@ -7,7 +7,6 @@
The image related API endpoints should generally be found here.
"""
-import functools
import os
from chromite.api import controller
@@ -104,7 +103,7 @@
def GetArtifacts(in_proto: common_pb2.ArtifactsByService.Image,
chroot: chroot_lib.Chroot, sysroot_class: sysroot_lib.Sysroot,
- build_target: build_target_lib.BuildTarget, output_dir) -> list:
+ _build_target: build_target_lib.BuildTarget, output_dir) -> list:
"""Builds and copies images to specified output_dir.
Copies (after optionally bundling) all required images into the output_dir,
@@ -123,29 +122,21 @@
Returns:
A list of dictionary mappings of ArtifactType to list of paths.
"""
- base_path = chroot.full_path(sysroot_class.path)
- board = build_target.name
-
generated = []
- dlc_func = functools.partial(image.copy_dlc_image, base_path)
- license_func = functools.partial(image.copy_license_credits, board)
- artifact_types = {
- in_proto.ArtifactType.DLC_IMAGE: dlc_func,
- in_proto.ArtifactType.LICENSE_CREDITS: license_func,
- }
+ base_path = chroot.full_path(sysroot_class.path)
for output_artifact in in_proto.output_artifacts:
- for artifact_type, func in artifact_types.items():
- if artifact_type in output_artifact.artifact_types:
- result = func(output_dir)
- if result:
- generated.append({
- 'paths': [result] if isinstance(result, str) else result,
- 'type': artifact_type,
- })
-
+ if in_proto.ArtifactType.DLC_IMAGE in output_artifact.artifact_types:
+ # Handling DLC copying.
+ result_paths = image.copy_dlc_image(base_path, output_dir)
+ if result_paths:
+ generated.append({
+ 'paths': result_paths,
+ 'type': in_proto.ArtifactType.DLC_IMAGE,
+ })
return generated
+
def _CreateResponse(_input_proto, output_proto, _config):
"""Set output_proto success field on a successful Create response."""
output_proto.success = True