Add dependency licenses to about_os_credits.html

Golang binaries are static, but the dependency licenses are omitted by
the build process in most cases. Declaring the transitive licenses in
the ebuild convinces chromite to scan the package's source for license
files: since these projects vendor their dependencies, this means that
about_os_config.html will gain dependency licenses.

To make this work for cri-tools, this switches cri-tools-1.19.0 from
using a binary release to building from source.

BUG=b/144525623
TEST=cusky presubmit for lakitu and lakitu-arm64
RELEASE_NOTE=None

Change-Id: I05b6c30fd9c1d63ddac92176e0bc1b3ccc89ed41
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/21390
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
diff --git a/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6-r7.ebuild b/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6-r8.ebuild
similarity index 100%
rename from project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6-r7.ebuild
rename to project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6-r8.ebuild
diff --git a/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6.ebuild b/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6.ebuild
index 9bfced1..e3e10b5 100644
--- a/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6.ebuild
+++ b/project-lakitu/app-admin/node-problem-detector/node-problem-detector-0.8.6.ebuild
@@ -12,7 +12,18 @@
 
 SRC_URI="https://github.com/kubernetes/node-problem-detector/archive/${PV}.tar.gz -> ${P}.tar.gz"
 
-LICENSE="Apache-2.0"
+# This includes the licenses of dependencies as the binary is statically linked.
+#
+# If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for
+# copyright attribution. If the package vendors its dependencies or includes a
+# THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all
+# dependencies in about_os_credits.html.
+#
+# This list was determined by inspecting the output of:
+#   go-licenses csv k8s.io/node-problem-detector/cmd/nodeproblemdetector
+# inside a clone of the package repo.
+# https://github.com/google/go-licenses
+LICENSE="Apache-2.0 BSD-2 BSD ISC MIT"
 SLOT="0"
 KEYWORDS="*"
 IUSE=""
diff --git a/project-lakitu/app-emulation/containerd/containerd-1.5.3-r1.ebuild b/project-lakitu/app-emulation/containerd/containerd-1.5.3-r2.ebuild
similarity index 100%
rename from project-lakitu/app-emulation/containerd/containerd-1.5.3-r1.ebuild
rename to project-lakitu/app-emulation/containerd/containerd-1.5.3-r2.ebuild
diff --git a/project-lakitu/app-emulation/containerd/containerd-1.5.3.ebuild b/project-lakitu/app-emulation/containerd/containerd-1.5.3.ebuild
index 73ede13..342e75f 100644
--- a/project-lakitu/app-emulation/containerd/containerd-1.5.3.ebuild
+++ b/project-lakitu/app-emulation/containerd/containerd-1.5.3.ebuild
@@ -13,7 +13,23 @@
 HOMEPAGE="https://containerd.io/"
 SRC_URI="https://github.com/containerd/containerd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
 
-LICENSE="Apache-2.0"
+# This includes the licenses of dependencies as the binary is statically linked.
+#
+# If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for
+# copyright attribution. If the package vendors its dependencies or includes a
+# THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all
+# dependencies in about_os_credits.html.
+#
+# This list was determined by inspecting the output of:
+#   go-licenses csv github.com/containerd/containerd/cmd/containerd
+#   go-licenses csv github.com/containerd/containerd/cmd/ctr
+#   go-licenses csv github.com/containerd/containerd/cmd/containerd-shim
+#   go-licenses csv github.com/containerd/containerd/cmd/containerd-shim-runc-v1
+#   go-licenses csv github.com/containerd/containerd/cmd/containerd-shim-runc-v2
+#   go-licenses csv github.com/containerd/containerd/cmd/containerd-stress
+# inside a clone of the package repo.
+# https://github.com/google/go-licenses
+LICENSE="Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0"
 SLOT="0"
 KEYWORDS="*"
 IUSE="apparmor btrfs device-mapper +cri hardened +seccomp selinux test"
diff --git a/project-lakitu/app-emulation/cri-tools/Manifest b/project-lakitu/app-emulation/cri-tools/Manifest
index a5f43cb..2504690 100644
--- a/project-lakitu/app-emulation/cri-tools/Manifest
+++ b/project-lakitu/app-emulation/cri-tools/Manifest
@@ -1,3 +1,2 @@
+DIST cri-tools-1.19.0.tar.gz 5199409 BLAKE2B ac8dde307cd1c2817bb303c1676ec7d9136d76dd62d73646c60d9695084edb630bff103f431c505da3ff51398994e0dbd3f68812ca8c1717c2af1b4bbc80b6ec SHA512 835660af08a44f918c36fd4bbd24e94e0c6183ed21fa2a0497df0ba28a2c79473ed945c4842e2a93e195f11895aceca3c9b978b5a66f8f058a40d3b7808a1b43
 DIST crictl-v1.15.0-linux-amd64.tar.gz 12059084 BLAKE2B d2a06d4090d6934c2b17f622e96e5424358e1fbf3de60bd472ca7fa92b285b8b907a2db5f4a3b197e57145f813076fc5d1e80896a1fd7ddc01ffd7b88b1e5097 SHA512 4e73005ec6a0aa0e676252e78ab352733114aa036dc3287bef9e4a33054c4f1445a2007095fee217e74ced5c79b242d6653eade95db5bf8a6f8f029db24a0b5a
-DIST crictl-v1.19.0-linux-amd64.tar.gz 13287324 BLAKE2B 3686f291d52e706325bf656480e8f0e26592c0df2aff89bf65134325f306a367ca011954fe474529d7bc5789b99fc234ded3fd2d2178db7eebf6be0b9764c828 SHA512 fbbb34a1667bcf94df911a92ab6b70a9d2b34da967244a222f288bf0135c587cbfdcc89deedc5afd1823e109921df9caaa4e9ff9cc39e55a9b8cdea8eb6ebe72
-DIST crictl-v1.19.0-linux-arm64.tar.gz 12308069 BLAKE2B 0ce4e25d934526389c15ed18f73f71bf2521965dd26f458194ed1b79b593872e152411644b3dfa4805c7d5b80f4d8fddfa3bea810f1d2b0849ed3962e5801231 SHA512 779ff65a2906444ceddaccad2e66b39dbd744effd99d997d1acb310f3cf61afa71104dc73fb806087d66708ae94c738358be2fd2ec3205bdb3865ad0550bba38
diff --git a/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0-r3.ebuild b/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0-r4.ebuild
similarity index 100%
rename from project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0-r3.ebuild
rename to project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0-r4.ebuild
diff --git a/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0.ebuild b/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0.ebuild
index 8850eba..2e74d38 100644
--- a/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0.ebuild
+++ b/project-lakitu/app-emulation/cri-tools/cri-tools-1.19.0.ebuild
@@ -4,22 +4,33 @@
 
 EAPI=7
 
+inherit toolchain-funcs
+
 DESCRIPTION="CLI for container runtime interface (CRI)"
 HOMEPAGE="https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md"
-SRC_URI="
-amd64? ( https://github.com/kubernetes-incubator/cri-tools/releases/download/v${PV}/crictl-v${PV}-linux-amd64.tar.gz -> crictl-v${PV}-linux-amd64.tar.gz )
-arm64? ( https://github.com/kubernetes-incubator/cri-tools/releases/download/v${PV}/crictl-v${PV}-linux-arm64.tar.gz -> crictl-v${PV}-linux-arm64.tar.gz )
-"
+SRC_URI="https://github.com/kubernetes-sigs/cri-tools/archive/v${PV}.tar.gz -> ${P}.tar.gz"
 
-LICENSE="BSD-Google"
+# This includes the licenses of dependencies as the binary is statically linked.
+#
+# If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for
+# copyright attribution. If the package vendors its dependencies or includes a
+# THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all
+# dependencies in about_os_credits.html.
+#
+# This list was determined by inspecting the output of:
+#   go-licenses csv github.com/kubernetes-sigs/cri-tools/cmd/crictl
+# inside a clone of the package repo.
+# https://github.com/google/go-licenses
+LICENSE="Apache-2.0 BSD-2 BSD ISC MIT"
 SLOT="0"
 KEYWORDS="*"
 
-# Default S=${WORKDIR}/${PV} but tarball does not store the binaries in a ${PV} folder.
-S="${WORKDIR}"
+src_compile() {
+	emake GO="$(tc-getGO)" crictl
+}
 
 src_install() {
-	dobin crictl
+	dobin _output/crictl
 
 	insinto /etc
 	doins "${FILESDIR}"/crictl.yaml
diff --git a/project-lakitu/app-emulation/runc/runc-1.0.0.ebuild b/project-lakitu/app-emulation/runc/runc-1.0.0.ebuild
index 6343eb0..8dfbd46 100644
--- a/project-lakitu/app-emulation/runc/runc-1.0.0.ebuild
+++ b/project-lakitu/app-emulation/runc/runc-1.0.0.ebuild
@@ -15,6 +15,17 @@
 MY_PV="${PV/_/-}"
 SRC_URI="https://github.com/opencontainers/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
 
+# This includes the licenses of dependencies as the binary is statically linked.
+#
+# If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for
+# copyright attribution. If the package vendors its dependencies or includes a
+# THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all
+# dependencies in about_os_credits.html.
+#
+# This list was determined by inspecting the output of:
+#   go-licenses csv github.com/opencontainers/runc
+# inside a clone of the package repo.
+# https://github.com/google/go-licenses
 LICENSE="Apache-2.0 BSD-2 BSD MIT"
 SLOT="0"
 KEYWORDS="*"