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

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.