Subject: Re: pkgsrc escaping newlines
To: Roland Illig <rillig@NetBSD.org>
From: Geert Hendrickx <ghen@telenet.be>
List: tech-pkg
Date: 12/12/2005 10:53:01
On Sat, Dec 03, 2005 at 12:07:26PM +0100, Roland Illig wrote:
> Geert Hendrickx wrote:
> >I don't know what others think of this, but I find the following
> >construction ugly and somewhat tedious to edit: 
> >
> >CONFIGURE_ARGS+=	--something \
> >			--something-else \
> >			--and-also-this
> >
> >I much prefer this: 
> >
> >CONFIGURE_ARGS+=	--something
> >CONFIGURE_ARGS+=	--something-else
> >CONFIGURE_ARGS+=	--and-also-this
> >
> >Although the former is very often seen in pkgsrc (also with MASTER_SITES
> >and other variables).  Is there a pkgsrc policy preferring either one
> >over the other?  If so, could a pkglint check be written for this,
> >suggesting the use of += instead of escaping newlines?  
> 
> Of course it could, and this would take me only 30 minutes, including a
> test run. The main question is what the other pkgsrc developers think on
> this issue. I have absolutely no problem with it. A nastier example would
> be:
> 
> > CONFIGURE_ARGS+=	--something \
> > 			--something-else -x \
> > 			--and-also-this
> 
> Note the hidden "-x" in line 2. I have found those things to be currently
> in use in pkgsrc.

One example of "tedious to edit" is the following; say you want to comment
out one value of CONFIGURE_ARGS.  We start with: 

CONFIGURE_ARGS+=	--something \
			--something-else
			--and-also-this

% make -V CONFIGURE_ARGS
--something  --something-else  --and-also-this

And want to (temporarily) remove --something-else by commenting it out: 

CONFIGURE_ARGS+=	--something \
#			--something-else \
			--and-also-this

% make -V CONFIGURE_ARGS
--something

The rest of the "line" is commented out, including also the value(s) coming
after the one you wanted to comment out.  In this regard, the above
construction is completely equivalent to: 

CONFIGURE_ARGS+=	--something --something-else --and-also-this

So we don't really gain anything by splitting lines with escaped newlines.
I'd vote for a "add one value per (functional) line" policy: 

CONFIGURE_ARGS+=	--something
#CONFIGURE_ARGS+=	--something-else
CONFIGURE_ARGS+=	--and-also-this

Which is much easier to manipulate (comment out, copy/paste, move around).  

Any thoughts?  

	Geert

	Geert