Re: Discover stored options different from port defaults/defines

2014-03-31 Thread John W. O'Brien
On 3/30/14 10:21 PM, Randy Pratt wrote:
 On Sun, 30 Mar 2014 17:13:15 -0400
 John W. O'Brien j...@saltant.com wrote:
 
 [blah blah blah]

[...]
 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/bsd.port.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

[...]
 
 I found this posting useful to find OPTIONS:
 
 http://docs.freebsd.org/cgi/mid.cgi?CAOjFWZ45ACYnaByYxxrGoyqTOeS7_EDV6MwoH98-GtDe-F3Yug
 
 The mailing list archives seem to be missing for the past month PR187557
 so here an excerpt from my notes:
 
 On 3/4/2014 9:40 AM, Thierry Thomas wrote:
 from within a port's directory,

 make showconfig

 will show you the current options set and

 make __MAKE_CONF=/dev/null PORT_DBDIR=/var/empty showconfig

 will show you the defaults.
 
 See make(1)'s -C option for specifying ports pathname.
 
 It shouldn't take too much to write a small script and find
 the diff in the output for each command.

Randy,

I like that this approach doesn't muck with /usr/ports/Mk/. I doubt I
would have discovered __MAKE_CONF on my own, but now that I know to look
for it, I see that it's covered early in make(1):

 First of all, the initial list of specifications will be read from
 the system makefile, sys.mk, unless inhibited with the -r option.
 The standard sys.mk as shipped with FreeBSD also handles
 make.conf(5), the default path to which can be altered via the
 make variable __MAKE_CONF.

-John



signature.asc
Description: OpenPGP digital signature


Re: Discover stored options different from port defaults/defines

2014-03-31 Thread Kevin Oberman
On Mon, Mar 31, 2014 at 7:47 AM, John W. O'Brien j...@saltant.com wrote:

 On 3/30/14 10:21 PM, Randy Pratt wrote:
  On Sun, 30 Mar 2014 17:13:15 -0400
  John W. O'Brien j...@saltant.com wrote:
 
  [blah blah blah]
 
 [...]
  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/bsd.port.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
 
 [...]
 
  I found this posting useful to find OPTIONS:
 
 
 http://docs.freebsd.org/cgi/mid.cgi?CAOjFWZ45ACYnaByYxxrGoyqTOeS7_EDV6MwoH98-GtDe-F3Yug
 
  The mailing list archives seem to be missing for the past month PR187557
  so here an excerpt from my notes:
 
  On 3/4/2014 9:40 AM, Thierry Thomas wrote:
  from within a port's directory,
 
  make showconfig
 
  will show you the current options set and
 
  make __MAKE_CONF=/dev/null PORT_DBDIR=/var/empty showconfig
 
  will show you the defaults.
 
  See make(1)'s -C option for specifying ports pathname.
 
  It shouldn't take too much to write a small script and find
  the diff in the output for each command.

 Randy,

 I like that this approach doesn't muck with /usr/ports/Mk/. I doubt I
 would have discovered __MAKE_CONF on my own, but now that I know to look
 for it, I see that it's covered early in make(1):

  First of all, the initial list of specifications will be read from
  the system makefile, sys.mk, unless inhibited with the -r option.
  The standard sys.mk as shipped with FreeBSD also handles
  make.conf(5), the default path to which can be altered via the
  make variable __MAKE_CONF.

 -John


This is something I've wanted to have for quite a while, but never enough
to dig through the Makefiles.

I think the proper way would be for make showconfig to print out the
current config as it does now, but to tag default options (e.g. '+') so
that it would be easy to note that some option that you never touched and
probably don't really even understand had had the default changed and you
probably want to match that change.

A 'pkg info' option to provide a list of changed defaults in installed
ports would be even nicer. Something equivalent to pkg version -vl\
perhaps. But just doing it in make showconfig would make a script that
would parse 'pkg version' optput and do a make showconfig, only printing
out the tagged lines, when any changes are noted would be trivial.
-- 
R. Kevin Oberman, Network Engineer, Retired
E-mail: rkober...@gmail.com
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Discover stored options different from port defaults/defines

2014-03-31 Thread John W. O'Brien
On 3/31/14 3:47 PM, Kevin Oberman wrote:
 This is something I've wanted to have for quite a while, but never
 enough to dig through the Makefiles.
 
 I think the proper way would be for make showconfig to print out the
 current config as it does now, but to tag default options (e.g. '+') so
 that it would be easy to note that some option that you never touched
 and probably don't really even understand had had the default changed
 and you probably want to match that change.

There are two dimensions, though, and the showconfig annotations you
describe captures just one of them.

1.  Is this option set the same as the default?
2.  Is this an option I care about pinning?

Your proposal addresses #1. I already solved this for myself in an
ad-hoc manner. I placed an additional requirement on my solution that it
generate machine-readable output. Incidentally, there was a compelling
thread a few months ago which briefly discussed [0] the possibility of
teaching core CLI tools to output structured data like XML, JSON, etc.
The ports machinery would be another great candidate for that kind of
capability.

Anyway, I used the information from #1 as hints about what I was
thinking about #2 at the time I originally configured the port. Then I
put ${OPTIONS_NAME}_SET=FOO and ${OPTIONS_NAME}_UNSET=BAR in make.conf
as a way to express and record #2.

For example:

devel_git_SET= GITWEB GUI
editors_vim_UNSET= RUBY

I can feed this, and little else, to poudriere and remain confident that
as long as devel/git knows about the options GITWEB and GUI, and
editors/vim knows about the option RUBY, I can update my ports tree and
rebuild my packages until the sun comes up and those options will remain
pinned.

 A 'pkg info' option to provide a list of changed defaults in installed
 ports would be even nicer. Something equivalent to pkg version -vl\
 perhaps. But just doing it in make showconfig would make a script that
 would parse 'pkg version' optput and do a make showconfig, only
 printing out the tagged lines, when any changes are noted would be trivial.

Would pkg-info be the place for this? It's looking at state data that
has no notion of history. pkg-info could show available options,
defaults, and built-with options, all as of build-time. It would be up
to pkg-upgrade to send up a flare, on request, if these sets changed
from the currently-installed package to the about-to-be-installed package.

I would also be interested in an equivalent a poudriere feature, because
it's at the moment I update a ports tree in preparation for building new
packages that I want to know if a port I build just grew a new option
that I might want to pin per #2.

Regards,
John

[0]
http://lists.freebsd.org/pipermail/freebsd-stable/2013-December/076205.html



signature.asc
Description: OpenPGP digital signature


Discover stored options different from port defaults/defines

2014-03-30 Thread John W. O'Brien
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
were NEW_OPTIONS when OPTIONS_DEFINE changed.

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/bsd.port.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.

Regards,
John

* Made the bad old days less bad.
Index: Mk/bsd.port.mk
===
--- Mk/bsd.port.mk  (revision 349597)
+++ Mk/bsd.port.mk  (working copy)
@@ -6060,6 +6060,27 @@
 .endif
 .endif # config-conditional
 
+NONDEFAULT_OPTIONS_SET=
+NONDEFAULT_OPTIONS_UNSET=
+.for opt in ${ALL_OPTIONS}
+.   if empty(OPTIONS_DEFAULT:M${opt})  !empty(PORT_OPTIONS:M${opt})  
empty(OPTIONS_SET:M${opt})
+NONDEFAULT_OPTIONS_SET+=${opt}
+.   endif
+.   if !empty(OPTIONS_DEFAULT:M${opt})  empty(PORT_OPTIONS:M${opt})  
empty(OPTIONS_UNSET:M${opt})
+NONDEFAULT_OPTIONS_UNSET+=${opt}
+.   endif
+.endfor
+
+.if !target(nondefaultconfig)
+nondefaultconfig:
+.   if !empty(NONDEFAULT_OPTIONS_SET)
+   @${ECHO_MSG} ${OPTIONS_NAME}_SET=  ${NONDEFAULT_OPTIONS_SET}
+.   endif
+.   if !empty(NONDEFAULT_OPTIONS_UNSET)
+   @${ECHO_MSG} ${OPTIONS_NAME}_UNSET=${NONDEFAULT_OPTIONS_UNSET}
+.   endif
+.endif # nondefaultconfig
+
 .if !target(showconfig)
 .include ${PORTSDIR}/Mk/bsd.options.desc.mk
 MULTI_EOL= : you have to choose at least one of them


signature.asc
Description: OpenPGP digital signature


Re: Discover stored options different from port defaults/defines

2014-03-30 Thread Randy Pratt
On Sun, 30 Mar 2014 17:13:15 -0400
John W. O'Brien j...@saltant.com wrote:

 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
 were NEW_OPTIONS when OPTIONS_DEFINE changed.
 
 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/bsd.port.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.

I found this posting useful to find OPTIONS:

http://docs.freebsd.org/cgi/mid.cgi?CAOjFWZ45ACYnaByYxxrGoyqTOeS7_EDV6MwoH98-GtDe-F3Yug

The mailing list archives seem to be missing for the past month PR187557
so here an excerpt from my notes:

 On 3/4/2014 9:40 AM, Thierry Thomas wrote:
 from within a port's directory,

 make showconfig

 will show you the current options set and

 make __MAKE_CONF=/dev/null PORT_DBDIR=/var/empty showconfig

 will show you the defaults.

See make(1)'s -C option for specifying ports pathname.

It shouldn't take too much to write a small script and find
the diff in the output for each command.

HTH,

Randy
  


___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org