From owner-svn-ports-all@freebsd.org Fri Jun 24 05:03:36 2016 Return-Path: Delivered-To: svn-ports-all@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 113AEB74AD9; Fri, 24 Jun 2016 05:03:36 +0000 (UTC) (envelope-from bdrewery@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 C60B42DC7; Fri, 24 Jun 2016 05:03:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O53ZWN024520; Fri, 24 Jun 2016 05:03:35 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O53ZlT024519; Fri, 24 Jun 2016 05:03:35 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606240503.u5O53ZlT024519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 24 Jun 2016 05:03:34 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r417412 - head/Mk/Scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 05:03:36 -0000 Author: bdrewery Date: Fri Jun 24 05:03:34 2016 New Revision: 417412 URL: https://svnweb.freebsd.org/changeset/ports/417412 Log: Add a function port_var_fetch() for fetching multiple variables from a port. This is taken from Poudriere (uncommitted) Modified: head/Mk/Scripts/functions.sh Modified: head/Mk/Scripts/functions.sh ============================================================================== --- head/Mk/Scripts/functions.sh Fri Jun 24 04:53:45 2016 (r417411) +++ head/Mk/Scripts/functions.sh Fri Jun 24 05:03:34 2016 (r417412) @@ -250,3 +250,32 @@ escape() { unescape() { echo "$1" | sed -e 's/\\//g' } + +# Fetch vars from the Makefile and set them locally. +# port_var_fetch ports-mgmt/pkg "" PKGNAME pkgname PKGBASE pkgbase ... +# the 2nd variable is for passing any wanted make arguments, such as +# DEPENDS_ARGS. +port_var_fetch() { + local origin="$1" + local make_args="$2" + local _makeflags _vars + local _portvar _var _line + + _makeflags= + _vars= + shift 2 + while [ $# -ge 2 ]; do + _portvar="$1" + _var="$2" + _makeflags="${_makeflags}${_makeflags:+ }-V${_portvar}" + _vars="${_vars}${_vars:+ }${_var}" + shift 2 + done + set -- ${_vars} + while read -r _line; do + setvar "$1" "${_line}" + shift + done <<-EOF + $(${dp_MAKE} -C "${origin}" ${make_args} ${_makeflags} || echo) + EOF +}