ports/86310: all-depends-list target of bsd.port.mk is buggy
Mikhail T.
mi at aldan.algebra.com
Sun Sep 18 21:10:02 UTC 2005
>Number: 86310
>Category: ports
>Synopsis: all-depends-list target of bsd.port.mk is buggy
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Sep 18 21:10:00 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Mikhail T.
>Release: FreeBSD 6.0-BETA4 amd64
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD blue.virtual-estates.net 6.0-BETA4 FreeBSD 6.0-BETA4 #0: Mon Sep 12 19:48:18 EDT 2005 mi at blue.virtual-estates.net:/var/obj/var/src/sys/SILVER amd64
>Description:
The all-depends-list target in bsd.port.mk is inefficient and
error-prone. Depending on circumstances, it may, for example,
fail to add teTeX to the list (because teTeX-base is usually
visited first).
It can also fail due to a very long (or circular) list of
dependencies, and even when successful will use a lot of stack
invoking make recursively.
Similar targets (like package-depends-list) have the same
problem.
>How-To-Repeat:
Try `cd /usr/ports/x11/kde3; time make all-depends-list'. While
it is running, try `ps -ax | fgrep -c make'.
>Fix:
The patch below fixes only all-depends-list for now. I may be
able to fix others too. It also helps find, which dependant
directories had errors (such as unresolved RCS-merges).
I posted this patch to ports@ and nobody objected (predictably).
I also rebuilt my own machine with it -- everything built.
--- bsd.port.mk 28 Aug 2005 18:47:56 -0000 1.516
+++ bsd.port.mk 18 Sep 2005 21:02:50 -0000
@@ -4464,23 +4470,40 @@
# Dependency lists: both build and runtime, recursive. Print out directory names.
+_DEPENDS=${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}
+_DEPEND_DIRS= ${_DEPENDS:C,^[^:]*:([^:]*),\1,} ${DEPENDS:C,:.*,,}
+
all-depends-list:
-.if defined(EXTRACT_DEPENDS) || defined(PATCH_DEPENDS) || defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) || defined(RUN_DEPENDS) || defined(DEPENDS)
@${ALL-DEPENDS-LIST}
-.endif
ALL-DEPENDS-LIST= \
- checked="${PARENT_CHECKED}"; \
- for dir in $$(${ECHO_CMD} "${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}" | ${SED} -e 'y/ /\n/' | ${CUT} -f 2 -d ':') $$(${ECHO_CMD} ${DEPENDS} | ${SED} -e 'y/ /\n/' | ${CUT} -f 1 -d ':'); do \
- if [ -d $$dir ]; then \
- if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \
- child=$$(cd $$dir; ${MAKE} PARENT_CHECKED="$$checked" all-depends-list); \
- for d in $$child; do ${ECHO_CMD} $$d; done; \
- ${ECHO_CMD} $$dir; \
- checked="$$dir $$child $$checked"; \
- fi; \
- else \
- ${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
- fi; \
- done | ${SORT} -u
+ L="${_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 -- dependency list incomplete" >&2; \
+ continue; \
+ fi; \
+ ${ECHO_CMD} $$d; \
+ if ! children=$$(${MAKE} -C $$d -V _DEPEND_DIRS); then\
+ ${ECHO_MSG} "${PKGNAME}: \"$$d\" erroneous -- dependency list 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
.if !target(clean-depends)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list