From owner-svn-ports-head@freebsd.org Thu Oct 1 07:56:37 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50415A0C10F; Thu, 1 Oct 2015 07:56:37 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27C7D1909; Thu, 1 Oct 2015 07:56:37 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t917ubs0062439; Thu, 1 Oct 2015 07:56:37 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t917ubeR062438; Thu, 1 Oct 2015 07:56:37 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201510010756.t917ubeR062438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Thu, 1 Oct 2015 07:56:37 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r398258 - head/Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 07:56:37 -0000 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