Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add PATCH_DATA option for Poudriere.
--- common.sh 2016-08-31 00:08:24.892515000 +0300
+++ common.sh 2016-08-31 00:11:23.711315000 +0300
@@ -1323,6 +1323,15 @@
err 1 "Failed to mount the packages directory "
}
+mount_patches() {
+ local mnt
+
+ _my_path mnt
+ ${NULLMOUNT} "$@" ${PATCH_DATA} \
+ ${mnt}/patches ||
+ err 1 "Failed to mount the patches directory "
+}
+
do_portbuild_mounts() {
[ $# -lt 3 ] && eargs do_portbuild_mounts mnt jname ptname setname
local mnt=$1
@@ -1339,6 +1348,7 @@
"${mnt}/${LOCALBASE:-/usr/local}" \
"${mnt}/distfiles" \
"${mnt}/packages" \
+ "${mnt}/patches" \
"${mnt}/.npkg" \
"${mnt}/var/db/ports" \
"${mnt}${HOME}/.ccache"
@@ -1364,6 +1374,9 @@
${NULLMOUNT} -o ro ${portsdir} ${mnt}/usr/ports ||
err 1 "Failed to mount the ports directory "
mount_packages -o ro
+ if [ "${PATCH_DATA}" != "no" ]; then
+ mount_patches -o ro
+ fi
${NULLMOUNT} ${DISTFILES_CACHE} ${mnt}/distfiles ||
err 1 "Failed to mount the distfiles cache directory"
@@ -1768,6 +1781,11 @@
msg "Mounting ports/packages/distfiles"
mkdir -p ${PACKAGES}/
+
+ if [ "${PATCH_DATA}" != "no" -a ! -d "${PATCH_DATA}" ]; then
+ mkdir -p ${PATCH_DATA}/
+ fi
+
was_a_bulk_run && stash_packages
do_portbuild_mounts ${tomnt} ${name} ${ptname} ${setname}
@@ -4842,6 +4860,7 @@
: ${USE_FDESCFS:=yes}
: ${MUTABLE_BASE:=yes}
: ${USE_MASTERMNT_HASH:=no}
+: ${PATCH_DATA:=no}
# Be sure to update poudriere.conf to document the default when changing these
: ${MAX_EXECUTION_TIME:=86400} # 24 hours for 1 command
Owner

gynter commented Aug 17, 2015

The directory specified in PATCH_DATA will be mounted (read-only) using mount_nullfs to jail's /patches. Default is no which disables the feature. For more information about patching ports in Poudriere read http://dan.langille.org/2014/06/10/freebsd-custom-port-patches-when-using-poudriere/.

It's not good idea to use /distfiles/ because this is a cache directory and can be cleared at any time, therefore this patch produces a feature to mount completely different directory only for patches. If this patch fails then apply poudriere_01_use_mastermnt_hash.patch first or apply the patch by hand. File to patch is /usr/local/share/poudriere/common.sh.

Owner

gynter commented Aug 30, 2016

Updated according to current master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment