svn commit: r398258 - head/Mk

Mathieu Arnold mat at FreeBSD.org
Thu Oct 1 07:56:37 UTC 2015


Author: mat
Date: Thu Oct  1 07:56:36 2015
New Revision: 398258
URL: https://svnweb.freebsd.org/changeset/ports/398258

Log:
  Fix opt_VARS premature expansion.
  
  Due to the way .for loop work, opt_VARS was being expanded too early
  evaluation, which made it impossible to use vars that are set/modifies
  afterwards (such as PREFIX or PKGDIR)
  
  Fix this by changing opt_VARS handling logic so that the right side is
  not prematurely expanded:
  
  - Loop not by words (each word here is single VAR=val / VAR+=val tuple)
    but by unique left sides of assignments (VAR, VAR+ here)
  - Using the left side, extract all corresponding right sides and
    append/assign them to a variable
  
  This changes the way this opt_VARS line work, which behavior is between
  invalid and undefined:
  
  opt_VARS= FOO=bar FOO=baz
  
  Before it would end up with "FOO=baz", now it ends up with "FOO=bar baz"
  
  Submitted by:	amdmi3
  Reviewed by:	antoine, mat
  Approved by:	my portmgr hat
  Sponsored by:	Absolight
  Differential Revision:	https://reviews.freebsd.org/D3729

Modified:
  head/Mk/bsd.options.mk

Modified: head/Mk/bsd.options.mk
==============================================================================
--- head/Mk/bsd.options.mk	Thu Oct  1 07:55:46 2015	(r398257)
+++ head/Mk/bsd.options.mk	Thu Oct  1 07:56:36 2015	(r398258)
@@ -476,12 +476,12 @@ USE_${_u:tu}+=	${option:C/.*=//g:C/,/ /g
 .      endfor
 .    endif
 .    if defined(${opt}_VARS)
-.      for var in ${${opt}_VARS}
-_u=		${var:C/=.*//}
+.      for var in ${${opt}_VARS:C/=.*//:O:u}
+_u=			${var}
 .        if ${_u:M*+}
-${_u:C/.$//:tu}+=	${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
+${_u:C/.$//:tu}+=	${${opt}_VARS:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
 .        else
-${_u:tu}=	${var:C/[^=]*=//:C/^"(.*)"$$/\1/}
+${_u:tu}=		${${opt}_VARS:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
 .        endif
 .      endfor
 .    endif
@@ -524,12 +524,12 @@ USE_${_u:tu}+=	${option:C/.*=//g:C/,/ /g
 .      endfor
 .    endif
 .    if defined(${opt}_VARS_OFF)
-.      for var in ${${opt}_VARS_OFF}
-_u=		${var:C/=.*//}
+.      for var in ${${opt}_VARS_OFF:C/=.*//:O:u}
+_u=			${var}
 .        if ${_u:M*+}
-${_u:C/.$//:tu}+=	${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
+${_u:C/.$//:tu}+=	${${opt}_VARS_OFF:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
 .        else
-${_u:tu}=	${var:C/[^=]*=//:C/^"(.*)"$$/\1/}
+${_u:tu}=		${${opt}_VARS_OFF:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
 .        endif
 .      endfor
 .    endif


More information about the svn-ports-all mailing list