pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Rework the way that packages are registered during ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/81316ae86f0e
branches: trunk
changeset: 488019:81316ae86f0e
user: jlam <jlam%pkgsrc.org@localhost>
date: Sun Jan 23 20:45:22 2005 +0000
description:
Rework the way that packages are registered during a "make install". We
split the fake-pkg target into three smaller pieces:
pre-install-fake-pkg - Create files in ${WRKSRC}/.pkgdb meant to be
installed into ${PKG_DBDIR}/${PKGNAME} that don't depend on
the installed files.
post-install-fake-pkg - Create files in ${WRKSRC}/.pkgdb meant to be
installed into ${PKG_DBDIR}/${PKGNAME} that may depend on the
installed files.
register-pkg - Copy the files in ${WRKSRC}/.pkgdb and create a few
additional meta-files in ${PKG_DBDIR}/${PKGNAME}.
The idea is that ${WRKSRC}/.pkgdb contains as much of the state as
possible that will be copied into ${PKG_DBDIR}/${PKGNAME}.
The INSTALL and DEINSTALL scripts generated by bsd.pkg.install.mk are
now invoked with ${WRKSRC}/.pkgdb as the working directory, so the
scripts may use the working directory to store temporary files,
regardless of whether they're invoked from bsd.pkg.mk or by pkg_add.
diffstat:
mk/bsd.pkg.install.mk | 14 ++++--
mk/bsd.pkg.mk | 92 ++++++++++++++++++++++++++++++--------------------
2 files changed, 64 insertions(+), 42 deletions(-)
diffs (237 lines):
diff -r 5b823f2fb386 -r 81316ae86f0e mk/bsd.pkg.install.mk
--- a/mk/bsd.pkg.install.mk Sun Jan 23 20:41:45 2005 +0000
+++ b/mk/bsd.pkg.install.mk Sun Jan 23 20:45:22 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.69 2005/01/15 10:50:17 jmmv Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.70 2005/01/23 20:45:22 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -13,8 +13,8 @@
.include "../../mk/bsd.prefs.mk"
-DEINSTALL_FILE= ${WRKDIR}/.DEINSTALL
-INSTALL_FILE= ${WRKDIR}/.INSTALL
+DEINSTALL_FILE= ${PKG_DB_TMPDIR}/+DEINSTALL
+INSTALL_FILE= ${PKG_DB_TMPDIR}/+INSTALL
# These are the template scripts for the INSTALL/DEINSTALL scripts. Packages
# may do additional work in the INSTALL/DEINSTALL scripts by overriding the
@@ -299,11 +299,13 @@
.PHONY: pre-install-script post-install-script
pre-install-script: generate-install-scripts
- ${_PKG_SILENT}${_PKG_DEBUG}${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${PKG_DB_TMPDIR} && \
+ ${SETENV} ${INSTALL_SCRIPTS_ENV} \
${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
post-install-script:
- ${_PKG_SILENT}${_PKG_DEBUG}${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${PKG_DB_TMPDIR} && \
+ ${SETENV} ${INSTALL_SCRIPTS_ENV} \
${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
.PHONY: generate-install-scripts
@@ -313,6 +315,7 @@
.if !empty(DEINSTALL_SRC)
generate-install-scripts: ${DEINSTALL_FILE}
${DEINSTALL_FILE}: ${DEINSTALL_SRC}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} | \
${SED} ${FILES_SUBST_SED} > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
@@ -321,6 +324,7 @@
.if !empty(INSTALL_SRC)
generate-install-scripts: ${INSTALL_FILE}
${INSTALL_FILE}: ${INSTALL_SRC}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} | \
${SED} ${FILES_SUBST_SED} > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
diff -r 5b823f2fb386 -r 81316ae86f0e mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Sun Jan 23 20:41:45 2005 +0000
+++ b/mk/bsd.pkg.mk Sun Jan 23 20:45:22 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1564 2005/01/22 09:46:55 grant Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1565 2005/01/23 20:45:22 jlam Exp $
#
# This file is in the public domain.
#
@@ -664,11 +664,13 @@
. undef NO_PACKAGE
.endif
+PKG_DB_TMPDIR= ${WRKDIR}/.pkgdb
+
.if !defined(COMMENT)
COMMENT!= (${CAT} ${PKGDIR}/COMMENT || ${ECHO_N} "(no description)") 2>/dev/null
.endif
-DESCR= ${WRKDIR}/.DESCR
+DESCR= ${PKG_DB_TMPDIR}/+DESC
.if !defined(DESCR_SRC)
DESCR_SRC?= ${PKGDIR}/DESCR
.endif
@@ -791,7 +793,7 @@
.endif
.if defined(MESSAGE_SRC)
-MESSAGE= ${WRKDIR}/.MESSAGE
+MESSAGE= ${PKG_DB_TMPDIR}/+DISPLAY
# Set MESSAGE_SUBST to substitute "${variable}" to "value" in MESSAGE
MESSAGE_SUBST+= PKGNAME=${PKGNAME} \
@@ -866,15 +868,15 @@
. endif
# Files to create for versioning and build information
-BUILD_VERSION_FILE= ${WRKDIR}/.build_version
-BUILD_INFO_FILE= ${WRKDIR}/.build_info
+BUILD_VERSION_FILE= ${PKG_DB_TMPDIR}/+BUILD_VERSION
+BUILD_INFO_FILE= ${PKG_DB_TMPDIR}/+BUILD_INFO
# Files containing size of pkg w/o and w/ all required pkgs
-SIZE_PKG_FILE= ${WRKDIR}/.SizePkg
-SIZE_ALL_FILE= ${WRKDIR}/.SizeAll
+SIZE_PKG_FILE= ${PKG_DB_TMPDIR}/+SIZE_PKG
+SIZE_ALL_FILE= ${PKG_DB_TMPDIR}/+SIZE_ALL
# File to denote "no deletion of a package"
-PRESERVE_FILE= ${WRKDIR}/.PRESERVE
+PRESERVE_FILE= ${PKG_DB_TMPDIR}/+PRESERVE
.ifndef PKG_ARGS_COMMON
PKG_ARGS_COMMON= -v -c -${COMMENT:Q}" " -d ${DESCR} -f ${PLIST}
@@ -2634,6 +2636,9 @@
.else
${_PKG_SILENT}${_PKG_DEBUG}[ -d ${PREFIX} ] || ${MKDIR} ${PREFIX}
.endif # !NO_MTREE
+.if !defined(NO_PKG_REGISTER)
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install-fake-pkg
+.endif # !NO_PKG_REGISTER
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install-script
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} do-install
@@ -2729,7 +2734,7 @@
. endif
.endif
.if !defined(NO_PKG_REGISTER)
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} fake-pkg
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} register-pkg
.endif # !NO_PKG_REGISTER
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
.if defined(PKG_DEVELOPER) && (${CHECK_SHLIBS} == "YES")
@@ -4798,35 +4803,15 @@
PKGVIEWS+= ${DEFAULT_VIEW.${PKGBASE}}
-# Fake installation of package so that user can pkg_delete it later.
-# Also, make sure that an installed package is recognized correctly in
-# accordance to the @pkgdep directive in the packing lists.
-
-.PHONY: fake-pkg
-.if !target(fake-pkg)
-fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -f ${PLIST} -o ! -f ${DESCR} ]; then \
- ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; \
- exit 1; \
- fi
- ${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -d ${_PKG_DBDIR} ]; then \
- ${RM} -f ${_PKG_DBDIR}; \
- ${MKDIR} ${_PKG_DBDIR}; \
- fi
-. if defined(FORCE_PKG_REGISTER)
- ${_PKG_SILENT}${_PKG_DEBUG}${PKG_ADMIN} delete ${PKGNAME}
-. if ${PKG_INSTALLATION_TYPE} == "overwrite"
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -rf ${_PKG_DBDIR}/${PKGNAME}
-. endif
-. endif
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILD_VERSION_FILE} ${BUILD_INFO_FILE}
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${SIZE_PKG_FILE} ${SIZE_ALL_FILE}
+.PHONY: pre-install-fake-pkg
+.if !target(pre-install-fake-pkg)
+pre-install-fake-pkg:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${PKG_DB_TMPDIR}
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PRESERVE_FILE}
. if defined(PKG_PRESERVE)
${_PKG_SILENT}${_PKG_DEBUG}${DATE} > ${PRESERVE_FILE}
. endif
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILD_VERSION_FILE}
${_PKG_SILENT}${_PKG_DEBUG} \
files=""; \
for f in ${.CURDIR}/Makefile ${FILESDIR}/* ${PKGDIR}/*; do \
@@ -4851,6 +4836,7 @@
done; \
fi; \
eval ${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^${PKGSRCDIR}/||' > ${BUILD_VERSION_FILE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILD_INFO_FILE}
. for def in ${BUILD_DEFS}
@${ECHO} ${def}=${${def}:Q} | ${SED} -e 's|^PATH=[^ ]*|PATH=...|' >> ${BUILD_INFO_FILE}
. endfor
@@ -4863,6 +4849,31 @@
. ifdef _USE_GMAKE
@${ECHO} "GMAKE=`${GMAKE} --version | ${GREP} Make`" >> ${BUILD_INFO_FILE}
. endif
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} "_PKGTOOLS_VER=${PKGTOOLS_VERSION}" >> ${BUILD_INFO_FILE}
+.endif
+
+.PHONY: post-install-fake-pkg
+.if !target(post-install-fake-pkg)
+post-install-fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${PKG_DB_TMPDIR}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -f ${PLIST} -o ! -f ${DESCR} ]; then \
+ ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; \
+ exit 1; \
+ fi
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -d ${_PKG_DBDIR} ]; then \
+ ${RM} -f ${_PKG_DBDIR}; \
+ ${MKDIR} ${_PKG_DBDIR}; \
+ fi
+. if defined(FORCE_PKG_REGISTER)
+ ${_PKG_SILENT}${_PKG_DEBUG}${PKG_ADMIN} delete ${PKGNAME}
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -rf ${_PKG_DBDIR}/${PKGNAME}
+. endif
+. endif
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${SIZE_PKG_FILE} ${SIZE_ALL_FILE}
. if ${SHLIB_HANDLING} == "YES" && ${CHECK_SHLIBS} == "YES"
${_PKG_SILENT}${_PKG_DEBUG} \
case "${LDD}" in \
@@ -4901,12 +4912,19 @@
done
. endif
${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "_PKGTOOLS_VER=${PKGTOOLS_VERSION}" >> ${BUILD_INFO_FILE}
- ${_PKG_SILENT}${_PKG_DEBUG} \
size_this=`${MAKE} ${MAKEFLAGS} print-pkg-size-this`; \
size_depends=`${MAKE} ${MAKEFLAGS} print-pkg-size-depends`; \
${ECHO} $$size_this >${SIZE_PKG_FILE}; \
${ECHO} $$size_this $$size_depends + p | ${DC} >${SIZE_ALL_FILE}
+.endif
+
+# Fake installation of package so that user can pkg_delete it later.
+# Also, make sure that an installed package is recognized correctly in
+# accordance to the @pkgdep directive in the packing lists.
+#
+.PHONY: register-pkg
+.if !target(register-pkg)
+register-pkg: post-install-fake-pkg
${_PKG_SILENT}${_PKG_DEBUG} \
doit=yes; \
case ${PKG_INSTALLATION_TYPE} in \
@@ -4972,7 +4990,7 @@
!empty(BUILD_VIEWS:M[yY][eE][sS])
${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} build-views
. endif # pkgviews
-.endif # !fake-pkg
+.endif
.PHONY: build-views
build-views: do-su-build-views
Home |
Main Index |
Thread Index |
Old Index