ports/79010: [patch] bsd.port.mk - all-depends-tree target

Edwin Groothuis edwin at mavetju.org
Sat Mar 19 13:00:10 UTC 2005


>Number:         79010
>Category:       ports
>Synopsis:       [patch] bsd.port.mk - all-depends-tree target
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 19 13:00:09 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #8: Wed Dec 15 16:58:01 EST 2004 edwin at k7.mavetju:/usr/src-5.2.1/sys/i386/compile/k7 i386

>Description:

    "make all-depends-list" gives a nice overview of ports depending
    on this port, but it doesn't really give information who is
    depending on what:

	[/usr/ports/www/apache21] edwin at k7>make all-depends-list
	/usr/ports/converters/libiconv
	/usr/ports/devel/autoconf259
	/usr/ports/devel/gettext
	/usr/ports/devel/gmake
	/usr/ports/devel/libtool13
	/usr/ports/devel/libtool15
	/usr/ports/devel/m4
	/usr/ports/devel/p5-Locale-gettext
	/usr/ports/lang/perl5
	/usr/ports/lang/python
	/usr/ports/misc/help2man
	/usr/ports/security/openssl
	/usr/ports/textproc/expat2

    Where is devel/libtool15 needed by? Which port requires
    p5-Local-gettext? What is python doing in this story?

    This patch adds a new command called "all-depends-tree" which
    gives this information:

    [/usr/ports/www/apache21] edwin at k7>make all-depends-tree
    www/apache
    |\_converters/libiconv
    |  |\_devel/libtool15
    |\_devel/autoconf259
    |  |\_devel/gmake
    |  |  |\_devel/gettext
    |  |  |  |\_converters/libiconv
    |  |  |  |  |\_devel/libtool15
    |  |  |  |\_devel/libtool15
    |  |\_devel/m4
    |  |\_lang/perl5
    |  |\_misc/help2man
    |  |  |\_devel/p5-Locale-gettext
    |  |  |  |\_devel/gettext
    |  |  |  |  |\_converters/libiconv
    |  |  |  |  |  |\_devel/libtool15
    |  |  |  |  |\_devel/libtool15
    |  |  |  |\_lang/perl5
    |  |  |\_lang/perl5
    |\_devel/libtool15
    |\_lang/perl5
    |\_lang/python
    |\_security/openssl
    |  |\_lang/perl5
    |\_textproc/expat2
    |  |\_devel/libtool13

    Unfortunately I haven't been able to get rid of the header |
    where it isn't needed anymore, but for the rest it works!

    BUGS: 
    It doesn't keep track of what has been done, so ports with a
    huge dependency list take a long time before they are ready.
    Very long time sometimes. But they always finish!

>How-To-Repeat:

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.511
diff -u -r1.511 bsd.port.mk
--- bsd.port.mk	17 Mar 2005 23:22:07 -0000	1.511
+++ bsd.port.mk	19 Mar 2005 12:53:20 -0000
@@ -612,6 +612,8 @@
 # run-depends-list
 #				- Show all directories which are run-dependencies
 #				  for this port.
+# all-depends-tree
+#				- Show all ports on which this ports depends, tree-wise
 #
 # extract		- Unpacks ${DISTFILES} into ${WRKDIR}.
 # patch			- Apply any provided patches to the source.
@@ -4398,6 +4400,35 @@
 		fi; \
 	done | ${SORT} -u
 
+all-depends-tree:
+.if defined(EXTRACT_DEPENDS) || defined(PATCH_DEPENDS) || defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) || defined(RUN_DEPENDS) || defined(DEPENDS)
+	@first=0; if [ -z "$${DUMBPREFIX}" ]; then first=1; fi; \
+	DUMBPREFIX=${PKGCATEGORY}/${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}; \
+	ALL=`${ALL-DEPENDS-TREE}`; \
+	if [ "$${first}" = "1" ]; then \
+		echo ${PKGCATEGORY}/${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}; \
+		echo $${ALL} \
+			| ${SED} -e 's,${PORTSDIR}/,,g' \
+			| ${FMT} -1 \
+			| ${SORT} -u \
+			| perl -e 'while (<>) { ~s/.*?\|/|\\_/g; ~s/\|\\_\|/|  |/g; ~s/\|\\_\|/|  |/g; print; }'; \
+    else \
+		echo ${PKGCATEGORY}/${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} >&2; \
+		echo $${ALL}; \
+	fi
+.endif
+
+ALL-DEPENDS-TREE= \
+	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/' -e 's/^ +//' | ${CUT} -f 1 -d ':'); do \
+		if [ -d $$dir ]; then \
+			child=$$(cd $$dir; ${MAKE} DUMBPREFIX="$$DUMBPREFIX|$$dir" all-depends-tree); \
+			for d in $$child; do ${ECHO_CMD} "$$DUMBPREFIX|$$d"; done; \
+			${ECHO_CMD} "$$DUMBPREFIX|$$dir"; \
+		else \
+			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
+		fi; \
+	done | ${SORT} -u
+
 .if !target(clean-depends)
 clean-depends:
 	@for dir in $$(${ALL-DEPENDS-LIST}); do \
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list