packaging: coco-guest-components: Pass DESTDIR to the build script

As DESTDIR was not being passed, we've been installing the final
binaries in a container path that was not exposed to the host, leading
to creating an empty tarball with the guest components.

Now, theoretically, guest-components should respect a PREFIX passed, but
that's not the case and we're manually adding "/usr/local/bin" to the
passed DESTDIR.

Here's the result of the tarball:
```bash
⋊> kata-containers ≡ tar tf build/kata-static-coco-guest-components.tar.xz
./
./usr/
./usr/local/
./usr/local/bin/
./usr/local/bin/confidential-data-hub
./usr/local/bin/attestation-agent
./usr/local/bin/api-server-rest
```

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio
2024-02-05 14:03:26 +01:00
parent 1362918ff0
commit 64d09874c3
3 changed files with 6 additions and 3 deletions

View File

@@ -818,7 +818,7 @@ install_coco_guest_components() {
&& return 0 && return 0
info "build static coco-guest-components" info "build static coco-guest-components"
"${coco_guest_components_builder}" DESTDIR="${destdir}" "${coco_guest_components_builder}"
} }
install_tools_helper() { install_tools_helper() {

View File

@@ -52,11 +52,11 @@ build_coco_guest_components_from_source() {
git fetch --depth=1 origin "${coco_guest_components_version}" git fetch --depth=1 origin "${coco_guest_components_version}"
git checkout FETCH_HEAD git checkout FETCH_HEAD
TEE_PLATFORM=${TEE_PLATFORM} make build DESTDIR="${DESTDIR}/usr/local/bin" TEE_PLATFORM=${TEE_PLATFORM} make build
strip target/${rust_arch}-unknown-linux-${LIBC}/release/confidential-data-hub strip target/${rust_arch}-unknown-linux-${LIBC}/release/confidential-data-hub
strip target/${rust_arch}-unknown-linux-${LIBC}/release/attestation-agent strip target/${rust_arch}-unknown-linux-${LIBC}/release/attestation-agent
strip target/${rust_arch}-unknown-linux-${LIBC}/release/api-server-rest strip target/${rust_arch}-unknown-linux-${LIBC}/release/api-server-rest
TEE_PLATFORM=${TEE_PLATFORM} make install DESTDIR="${DESTDIR}/usr/local/bin" TEE_PLATFORM=${TEE_PLATFORM} make install
popd popd
} }

View File

@@ -13,6 +13,8 @@ readonly coco_guest_components_builder="${script_dir}/build-static-coco-guest-co
source "${script_dir}/../../scripts/lib.sh" source "${script_dir}/../../scripts/lib.sh"
DESTDIR=${DESTDIR:-${PWD}}
coco_guest_components_repo="${coco_guest_components_repo:-}" coco_guest_components_repo="${coco_guest_components_repo:-}"
coco_guest_components_version="${coco_guest_components_version:-}" coco_guest_components_version="${coco_guest_components_version:-}"
coco_guest_components_toolchain="${coco_guest_components_toolchain:-}" coco_guest_components_toolchain="${coco_guest_components_toolchain:-}"
@@ -38,6 +40,7 @@ sudo docker pull ${container_image} || \
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
-w "${PWD}" \ -w "${PWD}" \
--env DESTDIR="${DESTDIR}" \
--env TEE_PLATFORM=${TEE_PLATFORM:-all} \ --env TEE_PLATFORM=${TEE_PLATFORM:-all} \
--env coco_guest_components_repo="${coco_guest_components_repo}" \ --env coco_guest_components_repo="${coco_guest_components_repo}" \
--env coco_guest_components_version="${coco_guest_components_version}" \ --env coco_guest_components_version="${coco_guest_components_version}" \