Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108160730
D31159.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D31159.diff
View Options
Index: Mk/Scripts/functions.sh
===================================================================
--- Mk/Scripts/functions.sh
+++ Mk/Scripts/functions.sh
@@ -153,7 +153,7 @@
local envfault
for i ; do
set -f
- if ! (eval ": \${${i}?}" ) >/dev/null; then
+ if ! (eval ": \${${i}?}" ) >/dev/null 2>&1; then
envfault="${envfault}${envfault:+" "}${i}"
fi
set +f
@@ -165,6 +165,10 @@
fi
}
+# Grab common environment that is expensive to lookup in downstream ports.
+# Not all of this is default known by bsd.port.mk nor is required for all
+# ports. It offers significant speedups though for anything using
+# executions (!=).
export_ports_env() {
local export_vars make_cmd make_env var value uses
@@ -172,7 +176,7 @@
return 0
fi
- validate_env MAKE PORTSDIR
+ validate_env dp_MAKE PORTSDIR
uses="python compiler:features objc"
@@ -186,7 +190,7 @@
make_cmd="${make_env}"
- export_vars="$(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk \
+ export_vars="$(${dp_MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk \
-V PORTS_ENV_VARS ${make_env} USES="${uses}")"
for var in ${export_vars}; do
@@ -194,7 +198,7 @@
done
# Bring in all the vars, but not empty ones.
- eval "$(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk ${make_cmd} \
+ eval "$(${dp_MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk ${make_cmd} \
USES="${uses}" | grep -v '=$' | sed -e 's,\\ $,,')"
for var in ${export_vars}; do
# Export and display non-empty ones. This is not redundant
Index: Mk/Scripts/ports_env.sh
===================================================================
--- Mk/Scripts/ports_env.sh
+++ Mk/Scripts/ports_env.sh
@@ -1,14 +1,27 @@
#! /bin/sh
+#
+# Exports and gives export lines that can be evalled by the caller.
+# See export_ports_env() in functions.sh for more information.
+#
+
# MAINTAINER: portmgr@FreeBSD.org
set -o pipefail
-if [ -z "${SCRIPTSDIR}" ]; then
- echo "Must set SCRIPTSDIR" >&2
+# Backwards compat for Poudriere
+if [ "${SCRIPTSDIR-__null}" != "__null" ]; then
+ dp_SCRIPTSDIR="${SCRIPTSDIR}"
+fi
+if [ "${MAKE-__null}" != "__null" ]; then
+ dp_MAKE="${MAKE}"
+fi
+
+if [ -z "${dp_SCRIPTSDIR}" ]; then
+ echo "Must set dp_SCRIPTSDIR" >&2
exit 1
fi
-. ${SCRIPTSDIR}/functions.sh
+. ${dp_SCRIPTSDIR}/functions.sh
export_ports_env
Index: Mk/Scripts/ports_env_exec.sh
===================================================================
--- /dev/null
+++ Mk/Scripts/ports_env_exec.sh
@@ -0,0 +1,18 @@
+#! /bin/sh
+
+#
+# Wrap the given command with ports_env.sh exported vars
+#
+
+# MAINTAINER: portmgr@FreeBSD.org
+
+set -o pipefail
+
+if [ -z "${dp_SCRIPTSDIR}" ]; then
+ echo "Must set dp_SCRIPTSDIR" >&2
+ exit 1
+fi
+
+. ${dp_SCRIPTSDIR}/ports_env.sh > /dev/null
+
+"$@"
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk
+++ Mk/bsd.port.mk
@@ -4762,7 +4762,14 @@
.endif
.endfor
.endif
+# See export_ports_env() in Scripts/functions.sh
PORTS_ENV_VARS+= ${_EXPORTED_VARS}
+PORTS_ENV_EXEC= \
+ ${SETENV} \
+ PORTSDIR="${PORTSDIR}" \
+ dp_MAKE="${MAKE}" \
+ dp_SCRIPTSDIR="${SCRIPTSDIR}" \
+ ${SH} ${SCRIPTSDIR}/ports_env_exec.sh
.if !target(pre-check-config)
pre-check-config:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 23, 1:11 AM (19 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16044355
Default Alt Text
D31159.diff (3 KB)
Attached To
Mode
D31159: Mk/ports_env: Updates
Attached
Detach File
Event Timeline
Log In to Comment