Jun 102014

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

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

$ grep DIST /usr/local/etc/poudriere.conf

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
===>  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 Responses to “FreeBSD custom port patches when using poudriere”

  1. This worked for me last night when I upgraded my webserver.

  2. 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

  3. See also hooks for mounting your patches into the master jail: https://gist.github.com/dlangille/924507ce545de8fbbe78b50b752997ce