Skip to content

Instantly share code, notes, and snippets.

@gynter
Last active August 10, 2019 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gynter/c414ec798bf81665a391 to your computer and use it in GitHub Desktop.
Save gynter/c414ec798bf81665a391 to your computer and use it in GitHub Desktop.
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
@gynter
Copy link
Author

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.

@gynter
Copy link
Author

gynter commented Aug 30, 2016

Updated according to current master branch.

@gynter
Copy link
Author

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

@dlangille
Copy link

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