Subject: show-depends-dirs target.
To: None <tech-pkg@netbsd.org>
From: None <mcmahill@mtl.mit.edu>
List: tech-pkg
Date: 01/18/2001 16:32:12
I'd like to add a pkgsrc target "show-depends-dirs" which will print the
directory part of the top level {BUILD_,}DEPENDS for a given package.
This does _not_ recurse the dependency tree, but only shows the top level
packages.

The target is useful for extracting a complete depends tree for all of
pkgsrc without lots of repetition.  

example:

dan@zomby 142 # make show-depends-dirs
 audio/esound graphics/imlib graphics/fnlib graphics/freetype-lib www/libghttp lang/perl5


Comments?

Thanks
-Dan

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.643
diff -u -2 -r1.643 bsd.pkg.mk
--- bsd.pkg.mk  2001/01/15 19:46:29     1.643
+++ bsd.pkg.mk  2001/01/18 21:31:14
@@ -223,5 +223,5 @@
 # XXX: actually, here we would need something like
 # BUILD_DEPENDS+=libtool>=1.3.5nb9:../../devel/libtool
-.if make(install-run-depends) || make(fetch-list-recursive)
+.if make(install-run-depends) || make(fetch-list-recursive) ||
make(show-depends-dirs)
 DEPENDS+=              libtool>=1.3.5nb9:../../devel/libtool
 .endif
@@ -1300,4 +1300,24 @@
                ${_FETCH_FILE}                                          \
         done
+.endif
+.endif
+
+# show both build and run depends directories (non-recursively)
+.if !target(show-depends-dirs)
+show-depends-dirs:
+.if defined(IGNORE)
+       ${_PKG_SILENT}${_PKG_DEBUG}${DO_NADA}
+.else
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       dlist="";\
+       for reldir in ${DEPENDS:C/^[^:]*://:C/:.*$//}
${BUILD_DEPENDS:C/^[^:]*://:C/:.*$//} ;\
+       do \
+               cd $$reldir ;\
+               PWD=`pwd` ;\
+               d=`dirname $$PWD` ;\
+               absdir=`basename $$d`/`basename $$PWD` ;\
+               dlist="$$dlist $$absdir";\
+       done ;\
+       ${ECHO} "$$dlist"
 .endif
 .endif