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. 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) How-To-Repeat: Try `cd /usr/ports/x11/kde3; time make all-depends-list'. While it is running, try `ps -ax | fgrep -c make'.
Responsible Changed From-To: freebsd-ports-bugs->portmgr Assign to maintainer.
State Changed From-To: open->analyzed Accepted for testing on the cluster.
State Changed From-To: analyzed->closed Committed, thanks.
State Changed From-To: closed->analyzed Reopened to indicate a revised patch to this is being tested on the cluster.
Just for history. The revised patch can be found here: http://lists.freebsd.org/mailman/htdig/freebsd-ports/2006-January/029123.html -- Sem.
State Changed From-To: analyzed->feedback Patch committed. Is this problem now completely solved?
State Changed From-To: feedback->closed I have not heard otherwise, so I am claiming that we have solved this problem.