Hello,
I noticed that environment variables can seep through the dependencies
and provoke erroneous output.
For instance:
---
openbsd-snapshot-65$ PKGNAME=foobar make -C devel/valgrind print-build-depends
This port requires package(s) "foobarp9 foobarp3 foobar foobar foobarp2
foobar foobarp3 foobarp3 gmake-4.2.1p0" to build.
---
The dependency list is wrong because the PKGNAME environment variable
has been passed on the children make targets.
The patch uses SETENV to get children processes to ignore the
environment they inherit in the following targets:
- print-build-depends
- print-all-depends
- print-run-depends
- print-test-depends
- print-package-signature
feedback, ok?
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1462
diff -u -p -u -r1.1462 bsd.port.mk
--- bsd.port.mk 4 Apr 2019 02:28:06 -0000 1.1462
+++ bsd.port.mk 13 May 2019 10:02:37 -0000
@@ -1740,7 +1740,7 @@ _parse_spec = \
_compute_default = \
set -f; \
- if set -- $$(eval $$toset exec ${MAKE} _print-metadata); then \
+ if set -- $$(${SETENV} sh -c "eval $$toset exec ${MAKE}
_print-metadata"); then \
default=$$1; pkgspec=$$2; pkgpath=$$3; \
else \
echo 1>&2 "Problem with dependency $$d"; \
@@ -3155,7 +3155,7 @@ print-run-depends:
full-${_i}-depends:
@PKGPATH=${PKGPATH} ${MAKE}
${_i}-dir-depends|${_sort_dependencies}|while read subdir; do \
${_flavor_fragment}; \
- eval $$toset ${MAKE} _print-packagename ; \
+ ${SETENV} sh -c "eval $$toset ${MAKE} _print-packagename" ; \
done
.endfor