pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Move the following targets from bsd.pkg.mk to bsd.u...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a3182cb938a1
branches:  trunk
changeset: 506537:a3182cb938a1
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jan 18 20:18:04 2006 +0000

description:
Move the following targets from bsd.pkg.mk to bsd.utils.mk:

        show-depends-dirs
        show-all-depends-dirs
        show-all-depends-dirs-excl

While we're here, reimplement them using the new pkg_paths and
depends-depth-first.awk scripts.  As a side effect, this speeds up
the execution of these targets by around 5-15% depending on the
complexity of the dependency graph.

NOTE: This *does* change the behavior of these targets slightly because
      the output is now newline-separated instead of space-separated,
      and the order of the output lines doesn't match the original
      targets because the dependency graph is now walked depth-first
      instead of breadth first.

diffstat:

 mk/bsd.pkg.mk   |  84 +--------------------------------------------------------
 mk/bsd.utils.mk |  20 +++++++++++--
 2 files changed, 18 insertions(+), 86 deletions(-)

diffs (136 lines):

diff -r ee70044e135e -r a3182cb938a1 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Jan 18 19:12:54 2006 +0000
+++ b/mk/bsd.pkg.mk     Wed Jan 18 20:18:04 2006 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1790 2006/01/18 19:12:54 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1791 2006/01/18 20:18:04 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -1395,88 +1395,6 @@
 .  endif # !empty(_ALLFILES)
 .endif
 
-# 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:
-       @set -e;                                                        \
-       dlist="";                                                       \
-       depends=${_ALL_DEPENDS:C/^[^:]*://:O:u:Q};                      \
-       for reldir in $$depends; do                                     \
-               case $$reldir in                                        \
-                       ../../*/*) ;;                                   \
-                       *)      ${ECHO} "[show-depends-dirs] warning: invalid 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;                                                           \
-       ${ECHO} $$dlist
-.endif
-
-# Show all build and run depends, reverse-breadth first, with options.
-.if make(show-all-depends-dirs) || make(show-all-depends-dirs-excl)
-
-# "awk" macro to recurse over the dependencies efficiently, never running in
-# the same same directory twice. You may set the following options via "-v":
-#
-#      NonSelf = 1     to not print own directory;
-#      RootsOnly = 1   to print only root directories (i.e. directories
-#                      of packages with no dependencies), including possibly
-#                      own directory
-#
-_RECURSE_DEPENDS_DIRS=                                                 \
-       function append_dirs(dir) {                                     \
-               command = "cd ../../" dir " && ${MAKE} show-depends-dirs"; \
-               command | getline tmp_dirs;                             \
-               close(command);                                         \
-               if (tmp_dirs ~ /^$$/)                                   \
-                       root_dirs[p++] = dir;                           \
-               for (i = 1; i <= split(tmp_dirs, tmp_r); i++)           \
-                       if (!(tmp_r[i] in hash_all_dirs)) {             \
-                               all_dirs[n++] = tmp_r[i];               \
-                               hash_all_dirs[tmp_r[i]] = 1             \
-                       }                                               \
-       }                                                               \
-       BEGIN {                                                         \
-               command = "${PWD_CMD}";                                 \
-               command | getline start_dir;                            \
-               close(command);                                         \
-               i = split(start_dir, tmp_r, /\//);                      \
-               all_dirs[n++] = tmp_r[i-1] "/" tmp_r[i];                \
-               for (; m < n; )                                         \
-                       append_dirs(all_dirs[m++]);                     \
-               if (RootsOnly) {                                        \
-                       printf("%s", root_dirs[--p]);                   \
-                       for (; p > 0; )                                 \
-                               printf(" %s", root_dirs[--p])           \
-               }                                                       \
-               else {                                                  \
-                       if (m > NonSelf)                                \
-                               printf("%s", all_dirs[--m]);            \
-                       for (; m > NonSelf; )                           \
-                               printf(" %s", all_dirs[--m])            \
-               }                                                       \
-               print                                                   \
-       }
-
-.PHONY: show-all-depends-dirs
-.if make(show-all-depends-dirs)
-show-all-depends-dirs:
-       @${AWK} '${_RECURSE_DEPENDS_DIRS}'
-.endif
-
-.PHONY: show-all-depends-dirs-excl
-.if make(show-all-depends-dirs-excl)
-show-all-depends-dirs-excl:
-       @${AWK} -v NonSelf=1 '${_RECURSE_DEPENDS_DIRS}'
-.endif
-
-.endif # make(show-{all-depends-dirs{,-excl}})
-
 .PHONY: show-distfiles
 .if !target(show-distfiles)
 show-distfiles:
diff -r ee70044e135e -r a3182cb938a1 mk/bsd.utils.mk
--- a/mk/bsd.utils.mk   Wed Jan 18 19:12:54 2006 +0000
+++ b/mk/bsd.utils.mk   Wed Jan 18 20:18:04 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.utils.mk,v 1.3 2006/01/18 18:03:08 jlam Exp $
+# $NetBSD: bsd.utils.mk,v 1.4 2006/01/18 20:18:04 jlam Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and defines utility
 # and otherwise miscellaneous variables and targets.
@@ -25,8 +25,8 @@
                PWD_CMD=${TOOLS_PWD_CMD:Q} TEST=${TOOLS_TEST:Q}         \
        ${SH} ${.CURDIR}/../../mk/scripts/pkg_path
 
-.PHONY: show-depends-pkgpaths
-show-depends-pkgpaths:
+.PHONY: show-depends-dirs show-depends-pkgpaths
+show-depends-dirs show-depends-pkgpaths:
        @${_PKG_PATHS_CMD} ${_ALL_DEPENDS_PKGSRCDIRS:O:u}
 
 # _DEPENDS_WALK_CMD holds the command (sans arguments) to walk the
@@ -38,3 +38,17 @@
                MAKEFLAGS=${_DEPENDS_WALK_MAKEFLAGS:Q}                  \
                PKGSRCDIR=${PKGSRCDIR:Q} TEST=${TOOLS_TEST:Q}           \
        ${AWK} -f ${.CURDIR}/../../mk/scripts/depends-depth-first.awk --
+
+# show-all-depends-dirs prints a list of every dependency, implied and
+# direct", of the current package, and includes the current package.
+#
+.PHONY: show-all-depends-dirs
+show-all-depends-dirs:
+       @(${_DEPENDS_WALK_CMD} -r ${PKGPATH})
+
+# show-all-depends-dirs-excl prints a list of every dependency, implied and
+# direct", of the current package.
+#
+.PHONY: show-all-depends-dirs-excl
+show-all-depends-dirs-excl:
+       @(${_DEPENDS_WALK_CMD} ${PKGPATH})



Home | Main Index | Thread Index | Old Index