(add To: [EMAIL PROTECTED]) From: Garrett Rooney <[EMAIL PROTECTED]> Subject: Re: Who broke 'make clean' for ports ? Date: Sat, May 11, 2002 at 02:31:32AM JST
> there's a circular dependency that was just introduced to gettext. > gettext now depends on expat, which depends on gmake, which depends on > gettext. Recently, I wrote a patch for bsd.port.mk that checks circular dependency. If a dependency loop is found, it gives you a warning and does not invoke 'make' process any further. Someone, please test the patch below. If no problem is found, I will send-pr(8).
Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.411 diff -u -u -r1.411 bsd.port.mk --- bsd.port.mk 27 Apr 2002 11:22:59 -0000 1.411 +++ bsd.port.mk 8 May 2002 17:13:40 -0000 @@ -684,6 +684,16 @@ .else PORTSDIR?= /usr/ports .endif +.if exists(/bin/realpath) +PORTSDIR!= /bin/realpath ${PORTSDIR} +.else +PORTSDIR_IS_SYMLINK!= if [ -L ${PORTSDIR} ]; then echo "yes" ; fi +. if ${PORTSDIR_IS_SYMLINK} == "yes" +. error "PORTSDIR" must not be a symlink +. endif +. undef PORTSDIR_IS_SYMLINK +.endif + LOCALBASE?= ${DESTDIR}/usr/local X11BASE?= ${DESTDIR}/usr/X11R6 LINUXBASE?= ${DESTDIR}/compat/linux @@ -3068,11 +3078,20 @@ @${ALL-DEPENDS-LIST} ALL-DEPENDS-LIST= \ + parents="${PARENTS} ${.CURDIR}"; \ checked="${PARENT_CHECKED}"; \ - for dir in $$(${ECHO_CMD} "${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//') $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'); do \ + for dir in $$( { ${ECHO_CMD} "${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} +${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' ; +${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'; } | sort -u); do \ if [ -d $$dir ]; then \ - if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \ - child=$$(cd $$dir; ${MAKE} PARENT_CHECKED="$$checked" all-depends-list); \ + for p in $$parents; do \ + if [ "$$p" = "$$dir" ]; then \ + ${ECHO_MSG} "Dependency loop:" >&2; \ + ${ECHO_MSG} "${.CURDIR} => $$p" >&2; \ + ${ECHO_MSG} "" >&2; \ + exit 1;\ + fi; \ + done; \ + if $$( for c in $$checked; do if [ "$$dir" = "$$c" ]; then +exit 1; fi ; done ); then \ + child=$$(cd $$dir; ${MAKE} PARENTS="$$parents" +PARENT_CHECKED="$$checked" all-depends-list); \ for d in $$child; do ${ECHO_CMD} $$d; done; \ ${ECHO_CMD} $$dir; \ checked="$$dir $$child $$checked"; \ @@ -3155,11 +3174,20 @@ if [ "${CHILD_DEPENDS}" ]; then \ ${ECHO_CMD} "${PKGNAME} ${.CURDIR}"; \ fi; \ + parents="${PARENTS} ${.CURDIR}"; \ checked="${PARENT_CHECKED}"; \ - for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//') $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'); do \ + for dir in $$( { ${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' +'\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' ; ${ECHO_CMD} ${DEPENDS} | ${TR} '\040' +'\012' | ${SED} -e 's/:.*//'; } | sort -u); do \ if [ -d $$dir ]; then \ - if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \ - childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \ + for p in $$parents; do \ + if [ "$$p" = "$$dir" ]; then \ + ${ECHO_MSG} "Dependency loop:" >&2; \ + ${ECHO_MSG} "${.CURDIR} => $$p" >&2; \ + ${ECHO_MSG} "" >&2; \ + exit 1;\ + fi; \ + done; \ + if $$( for c in $$checked; do if [ "$$dir" = "$$c" ]; then +exit 1; fi ; done ); then \ + childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes +PARENTS="$$parents" PARENT_CHECKED="$$checked" package-depends-list); \ set -- $$childout; \ childname=""; childdir=""; \ while [ $$\# != 0 ]; do \ @@ -3173,7 +3201,7 @@ else \ ${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \ fi; \ - done + done | sort -u # Print out package names.