Subject: Re: fixing pkglint warnings
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-pkg
Date: 12/03/2005 12:07:38
On Fri, Dec 02, 2005 at 11:45:39PM +0100, Roland Illig wrote:
> ===> Forcing many variables to be modified using only "+="
> 
> The whole pkgsrc system would be much more understandable if we had only 
> variables that are modified using a very restricted set of operations. 
> The operations I have in mind are:
> 
>     "?="    default value assignment
>     "+="    appending to a list
>     "="     simple assignment (should happen only once per variable)
> 
> That way, if you add something to a list you can be sure that it doesn't 
> get removed later. Currently this is not guaranteed. Just have a look 
> for the various places where CONFIGURE_ARGS is modified using the ":=" 
> operator, which evaluates its right-hand-side and assigns it to its 
> left-hand-side. So let's say you have the following lines:
> 
>     CPPFLAGS+=         -DFOO=1
>     CONFIGURE_ARGS+=   CPPFLAGS=${CPPFLAGS:M*:Q}
>     CONFIGURE_ARGS:=   ${CONFIGURE_ARGS:N--with-ncurses}
>     CPPFLAGS+=         -I/usr/local/include
> 
> The last addition to CPPFLAGS won't make it into CONFIGURE_ARGS. Now 
> imagine that these four assignments are all in individual files, spread 
> around the whole pkgsrc tree. How do you find the cause that 
> "-I/usr/local/include" is not included in the CPPFLAGS passed to the 
> configure script?

You need to allow := (and maybe !=) in places where it is necessary
to get the RHS evaluated at that time, or only once.  But typically
the LHS of those needs to be a variable that is never set again, and
immediately used on the RHS of a += assignment.

	David

-- 
David Laight: david@l8s.co.uk