ports/141641: [patch] make 'config-recursive' finish in one pass

Andrius Morkunas hinokind at gmail.com
Tue Dec 15 15:10:04 UTC 2009


>Number:         141641
>Category:       ports
>Synopsis:       [patch] make 'config-recursive' finish in one pass
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 15 15:10:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Andrius Morkunas
>Release:        
>Organization:
>Environment:
>Description:
Config recursive needs multiple passes to configure all dependencies in some cases. Situation is similar with rmconfig-recursive. More info here: http://lists.freebsd.org/pipermail/freebsd-ports/2009-December/058175.html

Attached patch fixes these problems.
>How-To-Repeat:
Enable options that add new dependencies during config-recursive and do config-recursive again.
>Fix:


Patch attached with submission follows:

--- Mk/bsd.port.mk.orig	2009-11-26 00:02:29.000000000 +0200
+++ Mk/bsd.port.mk	2009-12-09 21:18:03.873125530 +0200
@@ -6073,9 +6073,36 @@
 
 .if !target(config-recursive)
 config-recursive:
-	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
-	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} config-conditional); \
+	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; \
+	${MAKE} config-conditional;					\
+	L=$$(${MAKE} -V _DEPEND_DIRS);					\
+	checked="";							\
+	while [ -n "$$L" ]; do						\
+		l="";							\
+		for d in $$L; do					\
+			case $$checked in				\
+			$$d\ *|*\ $$d\ *|*\ $$d)			\
+				continue;;				\
+			esac;						\
+			checked="$$checked $$d";			\
+			if [ ! -d $$d ]; then				\
+				${ECHO_MSG} "${PKGNAME}: \"$$d\" non-existent -- recursive config incomplete" >&2; \
+				continue;				\
+			fi;						\
+			${MAKE} -C $$d config-conditional;		\
+			if ! children=$$(cd $$d && ${MAKE} -V _DEPEND_DIRS); then \
+				${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- recursive config incomplete" >&2; \
+				continue;				\
+			fi;						\
+			for child in $$children; do			\
+				case "$$checked $$l" in			\
+				$$child\ *|*\ $$child\ *|*\ $$child)	\
+					continue;;			\
+				esac;					\
+				l="$$l $$child";			\
+			done;						\
+		done;							\
+		L=$$l;							\
 	done
 .endif
 
@@ -6169,12 +6196,56 @@
 
 .if !target(rmconfig-recursive)
 rmconfig-recursive:
-	@${ECHO_MSG} "===> Removing user-specified options for ${PKGNAME} and dependencies";
-	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} rmconfig); \
+	@${ECHO_MSG} "===> Removing user-specified options for ${PKGNAME} and dependencies"; \
+	L=${.CURDIR};							\
+	checked="";							\
+	while [ -n "$$L" ]; do						\
+		l="";							\
+		for d in $$L; do					\
+			case $$checked in				\
+			$$d\ *|*\ $$d\ *|*\ $$d)			\
+				continue;;				\
+			esac;						\
+			checked="$$checked $$d";			\
+			if [ ! -d $$d ]; then				\
+				${ECHO_MSG} "${PKGNAME}: \"$$d\" non-existent -- recursive rmconfig incomplete" >&2; \
+				continue;				\
+			fi;						\
+			if ! children=$$(${MAKE} -C $$d -V _DEPEND_DIRS); then \
+				${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- recursive rmconfig incomplete" >&2; \
+				continue;				\
+			fi;						\
+			if (${MAKE} -C $$d rmconfig-internal > /dev/null); then \
+				${ECHO_MSG} "===> Removing user-configured options for `${MAKE} -C $$d -V PKGNAME`"; \
+				children="$${children} $$(${MAKE} -C $$d -V _DEPEND_DIRS)"; \
+			else						\
+				${ECHO_MSG} "===> No user-specified options configured for `${MAKE} -C $$d -V PKGNAME`"; \
+			fi;						\
+			for child in $$children; do			\
+				case "$$checked $$l" in			\
+				$$child\ *|*\ $$child\ *|*\ $$child)	\
+					continue;;			\
+				esac;					\
+				l="$$l $$child";			\
+			done;						\
+		done;							\
+		L=$$l;							\
 	done
 .endif
 
+# This should only be used by rmconfig-recursive.
+.if !target(rmconfig-internal)
+rmconfig-internal:
+.if defined(OPTIONS) && exists(${OPTIONSFILE})
+	-@${ECHO_CMD}; \
+	optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \
+	${RM} -f ${OPTIONSFILE}; \
+	${RMDIR} $${optionsdir};
+.else
+	exit 1;
+.endif
+.endif
+
 desktop-categories:
 	@categories=""; \
 	for native_category in ${CATEGORIES}; do \


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list