Spdk/docker/build_base/pre-install
Karol Latecki e8a40ada16 docker: make sure root owns spdk repo directory
Make sure copied SPDK repository is fully owned by
root user when performing the image build.
This is to avoid git "safe.directory" feature
from compalining.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I4ead2dd23198f79707b240c1c7e7470a68980d85
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14156
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-15 20:12:48 +00:00

46 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
spdk_repo=$(mktemp -dt "spdk.XXXXXX")
spdk_tar=/spdk.tar.gz
cleanup() {
rm -f "$HOME/rpmbuild/rpm/x86_64/"*.rpm
rm -f "$spdk_tar"
rm -rf "$spdk_repo"
}
trap 'cleanup' EXIT
if [[ ! -e $spdk_tar ]]; then
printf 'Missing %s\n' "$spdk_tar" >&2
exit 1
fi
tar -C "$spdk_repo" -xf "$spdk_tar"
chown -R root:root "$spdk_repo"
# Required for building RPM
dnf install -y rpm-build
# Spice it a bit with supported sources
"$spdk_repo/scripts/pkgdep.sh" -d
"$spdk_repo/test/common/config/vm_setup.sh" --test-conf=fio
# HACK: In case we received a .tar with built SPDK we need to overwrite the
# configuration to update all the paths make would need to lookup - this is
# needed since we execute inside a different mount namespace so we won't be
# able to find any absolute paths that were used prior creating the .tar.
"$spdk_repo/configure" > /dev/null
# Deploy SPDK inside the container
DEPS="no" "$spdk_repo/rpmbuild/rpm.sh" \
--with-shared \
--with-virtio \
--with-fio
mv "$HOME/rpmbuild/rpm/x86_64/"*.rpm /tmp
mv "/usr/src/fio/fio" /tmp
dnf clean all