Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Sep 2002 01:47:05 +0200
From:      Jeremy Lea <reg@FreeBSD.org>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        Maxim Sobolev <sobomax@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: ports/security/openssl Makefile ports/archivers/bzip2 Makefile ports/archivers/unzip Makefile ports/devel/gmake Makefile ports/devel/automake Makefile ports/devel/automake14 Makefile ports/devel/autoconf213 Makefile ports/devel/libtool Makefile ...
Message-ID:  <20020916234705.GC30691@shale.csir.co.za>
In-Reply-To: <20020915174805.GA15732@xor.obsecurity.org>
References:  <200209141332.g8EDW7Yl048862@freefall.freebsd.org> <20020915125857.GA30691@shale.csir.co.za> <20020915174805.GA15732@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Sun, Sep 15, 2002 at 10:48:05AM -0700, Kris Kennaway wrote:
> I like this idea..I've been bitten by circular dependencies in the
> ports tree before.  Can you develop it into a patch I can test on the
> bento cluster?

Attached.  I've reused PARENT_CHECKED from (ALL|PACKAGE)-DEPENDS-LIST,
because this also stops these recursing, although it doesn't give an
error.  They way that they work is not very condusive to error
messages...

This doesn't catch the case where you are depending on a port which is
already installed (e.g. if you have X installed, X11.6 is found, and so
x11/XFree86-4-libraries still builds with USE_XLIB (without Maxim's
patch).  This still doesn't result in a fork bomb, but might on package
registration.  I didn't test this case.  The pkg_* tools should protect
themselves against recursive depends in any case...

Feel free to edit/play.

Regards,
  -Jeremy

-- 
FreeBSD - Because the best things in life are free...
                                           http://www.freebsd.org/

Index: bsd.port.mk
===================================================================
RCS file: /usr/home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.423
diff -u -r1.423 bsd.port.mk
--- bsd.port.mk	13 Sep 2002 18:47:30 -0000	1.423
+++ bsd.port.mk	16 Sep 2002 23:27:37 -0000
@@ -674,6 +674,18 @@
 PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}${_SUF1}${_SUF2}
 DISTNAME?=	${PORTNAME}-${PORTVERSION}
 
+# Recurive dependency check...
+PARENT_CHECKED?=	""
+.if ${PARENT_CHECKED:S/${MASTERDIR}//}!=${PARENT_CHECKED}
+pre-everything::
+	@${ECHO_CMD} "Dependency list results in a recursive build of ${PKGNAME}."
+	@${ECHO_CMD} "If you're defining any USE_* variables on the command line or"
+	@${ECHO_CMD} "in /etc/make.conf, then you're probably doing something wrong..."
+	@${FALSE}
+.else
+PARENT_CHECKED+=	${MASTERDIR}
+.endif
+
 # These need to be absolute since we don't know how deep in the ports
 # tree we are and thus can't go relative.  They can, of course, be overridden
 # by individual Makefiles or local system make configuration.
@@ -2986,7 +2998,7 @@
 			if [ ! -d "$$dir" ]; then \
 				${ECHO_MSG} "     >> No directory for $$prog.  Skipping.."; \
 			else \
-				(cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
+				(cd $$dir; ${MAKE} PARENT_CHECKED="${PARENT_CHECKED}" -DINSTALLS_DEPENDS $$target $$depends_args) ; \
 				${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"; \
 			fi; \
 		fi; \
@@ -3027,7 +3039,7 @@
 			if [ ! -d "$$dir" ]; then \
 				${ECHO_MSG} "     >> No directory for $$lib.  Skipping.."; \
 			else \
-				(cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
+				(cd $$dir; ${MAKE} PARENT_CHECKED="${PARENT_CHECKED}" -DINSTALLS_DEPENDS $$target $$depends_args) ; \
 				${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"; \
 				if ${LDCONFIG} -r | ${GREP} -qwF -e "-l$$lib"; then \
 					${TRUE}; \
@@ -3059,7 +3071,7 @@
 		if [ ! -d $$dir ]; then \
 			${ECHO_MSG} "     >> No directory for $$dir.  Skipping.."; \
 		else \
-			(cd $$dir; ${MAKE} $$target $$depends_args) ; \
+			(cd $$dir; ${MAKE} PARENT_CHECKED="${PARENT_CHECKED}" $$target $$depends_args) ; \
 		fi \
 	done
 	@${ECHO_MSG} "===>   Returning to build of ${PKGNAME}"

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020916234705.GC30691>