diff --git a/release/release.sh b/release/release.sh --- a/release/release.sh +++ b/release/release.sh @@ -309,6 +309,41 @@ done fi + _gtarcmd="$(which gtar)" + if [ ! -z "${WITH_OCIIMAGES}" -a -z "${_gtarcmd}" ]; then + # We use gtar for building container image layers due to an + # incompatiblity issue with bsdtar + # (https://github.com/containers/podman/issues/25270) + if [ -d ${CHROOTDIR}/usr/ports ]; then + # Trick the ports 'run-autotools-fixup' target to do the right + # thing. + _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) + REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) + BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) + UNAME_r=${REVISION}-${BRANCH} + GITUNSETOPTS="CONTRIB CURL CVS GITWEB GUI HTMLDOCS" + GITUNSETOPTS="${GITUNSETOPTS} ICONV NLS P4 PERL" + GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN" + GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2" + PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" + PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" + PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" + PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports" + PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles" + eval chroot ${CHROOTDIR} env OPTIONS_UNSET=\"${GITUNSETOPTS}\" \ + ${PBUILD_FLAGS} \ + make -C /usr/ports/archivers/gtar FORCE_PKG_REGISTER=1 \ + WRKDIRPREFIX=/tmp/ports \ + DISTDIR=/tmp/distfiles \ + install clean distclean + else + eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ + pkg install -y archivers/gtar + eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ + pkg clean -y + fi + fi + buildenv_setup return 0 diff --git a/release/scripts/make-oci-image.sh b/release/scripts/make-oci-image.sh --- a/release/scripts/make-oci-image.sh +++ b/release/scripts/make-oci-image.sh @@ -95,8 +95,13 @@ local image=$1; shift local output=$1; shift - # Note: the diff_id (needed for image config) is the hash of the uncompressed tar - tar -C ${workdir}/rootfs --strip-components 1 -cf ${workdir}/rootfs.tar . + # Note: the diff_id (needed for image config) is the hash of the + # uncompressed tar. + # + # We use gtar for building container image layers due to an + # incompatiblity issue with bsdtar + # (https://github.com/containers/podman/issues/25270) + gtar -C ${workdir}/rootfs --strip-components 1 -cf ${workdir}/rootfs.tar . local diff_id=$(sha256 -q < ${workdir}/rootfs.tar) gzip -f ${workdir}/rootfs.tar local create_time=$(date -u +%Y-%m-%dT%TZ)