From owner-svn-ports-head@freebsd.org Wed Aug 17 09:11:10 2016 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 4A1CABBC56A; Wed, 17 Aug 2016 09:11:10 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0E4E4143C; Wed, 17 Aug 2016 09:11:09 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7H9B9am048599; Wed, 17 Aug 2016 09:11:09 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7H9B9cE048597; Wed, 17 Aug 2016 09:11:09 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201608170911.u7H9B9cE048597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Wed, 17 Aug 2016 09:11:09 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r420328 - in 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.22 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: Wed, 17 Aug 2016 09:11:10 -0000 Author: mat Date: Wed Aug 17 09:11:08 2016 New Revision: 420328 URL: https://svnweb.freebsd.org/changeset/ports/420328 Log: Add regexps capacity to PLIST_SUB. This adds the possibility to use regular expressions for the makeplist stage of the PLIST_SUB life. From time to time, the values are too generic, and they get in the way of other stuff. This adds the possibility to have a `VAR_regex=regex` that will be used instead of the `VAR=string` to search for possible replacements. For example, in lang/perl5*, there is PERL_ARCH=mach, which will get replaced in paths if a file is called, say "machine", will end up being "%%PERL_ARCH%%ine". Adding PERL_ARCH_regex="\bmach\b" will ensure only full words are replaced, so machine will stay machine, but "lib/mach/foo "will still be replaced by "lib/%%PERL_ARCH%%/foo". Reviewed by: bdrewery Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D7335 Modified: head/CHANGES head/Mk/bsd.port.mk (contents, props changed) Modified: head/CHANGES ============================================================================== --- head/CHANGES Wed Aug 17 09:11:00 2016 (r420327) +++ head/CHANGES Wed Aug 17 09:11:08 2016 (r420328) @@ -10,6 +10,24 @@ in the release notes and/or placed into All ports committers are allowed to commit to this file. +20160317: +AUTHOR: mat@FreeBSD.org + + This adds the possibility to use regular expressions for the makeplist stage + of the PLIST_SUB life. + + From time to time, the values are too generic, and they get in the way of + other stuff. + + This adds the possibility to have a `VAR_regex=regex` that will be used + instead of the `VAR=string` to search for possible replacements. + + For example, in lang/perl5*, there is PERL_ARCH=mach, which will get replaced + in paths if a file is called, say "machine", will end up being + "%%PERL_ARCH%%ine". Adding PERL_ARCH_regex="\bmach\b" will ensure only full + words are replaced, so machine will stay machine, but "lib/mach/foo "will + still be replaced by "lib/%%PERL_ARCH%%/foo". + 20160803: AUTHOR: mat@FreeBSD.org Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Wed Aug 17 09:11:00 2016 (r420327) +++ head/Mk/bsd.port.mk Wed Aug 17 09:11:08 2016 (r420328) @@ -1611,9 +1611,11 @@ PLIST_SUB_SED_tmp1= ${PLIST_SUB:C/.*=.{1 # Remove empty values # Remove @comment values PLIST_SUB_SED_tmp2= ${PLIST_SUB_tmp1:NEXTRACT_SUFX=*:NOSREL=*:NLIB32DIR=*:NPREFIX=*:NLOCALBASE=*:NRESETPREFIX=*:N*="":N*="@comment*} +# Handle VARS for which there is a _regex entry +PLIST_SUB_SED_tmp3?= ${PLIST_SUB_SED_tmp1:C/(${PLIST_SUB:M*_regex=*:C/_regex=.*/=.*/:Q:S/\\ /|/g:S/\\//g})//:C/(.*)_regex=(.*)/\1=\2/} # Remove quotes # Replace . with \. for later sed(1) usage -PLIST_SUB_SED?= ${PLIST_SUB_SED_tmp2:C/([^=]*)="?([^"]*)"?/s!\2!%%\1%%!g;/g:C/\./\\./g} +PLIST_SUB_SED?= ${PLIST_SUB_SED_tmp3:C/([^=]*)="?([^"]*)"?/s!\2!%%\1%%!g;/g:C/\./\\./g} # kludge to strip trailing whitespace from CFLAGS; # sub-configure will not # survive double space