pkgsrc/mk/flavor/pkg/resolve-dependencies
joerg c466f410c0 Make depends-cookie a flavor indendepent target. Before it was used to
trace the dependency information. This is computed and stored in
.depends directly now before anything else is done. The output is locked
and the locking is supposed to work before the bootstrap-depends are
installed.

Add a new hook for flavors after all dependencies are added and before
the depends-cookie is created. Use this to compute which package is used
to fulfill each dependency and store it in .rdepends. Adjust
register-dependencies and some other places to use this information
directly instead of recomputing it all the time.

The code to list all dependencies and to recursively install missing
ones is moved to a separate shell script. This makes it easier to
understand what is going on and extend them later.

Change the calling of pkg_create to prepend the dependencies directly to
the passed-in PLIST and not via -P and -T. This is in preperation of
changing the way they are stored in the packages.

Discussed with, recieved minor disagreement about install-dependencies,
but otherwise OKed by jlam.
2007-05-22 16:17:15 +00:00

49 lines
1 KiB
Bash
Executable file

#!/bin/sh
#
######################################################################
#
# NAME
# resolve-dependencies -- resolve package dependencies
#
# SYNOPSIS
# resolve-dependencies
#
# DESCRIPTION
# resolve-dependencies checks all entries in ${DEPENDS_FILE}
# for existance. The best matching pattern is printed similiar
# to list-dependencies
#
######################################################################
: ${CAT:=cat}
: ${ECHO:=echo}
: ${TEST:=test}
: ${TRUE:=true}
set -e
DEPENDS_FILE=${_DEPENDS_FILE}
unset _DEPENDS_FILE
error_msg() {
${ECHO} "ERROR:" "$*" 1>&2
}
find_best() {
${PKG_ADMIN} -b -d ${_PKG_DBDIR} -S lsbest $1 || ${TRUE}
}
${CAT} ${DEPENDS_FILE} | while read type pattern dir; do
pkg=`find_best "$pattern"`
case "$pkg" in
"")
error_msg "[resolve-dependencies] A package matching \`\`$pattern'' should"
error_msg " be installed, but one cannot be found. Perhaps there is a"
error_msg " stale work directory for $dir?"
exit 1
;;
*)
${ECHO} "$type $pattern $pkg"
;;
esac
done