From infofarmer@gmail.com  Sun Jan 22 00:58:05 2006
Return-Path: <infofarmer@gmail.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0934D16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Jan 2006 00:58:05 +0000 (GMT)
	(envelope-from infofarmer@gmail.com)
Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.202])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 328E843D5F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 Jan 2006 00:58:03 +0000 (GMT)
	(envelope-from infofarmer@gmail.com)
Received: by uproxy.gmail.com with SMTP id j3so297753ugf
        for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Jan 2006 16:58:02 -0800 (PST)
Received: by 10.66.248.7 with SMTP id v7mr1573159ugh;
        Sat, 21 Jan 2006 16:58:02 -0800 (PST)
Received: from localhost ( [85.141.135.86])
        by mx.gmail.com with ESMTP id q40sm2734994ugc.2006.01.21.16.58.01;
        Sat, 21 Jan 2006 16:58:02 -0800 (PST)
Message-Id: <43d2d89a.2413a822.1857.fffff737@mx.gmail.com>
Date: Sat, 21 Jan 2006 16:58:02 -0800 (PST)
From: infofarmer@gmail.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         92123
>Category:       ports
>Synopsis:       [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 22 01:00:16 GMT 2006
>Closed-Date:    Fri May 25 03:22:00 GMT 2007
>Last-Modified:  Fri May 25 03:22:00 GMT 2007
>Originator:     Andrew Pantyukhin
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD sat64.net17 6.0-STABLE FreeBSD 6.0-STABLE #4: Fri Jan 20 02:24:10 MSK 2006 sat@sat64.net17:/usr/obj/usr/src/sys/SATCUR32 i386


	
>Description:
Implement two autoexpanding variables: PLIST_SUBX and SUBX_LIST

Tired of PLIST_SUB=LONG_NAME=${LONG_NAME} VERY_LONG_NAME=${VERY_LONG_NAME} ...
copy-paste jobs? Meet the SUBX variables. Just write:
PLIST_SUBX=LONG_NAME VERY_LONG_NAME
and the expanded pairs will be added to PLIST_SUB.

This idea in one form or another has probably come to every
port maintainer.

	
>How-To-Repeat:
	
>Fix:

We just need these lines somewhere after PLIST_SUB/SUB_LIST
definitions, probably right next to this line:

# Put this as far down as possible so it will catch all PLIST_SUB definitions.

.for _X in ${PLIST_SUBX}
PLIST_SUB+=${_X}=${${_X}}
.endfor

.for _X in ${SUBX_LIST}
SUB_LIST+=${_X}=${${_X}}
.endfor


Checks, optimizations, talk about the dangers of relying on
recursive expansion, string quotations are all welcome,
but committing these 6 lines will start saving us lots of
typing right away.
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jan 22 01:04:27 UTC 2006 
Responsible-Changed-Why:  
Over to portmgr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92123 

From: Edwin Groothuis <edwin@mavetju.org>
To: infofarmer@gmail.com
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/92123: [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
Date: Sun, 22 Jan 2006 12:06:54 +1100

 On Sat, Jan 21, 2006 at 04:58:02PM -0800, infofarmer@gmail.com wrote:
 > Implement two autoexpanding variables: PLIST_SUBX and SUBX_LIST
 
 What I would do is just add them to PLIST_SUB:
 	
     PLIST_SUB=	foo=bar QUUX you=me
 
 Then the bsd.port.mk can figure out if there is a = in the variable:
 
     foo=bar?	yes
     QUUX?	no
     you=me	yes
 
 and replace it with itself:
 
     foo=bar
     QUUX	-> QUUX=${QUUX}
     you=me
 
 before applying.
 
 Edwin
 
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

From: "Andrew P." <infofarmer@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/92123: [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
Date: Sun, 22 Jan 2006 04:26:22 +0300

 I really like your idea! Since we can't recursively define
 variables, we'll have to define new vars, which will be
 fed to sed:
 
 _PLIST_SUB=${PLIST_SUB:M*=*}
 .for _X in ${L:N*=*}
 _PLIST_SUB+=${_X}=${${_X}}
 .endfor
 
 after these lines we must do "s/PLIST_SUB/_PLIST_SUB/g"
 Same with SUB_LIST. What do you think?

From: Andrew Pantyukhin <infofarmer@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/92123: [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
Date: Mon, 30 Jan 2006 01:42:41 +0300

 Hmm, I checked this PR just now (via query-pr.cgi) and
 I see '3D' inserted here and there. I don't know where
 it comes from, maybe it's a gmail bug, maybe query-pr
 has its quirk, maybe firefox is freaking out. Anyway,
 if anybody sees this '3D', just imagine that there's
 nothing in its place, not even a space.

Manually adding to audit trail by mcl:

I have fixed the bogusness caused by quoted-printable.
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Tue Jul 25 00:36:12 UTC 2006 
State-Changed-Why:  
Can we see an updated patch, please? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92123 

From: linimon@lonesome.com (Mark Linimon)
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/92123: [patch] bsd.port.mk: PLIST_SUBX and SUBX_LIST autoexpansion
Date: Fri, 28 Jul 2006 15:21:17 -0500

 ----- Forwarded message from Andrew Pantyukhin <infofarmer@gmail.com> -----
 
 Sure, here's one for starters:
 http://people.freebsd.org/~sat/diffs/bpm.pair.exp.diff
 
 I've got many more crazy ideas about optimizing var expansion,
 don't hesitate to ask :-)
 
 Thanks for having a look!
 
 ----- End forwarded message -----
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Fri Jul 28 21:58:13 UTC 2006 
State-Changed-Why:  
Feedback received. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92123 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri May 25 03:21:09 UTC 2007 
State-Changed-Why:  
At the portmgr meeting at BSDCan 2007, we decided that this seemed somewhat 
fragile and obscures, not clarifies, what's going on in the individual 
Makefiles.  So, we're going to close this one, sorry. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92123 
>Unformatted:
