build-extensions-container.sh: don't use context dir on 9p
It's generally safe to read over 9p but not write due to bugs.
Restructure so that the container build context directory isn't on 9p.
@@ -11,14 +11,11 @@ workdir=$PWD
builddir="${workdir}/builds/latest/${arch}"
ostree_ociarchive=$(ls "${builddir}"/*-ostree*.ociarchive)
-if [ ! -d "${workdir}/src/yumrepos" ]; then
- ctx_dir=${workdir}/src/config
-else
- ctx_dir="${workdir}/tmp/build-extensions-container"
- rm -rf "${ctx_dir}"
- cp -a "${workdir}/src/config" "${ctx_dir}"
+ctx_dir=$(mktemp -d -p /var/tmp)
+cp -aLT "${workdir}/src/config" "${ctx_dir}"
+
+if [ -d "${workdir}/src/yumrepos" ]; then
find "${workdir}/src/yumrepos/" -maxdepth 1 -type f -name '*.repo' -exec cp -t "${ctx_dir}" {} +
- cleanup_ctx_dir=1
fi
# Build the image, replacing the FROM directive with the local image we have
@@ -27,9 +24,5 @@ img=localhost/extensions-container
--build-arg COSA=true --label version="$buildid" \
-t "${img}" -f extensions/Dockerfile "${ctx_dir}")
-if [ -n "${cleanup_ctx_dir:-}" ]; then
- rm -rf "${ctx_dir}"
-fi
-
# Call skopeo to export it from the container storage to an oci-archive.
(set -x; skopeo copy "containers-storage:${img}" oci-archive:"$filename")
