summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2022-04-09 00:46:12 +0000
committerrillig <rillig@pkgsrc.org>2022-04-09 00:46:12 +0000
commitd2098a925ff868f1a0d5a6176bd659fa731210ed (patch)
tree8b131b85112c7b23ddd3de113906063cb183531d /mk
parent82db62e0c5198eca10718b25c2a7a91aece58f54 (diff)
downloadpkgsrc-d2098a925ff868f1a0d5a6176bd659fa731210ed.tar.gz
mk: add show-depends-all
Previously, there was no easy way to list all dependencies of a package. The target show-depends only lists the direct missing dependencies, the target show-depends-dirs lists all direct dependencies, but neither lists the indirect dependencies as well. The newly added target show-depends-all includes the indirect dependencies. While here, document the existing targets since they differ subtly. https://mail-index.netbsd.org/pkgsrc-users/2022/04/07/msg035444.html
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.utils.mk54
-rw-r--r--mk/depends/bsd.depends.mk11
2 files changed, 59 insertions, 6 deletions
diff --git a/mk/bsd.utils.mk b/mk/bsd.utils.mk
index 91fc4428a5d..181597a1e54 100644
--- a/mk/bsd.utils.mk
+++ b/mk/bsd.utils.mk
@@ -1,13 +1,28 @@
-# $NetBSD: bsd.utils.mk,v 1.12 2018/01/25 00:33:56 joerg Exp $
+# $NetBSD: bsd.utils.mk,v 1.13 2022/04/09 00:46:12 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and defines utility
# and otherwise miscellaneous variables and targets.
#
-# DEPENDS_TYPE is used by the "show-depends-pkgpaths" target and specifies
-# which class of dependencies to output. The special value "all" means
-# to output every dependency.
+# DEPENDS_TYPE
+# Used by the "show-depends-pkgpaths" target to specify which
+# class of direct dependencies to output. The special value "all"
+# means to output every dependency.
#
+# Possible:
+# all = build
+# + TEST_DEPENDS (if PKGSRC_RUN_TEST)
+# + install
+# build = BOOTSTRAP_DEPENDS
+# + TOOL_DEPENDS
+# + BUILD_DEPENDS
+# install = DEPENDS
+# package XXX: same as install?
+#
+# Default:
+# all
+#
+# Keywords: depends dependencies
DEPENDS_TYPE?= all
.if !empty(DEPENDS_TYPE:Mbuild) || !empty(DEPENDS_TYPE:Mall)
_ALL_DEPENDS+= ${BOOTSTRAP_DEPENDS} ${BUILD_DEPENDS} ${TOOL_DEPENDS}
@@ -28,6 +43,20 @@ _PKG_PATHS_CMD= \
PWD_CMD=${TOOLS_PWD_CMD:Q} TEST=${TOOLS_TEST:Q} \
${SH} ${.CURDIR}/../../mk/scripts/pkg_path
+# show-depends-dirs:
+# show-depends-pkgpaths:
+# Lists the PKGPATH of all direct dependencies of the current
+# package.
+#
+# Parameters:
+# PKGSRC_RUN_TEST
+# Whether to include test dependencies as well.
+#
+# See also:
+# show-depends
+# show-depends-all
+#
+# Keywords: depends dependencies
.PHONY: show-depends-dirs show-depends-pkgpaths
show-depends-dirs show-depends-pkgpaths:
@${_PKG_PATHS_CMD} ${_ALL_DEPENDS:C/^[^:]*://:O:u}
@@ -43,3 +72,20 @@ _DEPENDS_WALK_CMD= \
MAKEFLAGS=${_DEPENDS_WALK_MAKEFLAGS:Q} \
PKGSRCDIR=${PKGSRCDIR:Q} TEST=${TOOLS_TEST:Q} \
${AWK} -f ${.CURDIR}/../../mk/scripts/depends-depth-first.awk --
+
+# show-depends-all:
+# Lists the PKGPATH of all direct or indirect dependencies of the
+# current package.
+#
+# Parameters:
+# DEPENDS_TYPE
+# all, build, install or package
+# PKGSRC_RUN_TEST
+# Whether to include test dependencies as well.
+#
+# See also:
+# show-depends
+# show-depends-pkgpaths
+# Keywords: depends dependencies recursive indirect
+show-depends-all: .PHONY
+ ${RUN} ${_DEPENDS_WALK_CMD} ${PKGPATH}
diff --git a/mk/depends/bsd.depends.mk b/mk/depends/bsd.depends.mk
index 19a200d7d1e..c1d60efa8b3 100644
--- a/mk/depends/bsd.depends.mk
+++ b/mk/depends/bsd.depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.depends.mk,v 1.30 2019/05/07 19:36:44 rillig Exp $
+# $NetBSD: bsd.depends.mk,v 1.31 2022/04/09 00:46:12 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to dependencies.
@@ -129,12 +129,19 @@ depends-cookie:
${RUN}${TOUCH} ${TOUCH_ARGS} ${_COOKIE.depends}
# show-depends:
-# Prints a list of dependencies.
+# Prints the dependencies that need to be installed before this
+# package can be installed. Each line of the output has the format
+# 'dependency:directory', as in DEPENDS and the related variables.
#
# Command line variables:
#
# VARNAME
# DEPENDS, BUILD_DEPENDS, TEST_DEPENDS, or TOOL_DEPENDS.
#
+# See also:
+# show-depends-pkgpaths Prints the PKGPATH of all direct dependencies.
+# show-depends-all Prints the PKGPATH of all direct and
+# indirect dependencies.
+#
# Keywords: depends dependencies
show-depends: .PHONY _pkgformat-show-depends