pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Rewrote the show-depends-dirs target: fixed shell q...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/54d1acef736b
branches:  trunk
changeset: 493783:54d1acef736b
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat May 14 22:19:07 2005 +0000

description:
Rewrote the show-depends-dirs target: fixed shell quoting, omitted
duplicates in the output, output warnings if necessary. The $$dlist at
the end is unquoted intentionally to omit spaces in the output.
Approved by jlam.

diffstat:

 mk/bsd.pkg.mk |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r d0e3ff20c57b -r 54d1acef736b mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sat May 14 22:12:01 2005 +0000
+++ b/mk/bsd.pkg.mk     Sat May 14 22:19:07 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1652 2005/05/14 21:15:07 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1653 2005/05/14 22:19:07 rillig Exp $
 #
 # This file is in the public domain.
 #
@@ -1408,20 +1408,22 @@
 # show both build and run depends directories (non-recursively)
 .PHONY: show-depends-dirs
 .if !target(show-depends-dirs)
+_ALL_DEPENDS=          ${DEPENDS} ${BUILD_DEPENDS}
 show-depends-dirs:
        @dlist="";                                                      \
-       thisdir=`${PWD_CMD}`;                                           \
-       for reldir in "" ${DEPENDS:C/^[^:]*://:C/:.*$//} ${BUILD_DEPENDS:C/^[^:]*://:C/:.*$//} ;\
-       do                                                              \
-               if [ "X$$reldir" = "X" ]; then continue; fi;            \
-               cd $$thisdir/$$reldir;                                  \
-               WD=`${PWD_CMD}`;                                        \
+       depends=${_ALL_DEPENDS:C/^[^:]*://:O:u:Q};                      \
+       for reldir in $$depends; do                                     \
+               case $$reldir in                                        \
+                       */*)    : "expected";;                          \
+                       *)      ${ECHO} ${.TARGET:Q}": warning: missing directory in dependency \"$$reldir\". Check DEPENDS and BUILD_DEPENDS." 1>&2; \
+                               continue;;                              \
+               esac;                                                   \
+               WD=`cd "$$reldir" && ${PWD_CMD}`;                       \
                d=`dirname $$WD`;                                       \
                absdir=`basename $$d`/`basename $$WD`;                  \
                dlist="$$dlist $$absdir";                               \
        done;                                                           \
-       cd $$thisdir;                                                   \
-       ${ECHO} "$$dlist"
+       ${ECHO} $$dlist
 .endif
 
 # Show all build and run depends, reverse-breadth first, with options.



Home | Main Index | Thread Index | Old Index