FreeBSD custom port patches when using poudriere

I have a custom patch for Nagios. I use poudriere for building my FreeBSD ports.

EDIT: 2023-03-25 I have change the local for my patch files using a hook. See poudriere hooks – I am no longer using /usr/ports/distfiles/local-patches>; instead, I’m using /usr/local/etc/poudriere.d/local-patches.

How can I combine the two?

I asked that question on the FreeBSD Ports Mailing list.

The answer came via IRC, from bsd-x. He introduced me to the concept of EXTRA_PATCHES (documented here).

I added these entries to /usr/local/etc/poudriere.d/webserver-make.conf:

.if ${.CURDIR:M*/net-mgmt/nagios}
EXTRA_PATCHES+= /distfiles/local-patches/webserver/nagios.patch
.endif

Knowing that my distfiles directory used by poudriere is this one:

$ grep DIST /usr/local/etc/poudriere.conf
DISTFILES_CACHE=/usr/ports/distfiles

I placed the patch file at /usr/ports/distfiles/local-patches/webserver/nagios.patch

When slocum runs, this directory (/usr/ports/distfiles/ is mounted at /distfiles/, and that is how the entry in the configuration file above points to the patch.

When the port is built, I see this in the logs:

...
#### /usr/local/etc/poudriere.d/webserver-make.conf ####
.if ${.CURDIR:M*/net-mgmt/nagios}
EXTRA_PATCHES+= /distfiles/local-patches/webserver/nagios.patch
.endif
...
===>  Patching for nagios-3.5.1_5
===>  Applying extra patch /distfiles/local-patches/webserver/nagios.patch
===>  Applying FreeBSD patches for nagios-3.5.1_5
...

The port is patched. The fixes come through. Done.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

3 thoughts on “FreeBSD custom port patches when using poudriere”

  1. Since /distfiles/ is a cache directory therefore it can be cleared at any time and putting patches to place like /usr/ports/LocalPatches is not a good idea either (messes up portstree if using CVS’) I created a small patch for Poudriere (tested with 3.2-pre). It mounts config variable PATCH_DATA to the jail’s /patches, so one can use /patches/webserver/nagios.patch in make.conf.

    Code itself is in this gist https://gist.github.com/gynter/c414ec798bf81665a391

Leave a Comment

Scroll to Top