Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add PATCH_DATA option for Poudriere.
--- common.sh 2017-11-22 17:11:41.079851000 +0200
+++ common.sh 2017-11-22 17:16:38.908693000 +0200
@@ -1703,6 +1703,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
@@ -1719,6 +1728,7 @@
"${mnt}/${LOCALBASE:-/usr/local}" \
"${mnt}/distfiles" \
"${mnt}/packages" \
+ "${mnt}/patches" \
"${mnt}/.npkg" \
"${mnt}/var/db/ports" \
"${mnt}${HOME}/.ccache"
@@ -1744,6 +1754,11 @@
${NULLMOUNT} -o ro ${portsdir} ${mnt}${PORTSDIR} ||
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"
@@ -2374,6 +2389,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}
@@ -7358,6 +7378,7 @@
: ${HTML_JSON_UPDATE_INTERVAL:=2}
: ${HTML_TRACK_REMAINING:=no}
: ${FORCE_MOUNT_HASH:=no}
+: ${PATCH_DATA:=no}
DRY_RUN=0
# Be sure to update poudriere.conf to document the default when changing these
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_fix_force_mount_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.

Owner

gynter commented Nov 22, 2017

Updated according to current master branch. Requires a previously applied patch from here: https://gist.github.com/gynter/86ed7a6cae20927d6ef0#gistcomment-2265897

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