Subject: Re: identify packages that were custom built?
To: None <tech-pkg@NetBSD.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 09/19/2007 14:16:46
Dieter Baron wrote:
> In article <Pine.NEB.4.64.0709191056490.28954@glacier.reedmedia.net> Jeremy wrote:
> : On Wed, 19 Sep 2007, Jeremy C. Reed wrote:
> 
> : > Maybe that could be set if PKG_SUGGESTED_OPTIONS doesn't match 
> : > PKG_OPTIONS, but that may be hard if things are in different order.
> 
>   make can sort lists, so this should be rather easy.  I would,
> however, not encode this into the binary package, but let the tool do
> the test.  PKG_SUGGESTED_OPTIONS can be included in binary packages
> (and pkg_summary) if you want.
> 
> : Or maybe check the variable defined by PKG_OPTIONS_VAR is 
> : defined?
> 
> : Untested:
> 
> : .if defined(PKG_OPTIONS_VAR) && defined(${PKG_OPTIONS_VAR})
> : CUSTOM=true
> : BUILD_DEFS+=    CUSTOM
> : .endif
> 
>   This does not take into account PKG_DEFAULT_OPTIONS, let alone
> non-options variables that change the build.

It would be nice if a "make update" or "make replace" would try to grab 
the PKG_OPTIONS of the currently installed package and use those as the 
package options for the new build.

I guess putting something like this at the end of bsd.options.mk would 
suffice:

	.if defined(PKG_OPTIONS_OVERRIDE)
	PKG_OPTIONS=	${PKG_OPTIONS_OVERRIDE}
	.endif

Then you could do:

	cd pkgsrc/net/samba
	make build PKG_OPTIONS_OVERRIDE=`pkg_info -Q PKG_OPTIONS samba`

And possibly make the "update" and "replace" targets automatically set 
PKG_OPTIONS_OVERRIDE in the same manner.

	Cheers,

	-- Johnny Lam