Why are implicit package dependencies recorded?

James E. Flemer jflemer at uvm.edu
Sun May 8 19:55:03 PDT 2005


Michael Nottebrock wrote:
> On Sunday, 8. May 2005 20:44, Michael Nottebrock wrote:
> 
> 
>>>Both of these cases can be avoided by building P with the same flags
>>>that D was built with.  In the simple case, that does not seem like a
>>>bad solution, but in practice there can be a huge number of deps and
>>>sub-deps (mplayer has around 45).
> 
> 
> Ah, I've been reading too fast again. Yes, all packages in a dependency-chain 
> will have to be built to match. It would be possible to make the pkg_* tools 
> smarter in order to avoid that, but at the moment quite everything (from 
> pkg_* to the package cluster scripts) relies on prerecorded (or 
> pre-generated, i.e. INDEX) sub-deps.
> 

Actually, pkg_add does indeed do the right thing when only first-order 
dependencies are recorded in the package.  I was pretty sure that was 
the case, so I cooked up a trivial case and the (implicit) sub-dep was 
installed correctly.

The interesting thing is that of the many *-depends and *-depends lists 
targets in bsd.port.mk, only one needs changing to change the packaging 
behavior.  The PACKAGE-DEPENDS-LIST macro is used for the 
package-depends-list and package-depends targets, and the latter is what 
determines the pkgdep lines in the package.  Neither of these two 
targets are used for any other purpose in the Mk/bsd.*.mk files.

A simple three line patch[1] is all that is needed to make the change to 
record only the first-order dependencies.  The all-depends-list target 
and macro are left recursive, preserving all other recursive aspects of 
the port infrastructure.

I cannot say what external consumers there are of the 
PACKAGE-DEPENDS-LIST macro, or of the package-depends and 
package-depends-list targets.  However, there are no consumers other 
than do-package within the port makefile infrastructure.

[1] Hopefully attached and at:
     http://www.cs.rpi.edu/~flemej/freebsd/pkg-first-order-deps/

-James
-------------- next part --------------
--- bsd.port.mk.orig	Sun May  8 20:18:18 2005
+++ bsd.port.mk	Sun May  8 20:42:20 2005
@@ -608,7 +608,7 @@
 #				  for this port.
 # package-depends-list
 #				- Show all directories which are
-#				  package-dependencies for this port.
+#				  first-order dependencies for this port.
 # run-depends-list
 #				- Show all directories which are run-dependencies
 #				  for this port.
@@ -4522,7 +4522,7 @@
 		fi; \
 	done | ${SORT} -u
 
-# Package (recursive runtime) dependency list.  Print out both directory names
+# Package first-order dependency list.  Print out both directory names
 # and package names.
 
 package-depends-list:
@@ -4543,7 +4543,7 @@
 		for pkgname in $$installed; do \
 			${ECHO_CMD} "$$pkgname ${.CURDIR} ${PKGORIGIN}"; \
 		done; \
-	fi; \
+	else \
 	checked="${PARENT_CHECKED}"; \
 	for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${SED} -e 'y/ /\n/' | ${CUT} -f 2 -d ':') $$(${ECHO_CMD} ${DEPENDS} | ${SED} -e 'y/ /\n/' | ${CUT} -f 1 -d ':'); do \
 		dir=$$(${REALPATH} $$dir); \
@@ -4562,7 +4562,8 @@
 		else \
 			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
 		fi; \
-	done
+		done; \
+	fi
 
 # Print out package names.
 


More information about the freebsd-ports mailing list