pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Make depends-cookie a flavor indendepent target. Be...
details: https://anonhg.NetBSD.org/pkgsrc/rev/5a21d4e48c3d
branches: trunk
changeset: 528999:5a21d4e48c3d
user: joerg <joerg%pkgsrc.org@localhost>
date: Tue May 22 16:17:15 2007 +0000
description:
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.
diffstat:
mk/depends/bsd.depends.mk | 7 +-
mk/depends/depends.mk | 3 +-
mk/flavor/pkg/depends.mk | 186 ++++++++++++++---------------------
mk/flavor/pkg/install-dependencies | 85 ++++++++++++++++
mk/flavor/pkg/install.mk | 7 +-
mk/flavor/pkg/list-dependencies | 67 ++++++++++++
mk/flavor/pkg/metadata.mk | 38 ++----
mk/flavor/pkg/register-dependencies | 17 +--
mk/flavor/pkg/resolve-dependencies | 49 +++++++++
9 files changed, 304 insertions(+), 155 deletions(-)
diffs (truncated from 644 to 300 lines):
diff -r e6023ed8f5b2 -r 5a21d4e48c3d mk/depends/bsd.depends.mk
--- a/mk/depends/bsd.depends.mk Tue May 22 15:57:27 2007 +0000
+++ b/mk/depends/bsd.depends.mk Tue May 22 16:17:15 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.depends.mk,v 1.13 2007/03/23 21:21:33 jlam Exp $
+# $NetBSD: bsd.depends.mk,v 1.14 2007/05/22 16:17:15 joerg Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to dependencies.
@@ -97,16 +97,11 @@
### depends-cookie creates the depends "cookie" state file. This should
### be overridden per package system flavor.
###
-### XXX: Why? The other cookies are also created by pkgsrc, not by the
-### flavor.
-###
.PHONY: depends-cookie
-.if !target(depends-cookie)
depends-cookie:
${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${_COOKIE.depends} || ${FALSE}
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_COOKIE.depends:H}
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${_COOKIE.depends}
-.endif
# show-depends:
# Prints a list of dependencies.
diff -r e6023ed8f5b2 -r 5a21d4e48c3d mk/depends/depends.mk
--- a/mk/depends/depends.mk Tue May 22 15:57:27 2007 +0000
+++ b/mk/depends/depends.mk Tue May 22 16:17:15 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.12 2007/03/09 00:39:54 rillig Exp $
+# $NetBSD: depends.mk,v 1.13 2007/05/22 16:17:16 joerg Exp $
######################################################################
### depends (PUBLIC)
@@ -40,6 +40,7 @@
_REAL_DEPENDS_TARGETS+= depends-message
_REAL_DEPENDS_TARGETS+= pre-depends-hook
_REAL_DEPENDS_TARGETS+= _flavor-install-dependencies
+_REAL_DEPENDS_TARGETS+= _flavor-post-install-dependencies
_REAL_DEPENDS_TARGETS+= depends-cookie
_REAL_DEPENDS_TARGETS+= error-check
diff -r e6023ed8f5b2 -r 5a21d4e48c3d mk/flavor/pkg/depends.mk
--- a/mk/flavor/pkg/depends.mk Tue May 22 15:57:27 2007 +0000
+++ b/mk/flavor/pkg/depends.mk Tue May 22 16:17:15 2007 +0000
@@ -1,23 +1,31 @@
-# $NetBSD: depends.mk,v 1.26 2007/03/19 16:43:59 joerg Exp $
-
-_DEPENDS_FILE= ${WRKDIR}/.depends
-_REDUCE_DEPENDS_CMD= ${SETENV} CAT=${CAT:Q} \
- PKG_ADMIN=${PKG_ADMIN_CMD:Q} \
- PWD_CMD=${PWD_CMD:Q} TEST=${TEST:Q} \
- ${AWK} -f ${PKGSRCDIR}/mk/flavor/pkg/reduce-depends.awk
+# $NetBSD: depends.mk,v 1.27 2007/05/22 16:17:16 joerg Exp $
# This command prints out the dependency patterns for all full (run-time)
# dependencies of the package.
#
# This is used in install.mk and metadata.mk.
#
-_DEPENDS_PATTERNS_CMD= \
- [ ! -f ${_COOKIE.depends} ] \
- || ${AWK} '$$1 == "full" { print $$2; }' < ${_COOKIE.depends}
-_BUILD_DEPENDS_PATTERNS_CMD= \
- [ ! -f ${_COOKIE.depends} ] \
- || ${AWK} '$$1 == "build" { print $$2; }' < ${_COOKIE.depends}
+# ${_DEPENDS_FILE} contains all the dependency information
+# for the package. The format of each line of the file is:
+#
+# <depends_type> <pattern> <directory>
+#
+# Valid dependency types are "bootstrap", "build" and "full".
+#
+# ${_RDEPENDS_FILE} contains the resolved dependency information
+# for the package. For each line in ${_DEPENDS_FILE}
+# a corresponding line of the following form exists:
+#
+# <depends_type> <pattern> <pkg>
+#
+# "pkg" is the match for "pattern" used to fulfill the dependency.
+#
+_DEPENDS_FILE= ${WRKDIR}/.depends
+_RDEPENDS_FILE= ${WRKDIR}/.rdepends
+
+_FULL_DEPENDS_CMD= \
+ ${AWK} '$$1 == "full" { print $$3; }' < ${_RDEPENDS_FILE}
_flavor-show-depends: .PHONY
@case ${VARNAME:Q}"" in \
@@ -25,59 +33,61 @@
DEPENDS|*) ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} ;; \
esac
-######################################################################
-### depends-cookie (PRIVATE, pkgsrc/mk/depends/bsd.depends.mk)
-######################################################################
-### depends-cookie creates the "depends" cookie file.
-###
-### The "depends" cookie file contains all of the dependency information
-### for the package. The format of each line of the cookie file is:
-###
-### <depends_type> <pattern> <directory>
-###
-### Valid dependency types are "build" and "full".
-###
-.PHONY: depends-cookie
-depends-cookie: ${_DEPENDS_FILE}
- ${RUN} [ ! -f ${_COOKIE.depends} ]
- ${RUN} ${MKDIR} ${_COOKIE.depends:H}
- ${RUN} ${MV} -f ${_DEPENDS_FILE} ${_COOKIE.depends}
+_LIST_DEPENDS_CMD= \
+ ${SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \
+ PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \
+ ${SH} ${PKGSRCDIR}/mk/flavor/pkg/list-dependencies \
+ " "${BOOTSTRAP_DEPENDS:Q} \
+ " "${BUILD_DEPENDS:Q} \
+ " "${DEPENDS:Q}
+
+_RESOLVE_DEPENDS_CMD= \
+ ${SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} PKG_ADMIN=${PKG_ADMIN:Q} \
+ _DEPENDS_FILE=${_DEPENDS_FILE:Q} \
+ ${SH} ${PKGSRCDIR}/mk/flavor/pkg/resolve-dependencies \
+ " "${BOOTSTRAP_DEPENDS:Q} \
+ " "${BUILD_DEPENDS:Q} \
+ " "${DEPENDS:Q}
+
+_INSTALL_DEPENDS_CMD= \
+ ${SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} \
+ _PKGSRC_DEPS=${_PKSRC_DEPS:Q} \
+ _DEPENDS_FILE=${_DEPENDS_FILE:Q} \
+ DEPENDS_TARGET=${DEPENDS_TARGET:Q} \
+ MAKE=${MAKE:Q} \
+ MAKEFLAGS=${MAKEFLAGS:Q} \
+ OBJECT_FMT=${OBJECT_FMT:Q} \
+ PKG_ADMIN=${PKG_ADMIN_CMD:Q} \
+ PKG_INFO=${PKG_INFO:Q} \
+ _PKGNAME=${PKGNAME:Q} \
+ PKGSRC_MAKE_ENV=${PKGSRC_MAKE_ENV:Q} \
+ SETENV=${SETENV:Q} \
+ ${SH} ${PKGSRCDIR}/mk/flavor/pkg/install-dependencies
+
+bootstrap-depends: ${_DEPENDS_FILE}
${_DEPENDS_FILE}:
${RUN} ${MKDIR} ${.TARGET:H}
- ${RUN} ${_REDUCE_DEPENDS_CMD} ${BOOTSTRAP_DEPENDS:Q}\ ${BUILD_DEPENDS:Q} > ${.TARGET}.build
- ${RUN} \
- exec 0< ${.TARGET}.build; \
- while read dep; do \
- pattern=`${ECHO} "$$dep" | ${SED} -e "s,:.*,,"`; \
- dir=`${ECHO} "$$dep" | ${SED} -e "s,.*:,,"`; \
- [ "$$pattern" ]; \
- [ "$$dir" ]; \
- ${ECHO} "build $$pattern $$dir"; \
- done >> ${.TARGET}.tmp
- ${RUN} ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} > ${.TARGET}.full
- ${RUN} \
- exec 0< ${.TARGET}.full; \
- while read dep; do \
- pattern=`${ECHO} "$$dep" | ${SED} -e "s,:.*,,"`; \
- dir=`${ECHO} "$$dep" | ${SED} -e "s,.*:,,"`; \
- [ "$$pattern" ]; \
- [ "$$dir" ]; \
- ${ECHO} "full $$pattern $$dir"; \
- done >> ${.TARGET}.tmp
- ${RUN} ${MV} ${.TARGET}.tmp ${.TARGET}
+ ${RUN} ${_LIST_DEPENDS_CMD} > ${.TARGET}
+
+${_RDEPENDS_FILE}: ${_DEPENDS_FILE}
+ ${RUN} ${_RESOLVE_DEPENDS_CMD} > ${.TARGET}
+
+# _flavor-list-dependencies:
+# Compute dependency list.
+#
+_flavor-list-dependencies: .PHONY ${_DEPENDS_FILE}
# _flavor-install-dependencies:
# Installs any missing dependencies.
#
_flavor-install-dependencies: .PHONY ${_DEPENDS_FILE}
- ${RUN} \
- while read type pattern dir rest; do \
- { [ "$$dir" ] && [ ! "$$rest" ]; } \
- || ${FAIL_MSG} "[depends.mk] Internal error #1: Check ${_DEPENDS_FILE}"; \
- silent=; \
- ${_DEPENDS_INSTALL_CMD}; \
- done < ${_DEPENDS_FILE}
+ ${RUN}${_INSTALL_DEPENDS_CMD}
+
+# _flavor-post-install-dependencies:
+# Targets after installing all dependencies.
+#
+_flavor-post-install-dependencies: .PHONY ${_RDEPENDS_FILE}
######################################################################
### bootstrap-depends (PUBLIC, pkgsrc/mk/depends/depends.mk)
@@ -87,55 +97,13 @@
### stage. These dependencies are listed in BOOTSTRAP_DEPENDS.
###
.PHONY: bootstrap-depends
-bootstrap-depends:
- ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
- args=${BOOTSTRAP_DEPENDS:S/:/ /:Q}; \
- set -- dummy $$args; shift; \
- while ${TEST} $$# -gt 0; do \
- pattern="$$1"; dir="$$2"; shift 2; \
- silent=${_BOOTSTRAP_VERBOSE:Dyes}; \
- ${_DEPENDS_INSTALL_CMD}; \
- done
+_BOOTSTRAP_DEPENDS_TARGETS+= acquire-bootstrap-depends-lock
+_BOOTSTRAP_DEPENDS_TARGETS+= ${_DEPENDS_FILE}
+_BOOTSTRAP_DEPENDS_TARGETS+= release-bootstrap-depends-lock
-# _DEPENDS_INSTALL_CMD expects "$pattern" to hold the dependency pattern
-# and "$dir" to hold the package directory path associated with
-# that dependency pattern.
-#
-_DEPENDS_INSTALL_CMD= \
- pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \
- case "$$pkg" in \
- "") \
- ${STEP_MSG} "Required installed package $$pattern: NOT found"; \
- target=${DEPENDS_TARGET:Q}; \
- ${STEP_MSG} "Verifying $$target for $$dir"; \
- if ${TEST} ! -d "$$dir"; then \
- ${ERROR_MSG} "[depends.mk] The directory \`\`$$dir'' does not exist."; \
- exit 1; \
- fi; \
- cd $$dir; \
- ${SETENV} ${PKGSRC_MAKE_ENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" PKGNAME_REQD="$$pattern" ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target; \
- pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \
- case "$$pkg" in \
- "") ${ERROR_MSG} "[depends.mk] 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; \
- esac; \
- ${STEP_MSG} "Returning to build of ${PKGNAME}"; \
- ;; \
- *) \
- objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`; \
- case "$$objfmt" in \
- "") ${WARNING_MSG} "[depends.mk] Unknown object format for installed package $$pkg" ;; \
- ${OBJECT_FMT}) ;; \
- *) ${ERROR_MSG} "[depends.mk] Installed package $$pkg has an"; \
- ${ERROR_MSG} " object format \`\`$$objfmt'' which differs from \`\`${OBJECT_FMT}''. Please"; \
- ${ERROR_MSG} " update the $$pkg package to ${OBJECT_FMT}."; \
- exit 1; \
- ;; \
- esac; \
- if ${TEST} -z "$$silent"; then \
- ${STEP_MSG} "Required installed package $$pattern: $$pkg found"; \
- fi; \
- ;; \
- esac
+bootstrap-depends: ${_BOOTSTRAP_DEPENDS_TARGETS}
+ ${RUN}${_INSTALL_DEPENDS_CMD} bootstrap
+
+.PHONY:
+acquire-bootstrap-depends-lock: acquire-lock
+release-bootstrap-depends-lock: release-lock
diff -r e6023ed8f5b2 -r 5a21d4e48c3d mk/flavor/pkg/install-dependencies
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/flavor/pkg/install-dependencies Tue May 22 16:17:15 2007 +0000
@@ -0,0 +1,85 @@
+#!/bin/sh
+#
+######################################################################
+#
+# NAME
+# install-dependencies -- install package dependencies
+#
+# SYNOPSIS
+# register-dependencies [ filter ]
+#
+# DESCRIPTION
+# install-dependencies checks all entries in ${DEPENDS_FILE}
+# for existance. Missing entries get installed by
+# ${DEPENDS_TARGET} in the listed directory.
+#
+######################################################################
+
+: ${CAT:=cat}
+: ${ECHO:=echo}
+: ${TEST:=test}
+: ${TRUE:=true}
+
+set -e
+
+DEPENDS_FILE=${_DEPENDS_FILE}
+unset _DEPENDS_FILE
+PKGNAME=${_PKGNAME}
+unset _PKGNAME
+
+if [ $# = 1 ]; then
+ type_filter=$1
+else
+ type_filter=all
Home |
Main Index |
Thread Index |
Old Index