From owner-freebsd-current Sat May 11 2: 9:22 2002 Delivered-To: freebsd-current@freebsd.org Received: from taro.c.u-tokyo.ac.jp (taro.c.u-tokyo.ac.jp [157.82.63.16]) by hub.freebsd.org (Postfix) with ESMTP id 4E56137B43A; Sat, 11 May 2002 02:09:05 -0700 (PDT) Date: Sat, 11 May 2002 18:08:42 +0900 From: KOMATSU Shinichiro To: freebsd-current@FreeBSD.ORG, ports@freebsd.org Cc: Riccardo Torrini , Garrett Rooney Subject: bsd.port.mk dependency loop checking patch (Re: Who broke 'make clean' for ports ?) References: <20020510172656.GD13627@dan.emsphone.com> <20020510173132.GA46688@electricjellyfish.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline In-Reply-To: <20020510173132.GA46688@electricjellyfish.net> User-Agent: Mutt/1.3.28i-ja.1 X-Editor: JVim 3.0-j2.1a by Ken'ichi Tsuchida (2001 May 5) + skk1.2.17(SKKFEP) Message-Id: <20020511090904.69E5B1949@taro.c.u-tokyo.ac.jp> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline (add To: ports@freebsd.org) From: Garrett Rooney 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). --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bsd.port.mk-1.411-loopcheck.patch" 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. --IS0zKkzwUGydFO0o-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message