Discover stored options different from port defaults/defines

John W. O'Brien john at
Sun Mar 30 21:13:25 UTC 2014

Hello ports@,

In the bad old days before poudriere and various improvements to
OptionsNG came to town, when I was using portmaster* to handle upgrades,
I cobbled together a configuration management practice that involved
using rsync and git to store /var/db/ports in a repository. The usual
workflow looked roughly like this:

    svn up /usr/ports
    portmaster -dga
    # handle changes to OPTIONS_DEFINE and its brethren here
    rsync -rpt --del --exclude distfiles /var/db/ports/ /path/to/repo
    cd /path/to/repo
    git commit -a -m "Store options that changed"

A downside of this approach is that it couldn't distinguish between
options I care about ("Always do this" and "Never do this") and options
I don't care about ("Do what the maintainer thinks is best"). The only
upstream changes that would bubble to the surface of their own accord

When I switched from portmaster to poudriere+pkgng, I migrated
/var/db/ports to /usr/local/etc/poudriere.d/$jail-$ports-$set-options
and that worked OK for a little while. However, this compounded the old
problem in that now even NEW_OPTIONS would arrive silently.

The first part of my solution to these problems is to store only the
options that I know I care about. That is, I know I need to find out
where a stored option disagrees with the default.

I couldn't figure out how to use the stock tools to peel apart currently
stored options from current default options, so I wrote a
``nondefaultconfig`` target for Mk/ (see attached), set all
the common options (DOCS, IPv6, etc) explicitly in /etc/make.conf using
OPTIONS_SET/OPTIONS_UNSET, and ran the new target against all of my
installed ports, replacing a subtree full of options files with a
single, quite modest make.conf. To make this more generally-useful, it
would need to behave more like NEW_OPTIONS.

   cd /usr/ports
   pkg info -aoq | sort | xargs -n1 make nondefaultconfig -C \
        >> /usr/local/etc/poudriere.d/$jail-make.conf
   rm -fr /usr/local/etc/poudriere.d/$jail-$ports-$set-options

At this point, any option not configured by $jail-make.conf will be
allowed to vary according to the whims of the maintainer. The next part
of the problem that I would like to solve is learning about options that
I don't yet know I care about (OPTIONS_DEFINE gains a member), and
secondarily to learn when an option is past caring (OPTIONS_DEFINE loses
a member that I used to care about), so that I can update
$jail-make.conf in an orderly fashion.

I welcome any comments on my approach so far, or suggestions about how I
might proceed.


* Made the bad old days less bad.
-------------- next part --------------
Index: Mk/
--- Mk/	(revision 349597)
+++ Mk/	(working copy)
@@ -6060,6 +6060,27 @@
 .endif # config-conditional
+.for opt in ${ALL_OPTIONS}
+.   if empty(OPTIONS_DEFAULT:M${opt}) && !empty(PORT_OPTIONS:M${opt}) && empty(OPTIONS_SET:M${opt})
+.   endif
+.   if !empty(OPTIONS_DEFAULT:M${opt}) && empty(PORT_OPTIONS:M${opt}) && empty(OPTIONS_UNSET:M${opt})
+.   endif
+.if !target(nondefaultconfig)
+.   endif
+.   endif
+.endif # nondefaultconfig
 .if !target(showconfig)
 .include "${PORTSDIR}/Mk/"
 MULTI_EOL=	: you have to choose at least one of them
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 535 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-ports mailing list