diff options
-rw-r--r-- | src/etc/poudriere.conf.sample | 9 | ||||
-rwxr-xr-x | src/share/poudriere/common.sh | 36 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/etc/poudriere.conf.sample b/src/etc/poudriere.conf.sample index 71b5b897..f6020fb3 100644 --- a/src/etc/poudriere.conf.sample +++ b/src/etc/poudriere.conf.sample @@ -62,6 +62,15 @@ USE_TMPFS=yes # (default: none) #TMPFS_LIMIT=8 +# List of package globs that are not allowed to use tmpfs for their WRKDIR +# Note that you *must* set TMPFS_BLACKLIST_TMPDIR +# EXAMPLE: TMPFS_BLACKLIST="rust" + +# The host path where tmpfs-blacklisted packages can be built in. +# A temporary directory will be generated here and be null-mounted as the +# WRKDIR for any packages listed in TMPFS_BLACKLIST. +# EXAMPLE: TMPFS_BLACKLIST_TMPDIR=${BASEFS}/data/cache/tmp + # How much memory to limit jail processes to for *each builder* # in GiB (default: none) #MAX_MEMORY=8 diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index 517c3c11..0570e940 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -4633,6 +4633,16 @@ stop_builders() { parallel_run stop_builder "${j}" done parallel_stop + + if [ -n "${TMPFS_BLACKLIST_TMPDIR-}" ] && + [ -d "${TMPFS_BLACKLIST_TMPDIR}/wrkdirs" ]; then + if ! rm -rf "${TMPFS_BLACKLIST_TMPDIR}/wrkdirs/"*; then + chflags -R 0 \ + "${TMPFS_BLACKLIST_TMPDIR}/wkrdirs"/* || : + rm -rf "${TMPFS_BLACKLIST_TMPDIR}/wrkdirs"/* || + : + fi + fi fi # No builders running, unset JOBS @@ -5006,6 +5016,7 @@ build_pkg() { local log local errortype local ret=0 + local tmpfs_blacklist_dir local elapsed now pkgname_varname jpkg originspec _my_path mnt @@ -5052,11 +5063,30 @@ build_pkg() { :> "${mnt}/${LOCALBASE:-/usr/local}/.mounted" fi + if [ -f "${mnt}/.tmpfs_blacklist_dir" ]; then + umount "${mnt}/wrkdirs" + rm -rf $(cat "${mnt}/.tmpfs_blacklist_dir") + fi [ -f ${mnt}/.need_rollback ] && rollbackfs prepkg ${mnt} [ -f ${mnt}/.need_rollback ] && \ err 1 "Failed to rollback ${mnt} to prepkg" :> ${mnt}/.need_rollback + for jpkg in ${TMPFS_BLACKLIST-}; do + case "${pkgname%-*}" in + ${jpkg}) + mkdir -p "${TMPFS_BLACKLIST_TMPDIR:?}/wrkdirs" + tmpfs_blacklist_dir=$(\ + TMPDIR="${TMPFS_BLACKLIST_TMPDIR:?}/wrkdirs" \ + mktemp -dt "${pkgname}") + ${NULLMOUNT} "${tmpfs_blacklist_dir}" "${mnt}/wrkdirs" + echo "${tmpfs_blacklist_dir}" \ + > "${mnt}/.tmpfs_blacklist_dir" + break + ;; + esac + done + rm -rfx ${mnt}/wrkdirs/* || : log_start "${pkgname}" 0 @@ -5135,6 +5165,12 @@ build_pkg() { -DNOCLEANDEPENDS clean ${MAKE_ARGS} || : rm -rfx ${mnt}/wrkdirs/* || : + if [ -n "${tmpfs_blacklist_dir}" ]; then + umount "${mnt}/wrkdirs" + rm -f "${mnt}/.tmpfs_blacklist_dir" + rm -rf "${tmpfs_blacklist_dir}" + fi + clean_pool "${pkgname}" "${originspec}" "${clean_rdepends}" stop_build "${pkgname}" "${originspec}" ${build_failed} |