Subject: Re: CVS commit: pkgsrc/pkgtools/pkglint
To: None <reed@netbsd.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 02/24/2006 22:55:48
Jeremy C. Reed wrote:
> Module Name:	pkgsrc
> Committed By:	reed
> Date:		Fri Feb 24 20:36:29 UTC 2006
> 
> Modified Files:
> 	pkgsrc/pkgtools/pkglint: Makefile
> 
> Log Message:
> PKGMANDIR instead of "man".
> 
> (When do I use PKGMANDIR:Q or no :Q??)

When pkglint says so. And if it doesn't complain, try pkglint -Wall :)

And these are the cases in which pkglint expects the :Q operator:

When you append a string to a list, which is explained very briefly in 
http://netbsd.org/Documentation/pkgsrc/makefile.html#adding-to-list

When you use a _string_ in a shell command, which is explained in 
http://netbsd.org/Documentation/pkgsrc/makefile.html#passing-variable-to-shell

When you use a _list_ in a shell command, it depends. If the list is 
used as a single word, you need to use the :Q operator, otherwise you 
don't. Example:

     ${CC} ${CPPFLAGS} ${CFLAGS}
     ${SETENV} CPPFLAGS=${CPPFLAGS:Q} CFLAGS=${CFLAGS:Q} ./configure

In the first line, the variables are interpreted in list context, 
meaning that they may result in more than one word, or even no words at 
all. In the second line the same variables are used in scalar context, 
which will lead to a single shell word.

There is one exception though: The empty string evaluates to the empty 
string when passed through the :Q operator. That is, the code

     EMPTY=          # empty

     all:
         set -- foo bar ${EMPTY:Q} ; echo $$#

will print "2", although you might expect it to print "3".

Roland