git: a50c18ba3174 - main - bsd.port.mk: Do not pass FLAVOR in dependency make environment

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Tue, 30 Nov 2021 12:38:59 UTC
The branch main has been updated by avg (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=a50c18ba3174831be2a7ad5ad9d3c1410b043fd0

commit a50c18ba3174831be2a7ad5ad9d3c1410b043fd0
Author:     Ross Williams <ross@ross-williams.net>
AuthorDate: 2021-11-30 12:11:12 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2021-11-30 12:37:50 +0000

    bsd.port.mk: Do not pass FLAVOR in dependency make environment
    
    The change introduced in bug 256301 (review D30579), which prevents
    child make processes from receiving an empty FLAVOR variable when
    FLAVOR should be unset, has the side effect of allowing any FLAVOR
    already in the parent make process environment to propagate to the
    child.
    
    This revision prevents the FLAVOR from the parent make from
    incorrectly propagating to the child during a recursive make.
    
    Additionally, use "flavored" CURDIR in recursive_dirs variable
    so that a correct FLAVOR is used for the top-most port as well.
    
    Reviewed by:    bapt
    Approved by:    bapt
    Differential Revision: https://reviews.freebsd.org/D32324
---
 Mk/bsd.port.mk | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 33179c1caf25..78961a9b6c31 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -4075,7 +4075,7 @@ _FLAVOR_RECURSIVE_SH= \
 		${FALSE}; \
 	fi; \
 	for dir in $${recursive_dirs}; do \
-		unset flavor; \
+		unset flavor FLAVOR; \
 		case $${dir} in \
 			*@*/*) ;; \
 			*@*) \
@@ -4146,14 +4146,14 @@ fetch-specials:
 fetch-recursive:
 	@${ECHO_MSG} "===> Fetching all distfiles for ${PKGNAME} and dependencies"
 	@recursive_cmd="fetch"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif
 
 .if !target(fetch-recursive-list)
 fetch-recursive-list:
 	@recursive_cmd="fetch-list"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif
 
@@ -4220,7 +4220,7 @@ fetch-required-list: fetch-list
 checksum-recursive:
 	@${ECHO_MSG} "===> Fetching and checking checksums for ${PKGNAME} and dependencies"
 	@recursive_cmd="checksum"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif
 
@@ -5018,7 +5018,7 @@ config:
 config-recursive:
 	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
 	@recursive_cmd="config-conditional"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif # config-recursive
 
@@ -5074,7 +5074,7 @@ showconfig: check-config
 showconfig-recursive:
 	@${ECHO_MSG} "===> The following configuration options are available for ${PKGNAME} and its dependencies";
 	@recursive_cmd="showconfig"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif # showconfig-recursive
 
@@ -5101,7 +5101,7 @@ rmconfig:
 rmconfig-recursive:
 	@${ECHO_MSG} "===> Removing user-specified options for ${PKGNAME} and its dependencies";
 	@recursive_cmd="rmconfig"; \
-	    recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
+	    recursive_dirs="${.CURDIR}${FLAVOR:D@${FLAVOR}} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
 		${_FLAVOR_RECURSIVE_SH}
 .endif # rmconfig-recursive