Page MenuHomeFreeBSD

bsd.port.mk: Do not pass FLAVOR in dependency make environment
ClosedPublic

Authored by ross_ross-williams.net on Oct 5 2021, 3:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 3:47 PM
Unknown Object (File)
Mon, Apr 22, 3:47 PM
Unknown Object (File)
Mon, Apr 22, 3:44 PM
Unknown Object (File)
Mon, Apr 22, 3:43 PM
Unknown Object (File)
Mon, Apr 22, 3:26 PM
Unknown Object (File)
Sat, Mar 30, 7:10 PM
Unknown Object (File)
Feb 24 2024, 3:03 PM
Unknown Object (File)
Dec 29 2023, 2:32 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 42314
Build 39202: arc lint + arc unit

Event Timeline

Good catch! Thank you!
I also noticed this problem just recently and was about to propose a slightly different patch:

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 0fe16fa5426d..fea489a8c42f 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -4095,7 +4095,7 @@ _FLAVOR_RECURSIVE_SH= \
                /*) ;; \
                *) dir=${PORTSDIR}/$$dir ;; \
                esac; \
-               (cd $$dir; ${SETENV} $${flavor:+FLAVOR=$${flavor}} ${MAKE} $${recursive_cmd}); \
+               (cd $$dir; unset FLAVOR; ${SETENV} $${flavor:+FLAVOR=$${flavor}} ${MAKE} $${recursive_cmd}); \
        done
 
 # This script is shared among several dependency list variables.  See file for

I think I also had to do the following as well.
If a recursive target is used in a flavored port without that change then the port's default flavor would get used instead of a user specified flavor.
That happens because FLAVOR variable gets unset and the original port's directory is specified without the flavor suffix.

--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -4154,14 +4154,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
 
@@ -4228,7 +4228,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
 
@@ -5021,7 +5021,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
 
@@ -5077,7 +5077,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
 
@@ -5104,7 +5104,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
 
  • incorporate avg's feedback about @$FLAVOR in recursive targets
bapt added a subscriber: bapt.

@avg I let you commit it ?

This revision is now accepted and ready to land.Nov 19 2021, 9:15 PM