svn commit: r417412 - head/Mk/Scripts

Bryan Drewery bdrewery at FreeBSD.org
Fri Jun 24 05:03:36 UTC 2016


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
+}


More information about the svn-ports-head mailing list