pkgsrc-Users archive

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

USE_INDIRECT_DEPENDS now available



Hi all,

I've committed my USE_INDIRECT_DEPENDS patch. This allows you to enable stricter checks for binary packages to ensure that any indirect libraries they use are correctly checked for.

To give you a real-world example of this, currently if you:

  * Use pkgsrc openssl
  * Enable the libfetch 'openssl' option
  * Build net/fetch

You will end up with a binary package for fetch that links against pkgsrc openssl libraries, but does not depend on the pkgsrc openssl package. "pkg_add fetch" or "pkgin in fetch" on a clean system will attempt to install a package that simply won't work.

This is caused by net/libfetch/buildlink3.mk setting:

  BUILDLINK_DEPMETHOD.libfetch?=  build

so pkgsrc will treat libfetch, and any package that it includes (i.e. openssl) as a build dependency only.

The tl;dr is that you should really consider enabling USE_INDIRECT_DEPENDS=yes in your mk.conf. This will ensure that check-shlibs will correctly check for indirect library dependencies before a package is even produced.

This is especially important for anyone who produces binary packages that will be made available in a repository to other users.

Why not set it to yes by default? Unfortunately due to the way buildlink3.mk files are included there is the possibility of false positives, and I don't want to break things that are actually fine.

Anyone who just builds packages for their local system might think they will be ok as build dependencies will be installed during the build process, however you can still run into problems, for example if you use "pkgin autoremove" to keep things clean you could end up with a required dependency being deleted and your binaries stop working.

For pkgsrc developers, the way to fix these problems is to ensure that indirect library dependencies are correctly recorded as "full". I would also strongly recommend avoiding BUILDLINK_DEPMETHOD=build unless you have very good reasons for setting it (the benefits are strongly out-weighed by the risks), and have the correct logic in your buildlink3.mk files to handle indirect includes.

Cheers,

--
Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com
--- Begin Message ---
Module Name:	pkgsrc
Committed By:	jperkin
Date:		Fri Oct 11 08:24:48 UTC 2024

Modified Files:
	pkgsrc/mk: bsd.utils.mk
	pkgsrc/mk/buildlink3: bsd.buildlink3.mk
	pkgsrc/mk/check: check-shlibs-elf.awk check-shlibs-macho.awk
	pkgsrc/mk/defaults: mk.conf
	pkgsrc/mk/pkgformat/pkg: depends.mk list-dependencies
	    reduce-resolved-depends.awk resolve-dependencies

Log Message:
mk: Add support for stricter USE_INDIRECT_DEPENDS.

The current and historical behaviour is that the BUILDLINK_DEPMETHOD for
a package defaults to "full", regardless of what any parent package that
included it has set for its BUILDLINK_DEPMETHOD.  In addition, only
direct dependencies and indirect "build" dependencies are logged as
dependencies in the files that are used for check-shlibs verification
and package dependency metadata for pkg_install.  Any indirect "full"
dependency is ignored.

This combination of factors can lead to a broken package being produced.
A package may end up linking against a pkgsrc library, but because it is
an indirect dependency, and because indirect "full" dependencies are not
registered, check-shlibs will have no knowledge of it and has to assume
that it is correct.  This situation will occur if any packages that are
a parent dependency of the required library have set BUILDLINK_DEPMETHOD
to "build".

To mitigate this problem, a more accurate algorithm is implemented to
calculate BUILDLINK_DEFAULT_DEPMETHOD for each package based on the
setting of its parent(s), rather than simply defaulting to "full".  If
USE_INDIRECT_DEPENDS is enabled, then the output of this algorithm is
used, and both "build" and "full" indirect dependencies are calculated
and added to the dependency metadata files.  check-shlibs can then use
this extra information to issue an error if a library is found to belong
to an indirect build dependency.

Unfortunately due to buildlink3.mk inclusion guards, we cannot currently
guarantee that the BUILDLINK_DEFAULT_DEPMETHOD setting for each package
is 100% accurate, and so there may be the occasional false positive when
USE_INDIRECT_DEPENDS is enabled.  For this reason it is currently not
enabled by default, but it is strongly recommended that developers, and
especially anyone producing public binary packages, enable it.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 pkgsrc/mk/bsd.utils.mk
cvs rdiff -u -r1.263 -r1.264 pkgsrc/mk/buildlink3/bsd.buildlink3.mk
cvs rdiff -u -r1.20 -r1.21 pkgsrc/mk/check/check-shlibs-elf.awk
cvs rdiff -u -r1.12 -r1.13 pkgsrc/mk/check/check-shlibs-macho.awk
cvs rdiff -u -r1.346 -r1.347 pkgsrc/mk/defaults/mk.conf
cvs rdiff -u -r1.23 -r1.24 pkgsrc/mk/pkgformat/pkg/depends.mk
cvs rdiff -u -r1.4 -r1.5 pkgsrc/mk/pkgformat/pkg/list-dependencies \
    pkgsrc/mk/pkgformat/pkg/resolve-dependencies
cvs rdiff -u -r1.2 -r1.3 pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/bsd.utils.mk
diff -u pkgsrc/mk/bsd.utils.mk:1.14 pkgsrc/mk/bsd.utils.mk:1.15
--- pkgsrc/mk/bsd.utils.mk:1.14	Wed Apr 13 22:02:36 2022
+++ pkgsrc/mk/bsd.utils.mk	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.utils.mk,v 1.14 2022/04/13 22:02:36 rillig Exp $
+# $NetBSD: bsd.utils.mk,v 1.15 2024/10/11 08:24:48 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and defines utility
 # and otherwise miscellaneous variables and targets.
@@ -16,6 +16,7 @@
 #		build		= BOOTSTRAP_DEPENDS
 #				+ TOOL_DEPENDS
 #				+ BUILD_DEPENDS
+#				+ INDIRECT_BUILD_DEPENDS
 #		install		= DEPENDS
 #		package		XXX: same as install?
 #
@@ -25,7 +26,8 @@
 # Keywords: depends dependencies
 DEPENDS_TYPE?=  all
 .if !empty(DEPENDS_TYPE:Mbuild) || !empty(DEPENDS_TYPE:Mall)
-_ALL_DEPENDS+=	${BOOTSTRAP_DEPENDS} ${BUILD_DEPENDS} ${TOOL_DEPENDS}
+_ALL_DEPENDS+=	${BOOTSTRAP_DEPENDS} ${TOOL_DEPENDS}
+_ALL_DEPENDS+=	${BUILD_DEPENDS} ${INDIRECT_BUILD_DEPENDS}
 .  if !empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
 _ALL_DEPENDS+=	${TEST_DEPENDS}
 .  endif

Index: pkgsrc/mk/buildlink3/bsd.buildlink3.mk
diff -u pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.263 pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.264
--- pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.263	Sat Jan 13 20:26:47 2024
+++ pkgsrc/mk/buildlink3/bsd.buildlink3.mk	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.263 2024/01/13 20:26:47 riastradh Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.264 2024/10/11 08:24:48 jperkin Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -198,8 +198,8 @@ _BLNK_PACKAGES+=	${_pkg_}
 
 _VARGROUPS+=		bl3
 _VARGROUP_WIDTH.bl3=	39
-_DEF_VARS.bl3+=		_BLNK_PACKAGES _BLNK_DEPENDS
-_LISTED_VARS.bl3+=	_BLNK_PACKAGES _BLNK_DEPENDS
+_DEF_VARS.bl3+=		_BLNK_PACKAGES _BLNK_DEPENDS _BLNK_INDIRECT_DEPENDS
+_LISTED_VARS.bl3+=	_BLNK_PACKAGES _BLNK_DEPENDS _BLNK_INDIRECT_DEPENDS
 .for v in BINDIR CFLAGS CPPFLAGS DEPENDS LDADD LDFLAGS LIBS
 _SYS_VARS.bl3+=		BUILDLINK_${v}
 .endfor
@@ -226,25 +226,81 @@ _SYS_VARS.bl3+=		${v}.${p}
 .  endfor
 .endfor
 
-# By default, every package receives a full dependency.
-.for _pkg_ in ${_BLNK_PACKAGES}
-BUILDLINK_DEPMETHOD.${_pkg_}?=	full
+# Set BUILDLINK_DEFAULT_DEPMETHOD for each package.  Iterate through the tree,
+# and if a package has explicitly set BUILDLINK_DEPMETHOD then use it as the
+# default for its dependencies, otherwise default to "full".
+#
+# If a package was previously marked "build" but is later encountered inside a
+# "full" stack then "full" must take precedence.
+#
+# Note that this can currently produce false-positives due to buildlink3.mk
+# inclusion guards preventing BUILDLINK_TREE from having a complete view of
+# the full buildlink tree.  Thus for now, BUILDLINK_DEFAULT_DEPMETHOD is only
+# used when USE_INDIRECT_DEPENDS is enabled.
+#
+_stack_:=	bottom
+.for _pkg_ in ${BUILDLINK_TREE}
+.  if !${_pkg_:M-*}
+     # Some packages erroneously have multiple values for BUILDLINK_DEPMETHOD,
+     # so resort to matching and "full" takes precedence over "build".
+.    if ${BUILDLINK_DEPMETHOD.${_pkg_}:U:Mfull}
+_stack_:=	full ${_stack_}
+.    elif ${BUILDLINK_DEPMETHOD.${_pkg_}:U:Mbuild}
+_stack_:=	build ${_stack_}
+.    elif ${_stack_} == "bottom"
+_stack_:=	full ${_stack_}
+.    else
+_stack_:=	${_stack_:[1]} ${_stack_}
+.    endif
+.  else
+.    if !defined(BUILDLINK_DEFAULT_DEPMETHOD.${_pkg_:S/^-//}) || \
+       (${BUILDLINK_DEFAULT_DEPMETHOD.${_pkg_:S/^-//}} == "build" && \
+        ${_stack_:[1]} == full)
+BUILDLINK_DEFAULT_DEPMETHOD.${_pkg_:S/^-//}:=	${_stack_:[1]}
+.    endif
+_stack_:=	${_stack_:[2..-1]}
+.  endif
 .endfor
+.if ${_stack_} != "bottom"
+.  error "The above loop through BUILDLINK_TREE failed to balance"
+.endif
 
 # _BLNK_DEPENDS contains all of the elements of _BLNK_PACKAGES for which
-# we must add a dependency.  We add a dependency if we aren't using the
-# built-in version of the package, and the package was either explicitly
-# requested as a dependency (_BUILDLINK_DEPENDS) or is a build dependency
-# somewhere in the chain.
+# we must add a dependency.
 #
-_BLNK_DEPENDS=	# empty
+# In the USE_INDIRECT_DEPENDS=yes case, _BLNK_DEPENDS contains direct
+# dependencies and _BLNK_INDIRECT_DEPENDS contains indirect dependencies,
+# using the information calculated by BUILDLINK_DEFAULT_DEPMETHOD above.
+#
+# Otherwise (the historical behaviour and the current default), _BLNK_DEPENDS
+# contains direct dependencies from _BUILDLINK_DEPENDS, as well as packages
+# that are declared as "build" dependencies, even though that information may
+# well be incorrect due to the BUILDLINK_DEPMETHOD default of "full",
+# regardless of whether a parent package was declared as "build" or "full".
+#
+_BLNK_DEPENDS=			# empty
+_BLNK_INDIRECT_DEPENDS=		# empty, only used with USE_INDIRECT_DEPENDS
+
 .for _pkg_ in ${_BLNK_PACKAGES}
-USE_BUILTIN.${_pkg_}?=	no
-.  if empty(_BLNK_DEPENDS:M${_pkg_}) && !defined(IGNORE_PKG.${_pkg_}) && \
-      !empty(USE_BUILTIN.${_pkg_}:M[nN][oO]) && \
-      (!empty(_BUILDLINK_DEPENDS:M${_pkg_}) || \
-       !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild))
-_BLNK_DEPENDS+=	${_pkg_}
+USE_BUILTIN.${_pkg_}?=		no
+.  if ${USE_INDIRECT_DEPENDS:tl} == yes
+BUILDLINK_DEPMETHOD.${_pkg_}?=	${BUILDLINK_DEFAULT_DEPMETHOD.${_pkg_}:Ufull}
+.  else
+BUILDLINK_DEPMETHOD.${_pkg_}?=	full
+.  endif
+.  if !defined(IGNORE_PKG.${_pkg_}) && ${USE_BUILTIN.${_pkg_}} == no
+.    if ${USE_INDIRECT_DEPENDS:tl} == yes
+.      if !empty(_BUILDLINK_DEPENDS:M${_pkg_})
+_BLNK_DEPENDS+=			${_pkg_}
+.      else
+_BLNK_INDIRECT_DEPENDS+=	${_pkg_}
+.      endif
+.    else
+.      if !empty(_BUILDLINK_DEPENDS:M${_pkg_}) || \
+	  !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
+_BLNK_DEPENDS+=			${_pkg_}
+.      endif
+.    endif
 .  endif
 .endfor
 
@@ -253,11 +309,14 @@ _BLNK_DEPENDS+=	${_pkg_}
 # "build", and if any of that list is "full" then we use a full dependency
 # on <pkg>, otherwise we use a build dependency on <pkg>.
 #
-_BLNK_ADD_TO.DEPENDS=		# empty
-_BLNK_ADD_TO.BUILD_DEPENDS=	# empty
-_BLNK_ADD_TO.ABI_DEPENDS=	# empty
-_BLNK_ADD_TO.BUILD_ABI_DEPENDS=	# empty
-.for _pkg_ in ${_BLNK_DEPENDS}
+_BLNK_ADD_TO.DEPENDS=			# empty
+_BLNK_ADD_TO.BUILD_DEPENDS=		# empty
+_BLNK_ADD_TO.ABI_DEPENDS=		# empty
+_BLNK_ADD_TO.BUILD_ABI_DEPENDS=		# empty
+_BLNK_ADD_TO.INDIRECT_DEPENDS=		# empty
+_BLNK_ADD_TO.INDIRECT_BUILD_DEPENDS=	# empty
+
+.for _pkg_ in ${_BLNK_DEPENDS:O:u}
 .  if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
 _BLNK_DEPMETHOD.${_pkg_}=	_BLNK_ADD_TO.DEPENDS
 _BLNK_ABIMETHOD.${_pkg_}=	_BLNK_ADD_TO.ABI_DEPENDS
@@ -265,6 +324,19 @@ _BLNK_ABIMETHOD.${_pkg_}=	_BLNK_ADD_TO.A
 _BLNK_DEPMETHOD.${_pkg_}=	_BLNK_ADD_TO.BUILD_DEPENDS
 _BLNK_ABIMETHOD.${_pkg_}=	_BLNK_ADD_TO.BUILD_ABI_DEPENDS
 .  endif
+.endfor
+
+.for _pkg_ in ${_BLNK_INDIRECT_DEPENDS:O:u}
+.  if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
+_BLNK_DEPMETHOD.${_pkg_}=	_BLNK_ADD_TO.INDIRECT_DEPENDS
+_BLNK_ABIMETHOD.${_pkg_}=	_BLNK_ADD_TO.INDIRECT_ABI_DEPENDS
+.  elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
+_BLNK_DEPMETHOD.${_pkg_}=	_BLNK_ADD_TO.INDIRECT_BUILD_DEPENDS
+_BLNK_ABIMETHOD.${_pkg_}=	_BLNK_ADD_TO.INDIRECT_BUILD_ABI_DEPENDS
+.  endif
+.endfor
+
+.for _pkg_ in ${_BLNK_PACKAGES:O:u}
 .  if defined(BUILDLINK_API_DEPENDS.${_pkg_}) && \
       defined(BUILDLINK_PKGSRCDIR.${_pkg_})
 .    for _depend_ in ${BUILDLINK_API_DEPENDS.${_pkg_}}
@@ -282,11 +354,18 @@ ${_BLNK_ABIMETHOD.${_pkg_}}+=	${_abi_}:$
 .    endfor
 .  endif
 .endfor
-.for _depmethod_ in DEPENDS BUILD_DEPENDS ABI_DEPENDS BUILD_ABI_DEPENDS
+
+.for _depmethod_ in \
+	DEPENDS \
+	BUILD_DEPENDS \
+	ABI_DEPENDS \
+	BUILD_ABI_DEPENDS \
+	INDIRECT_DEPENDS \
+	INDIRECT_BUILD_DEPENDS
 .  if !empty(_BLNK_ADD_TO.${_depmethod_})
 ${_depmethod_}+=	${_BLNK_ADD_TO.${_depmethod_}}
 .  endif
-.endfor	# _BLNK_DEPENDS
+.endfor
 
 ###
 ### BEGIN: after the barrier

Index: pkgsrc/mk/check/check-shlibs-elf.awk
diff -u pkgsrc/mk/check/check-shlibs-elf.awk:1.20 pkgsrc/mk/check/check-shlibs-elf.awk:1.21
--- pkgsrc/mk/check/check-shlibs-elf.awk:1.20	Mon Nov 27 12:51:38 2023
+++ pkgsrc/mk/check/check-shlibs-elf.awk	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: check-shlibs-elf.awk,v 1.20 2023/11/27 12:51:38 jperkin Exp $
+# $NetBSD: check-shlibs-elf.awk,v 1.21 2024/10/11 08:24:48 jperkin Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -84,20 +84,23 @@ function check_pkg(DSO, lib,	pkg, found)
 	}
 	if (pkg == "")
 		return 0
-	found=0
+	found = 0
 	while ((getline < depends_file) > 0) {
 		if ($3 == pkg) {
-			found=1
-			if ($1 != "full")
-				continue
-			close(depends_file)
-			return 0
+			found = 1
+			if ($1 == "full" || $1 == "indirect-full") {
+				close(depends_file)
+				return 0
+			}
 		}
 	}
+	# Ideally we would error here if we found a dependency on any pkgsrc
+	# library that isn't listed in the depends file.  However this doesn't
+	# work for a variety of reasons, not least if the package itself is
+	# already installed and its pkgsrc libraries are found before the ones
+	# in DESTDIR.  A package obviously can't depend on itself...
 	if (found)
 		print DSO ": " lib ": " pkg " is not a runtime dependency"
-	# Not yet:
-	# print DSO ": " lib ": " pkg " is not a dependency"
 	close(depends_file)
 }
 

Index: pkgsrc/mk/check/check-shlibs-macho.awk
diff -u pkgsrc/mk/check/check-shlibs-macho.awk:1.12 pkgsrc/mk/check/check-shlibs-macho.awk:1.13
--- pkgsrc/mk/check/check-shlibs-macho.awk:1.12	Wed Oct  2 10:49:01 2024
+++ pkgsrc/mk/check/check-shlibs-macho.awk	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: check-shlibs-macho.awk,v 1.12 2024/10/02 10:49:01 jperkin Exp $
+# $NetBSD: check-shlibs-macho.awk,v 1.13 2024/10/11 08:24:48 jperkin Exp $
 
 #
 # Read a list of potential Mach-O binaries from stdin.
@@ -53,16 +53,21 @@ function check_pkg(DSO, lib,	pkg, found)
 	}
 	if (pkg == "")
 		return 0
-	found=0
+	found = 0
 	while ((getline < depends_file) > 0) {
 		if ($3 == pkg) {
-			found=1
-			if ($1 != "full")
-				continue
-			close(depends_file)
-			return 0
+			found = 1
+			if ($1 == "full" || $1 == "indirect-full") {
+				close(depends_file)
+				return 0
+			}
 		}
 	}
+	# Ideally we would error here if we found a dependency on any pkgsrc
+	# library that isn't listed in the depends file.  However this doesn't
+	# work for a variety of reasons, not least if the package itself is
+	# already installed and its pkgsrc libraries are found before the ones
+	# in DESTDIR.  A package obviously can't depend on itself...
 	if (found)
 		print DSO ": " lib ": " pkg " is not a runtime dependency"
 	close(depends_file)

Index: pkgsrc/mk/defaults/mk.conf
diff -u pkgsrc/mk/defaults/mk.conf:1.346 pkgsrc/mk/defaults/mk.conf:1.347
--- pkgsrc/mk/defaults/mk.conf:1.346	Fri Apr 26 14:20:54 2024
+++ pkgsrc/mk/defaults/mk.conf	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.346 2024/04/26 14:20:54 wiz Exp $
+# $NetBSD: mk.conf,v 1.347 2024/10/11 08:24:48 jperkin Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -203,6 +203,21 @@ USE_ABI_DEPENDS?=	yes
 # Possible: yes, no
 # Default: yes
 
+USE_INDIRECT_DEPENDS?=	no
+# When calculating BUILDLINK_DEPMETHOD, use a more accurate algorithm to
+# determine whether a package is a "build" or "full" dependency, based on
+# the setting of its parent(s), and register indirect dependencies for tools
+# such as check-shlibs to perform additional checks that may expose issues
+# in binary packages.
+#
+# It is strongly recommended that this option be enabled, but due to current
+# buildlink limitations (see the relevant comments in bsd.buildlink3.mk) the
+# information cannot be guaranteed to be completely accurate and may lead to
+# false positives, so for now it is disabled by default.
+#
+# Possible: yes, no
+# Default: no
+
 #PKG_REGISTER_SHELLS= YES
 # Automatically register shells in /etc/shells
 # Possible: YES, NO

Index: pkgsrc/mk/pkgformat/pkg/depends.mk
diff -u pkgsrc/mk/pkgformat/pkg/depends.mk:1.23 pkgsrc/mk/pkgformat/pkg/depends.mk:1.24
--- pkgsrc/mk/pkgformat/pkg/depends.mk:1.23	Fri Oct  4 07:45:59 2024
+++ pkgsrc/mk/pkgformat/pkg/depends.mk	Fri Oct 11 08:24:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.23 2024/10/04 07:45:59 jperkin Exp $
+# $NetBSD: depends.mk,v 1.24 2024/10/11 08:24:48 jperkin Exp $
 
 # This command prints out the dependency patterns for all full (run-time)
 # dependencies of the package.
@@ -11,7 +11,8 @@
 #
 #	<depends_type>	<pattern>	<directory>
 #
-# Valid dependency types are "bootstrap", "tool", "build", "test" and "full".
+# Valid dependency types are "bootstrap", "tool", "build", "full",
+# "indirect-build", "indirect-full", and "test".
 #
 # ${_RDEPENDS_FILE} contains the resolved dependency information
 # for the package.  For each line in ${_DEPENDS_FILE}
@@ -65,19 +66,21 @@ _LIST_DEPENDS_CMD=	\
 			" " \
 			" "${TOOL_DEPENDS:Q} \
 			" "${BUILD_DEPENDS:Q} \
-			" "${DEPENDS:Q}
+			" "${DEPENDS:Q} \
+			" "${INDIRECT_BUILD_DEPENDS:Q} \
+			" "${INDIRECT_DEPENDS:Q}
 
 _LIST_DEPENDS_CMD.bootstrap=	\
 	${PKGSRC_SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \
 		PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \
 		${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \
-			" "${BOOTSTRAP_DEPENDS:Q} " " " " " " " "
+			" "${BOOTSTRAP_DEPENDS:Q} " " " " " " " " " " " "
 
 _LIST_DEPENDS_CMD.test=	\
 	${PKGSRC_SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \
 		PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \
 		${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \
-			" " " "${TEST_DEPENDS:Q} " " " " " "
+			" " " "${TEST_DEPENDS:Q} " " " " " " " " " "
 
 _RESOLVE_DEPENDS_CMD=	\
 	${PKGSRC_SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} PKG_INFO=${PKG_INFO:Q} \
@@ -94,15 +97,15 @@ CROSSTARGETSETTINGS=	${CROSSVARS:@_v_@TA
 #	@param $dir The pkgsrc directory from which the package can be
 #		built.
 #	@param $type The dependency type. Can be one of bootstrap, tool,
-#		build, test, full.
+#		build, full, indirect-build, indirect-full, and test.
 #
 _DEPENDS_INSTALL_CMD=							\
 	case $$type in							\
-	bootstrap)	Type=Bootstrap;;				\
-	tool)		Type=Tool;;					\
-	build)		Type=Build;;					\
-	test)		Type=Test;;					\
-	full)		Type=Full;;					\
+	bootstrap)		Type=Bootstrap;;			\
+	tool)			Type=Tool;;				\
+	build|indirect-build)	Type=Build;;				\
+	test)			Type=Test;;				\
+	full|indirect-full)	Type=Full;;				\
 	esac;								\
 	case $$type in							\
 	bootstrap|tool)							\
@@ -117,7 +120,7 @@ _DEPENDS_INSTALL_CMD=							\
 		cross=no;						\
 		pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;	\
 		;;							\
-	build|test|full)						\
+	build|full|indirect-build|indirect-full|test)			\
 		extradep=" ${PKGNAME}";					\
 		crosstargetsettings=;					\
 		cross=${USE_CROSS_COMPILE:Uno};				\
@@ -143,7 +146,7 @@ _DEPENDS_INSTALL_CMD=							\
 		case $$type in						\
 		bootstrap|tool)						\
 			pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \
-		build|test|full)					\
+		build|full|indirect-build|indirect-full|test)		\
 			pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \
 		esac;							\
 		case "$$pkg" in						\
@@ -159,7 +162,7 @@ _DEPENDS_INSTALL_CMD=							\
 		bootstrap|tool)						\
 			objfmt=`${HOST_PKG_INFO} -Q OBJECT_FMT "$$pkg"`; \
 			needobjfmt=${NATIVE_OBJECT_FMT:Q};;		\
-		build|test|full)					\
+		build|full|indirect-build|indirect-full|test)		\
 			objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`;	\
 			needobjfmt=${OBJECT_FMT:Q};;			\
 		esac;							\

Index: pkgsrc/mk/pkgformat/pkg/list-dependencies
diff -u pkgsrc/mk/pkgformat/pkg/list-dependencies:1.4 pkgsrc/mk/pkgformat/pkg/list-dependencies:1.5
--- pkgsrc/mk/pkgformat/pkg/list-dependencies:1.4	Mon Jan 13 07:31:53 2020
+++ pkgsrc/mk/pkgformat/pkg/list-dependencies	Fri Oct 11 08:24:48 2024
@@ -58,8 +58,8 @@ print_entries() {
 	done
 }
 
-if [ $# != 5 ]; then
-	echo "usage: list-dependencies bootstrap_depends test_depends tool_depends build_depends depends" 1>&2
+if [ $# != 7 ]; then
+	echo "usage: list-dependencies bootstrap_depends test_depends tool_depends build_depends depends indirect_build_depends indirect_depends" 1>&2
 	exit 1
 fi
 
@@ -68,3 +68,5 @@ print_entries test "$2"
 print_entries tool "$3"
 print_entries build "$4"
 print_entries full "$5"
+print_entries indirect-build "$6"
+print_entries indirect-full "$7"
Index: pkgsrc/mk/pkgformat/pkg/resolve-dependencies
diff -u pkgsrc/mk/pkgformat/pkg/resolve-dependencies:1.4 pkgsrc/mk/pkgformat/pkg/resolve-dependencies:1.5
--- pkgsrc/mk/pkgformat/pkg/resolve-dependencies:1.4	Fri Oct  4 07:39:01 2024
+++ pkgsrc/mk/pkgformat/pkg/resolve-dependencies	Fri Oct 11 08:24:48 2024
@@ -29,7 +29,7 @@ find_best() {
 	case $1 in
 	bootstrap|tool)
 		${HOST_PKG_INFO} -E "$2" || ${TRUE};;
-	build|full)
+	build|full|indirect-build|indirect-full)
 		${PKG_INFO} -E "$2" || ${TRUE};;
 	esac
 }

Index: pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk
diff -u pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk:1.2 pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk:1.3
--- pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk:1.2	Thu May  9 23:37:26 2013
+++ pkgsrc/mk/pkgformat/pkg/reduce-resolved-depends.awk	Fri Oct 11 08:24:48 2024
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -f
 #
-# $NetBSD: reduce-resolved-depends.awk,v 1.2 2013/05/09 23:37:26 riastradh Exp $
+# $NetBSD: reduce-resolved-depends.awk,v 1.3 2024/10/11 08:24:48 jperkin Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -65,6 +65,8 @@ BEGIN {
 		}
 		if ($1 != "full" &&
 		    $1 != "build" &&
+		    $1 != "indirect-full" &&
+		    $1 != "indirect-build" &&
 		    $1 != "tool" &&
 		    $1 != "bootstrap") {
 			print "ERROR: [" PROGNAME "] invalid dependency line " $0 | ERRCAT
@@ -82,6 +84,8 @@ BEGIN {
 		if (type[i] == "full" && checked_full[pkg[i]] != 1) {
 			checked_full[pkg[i]] = 1
 			checked_build[pkg[i]] = 1
+			checked_indirect_full[pkg[i]] = 1
+			checked_indirect_build[pkg[i]] = 1
 			checked_tool[pkg[i]] = 1
 			checked_bootstrap[pkg[i]] = 1
 			print_line[i] = 1
@@ -142,6 +146,18 @@ BEGIN {
 		}
 	}
 
+	# Just pass through indirect-* for now.
+	for (i = 0; i < lines; ++i) {
+		if (type[i] == "indirect-build" && checked_indirect_build[pkg[i]] != 1) {
+			checked_indirect_build[pkg[i]] = 1
+			print_line[i] = 1
+		}
+		if (type[i] == "indirect-full" && checked_indirect_full[pkg[i]] != 1) {
+			checked_indirect_full[pkg[i]] = 1
+			print_line[i] = 1
+		}
+	}
+
 	for (i = 0; i < lines; ++i) {
 		if (print_line[i] == 1)
 			printf("%s\t%s\t%s\n", type[i], pattern[i], pkg[i])


--- End Message ---


Home | Main Index | Thread Index | Old Index