pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/install Rototill of how the various template parts ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/596a86f9d9de
branches: trunk
changeset: 509838:596a86f9d9de
user: jlam <jlam%pkgsrc.org@localhost>
date: Wed Mar 15 04:52:57 2006 +0000
description:
Rototill of how the various template parts of the INSTALL and DEINSTALL
scripts are generated. The various scriptlets in pkgsrc/mk/install
are now full templates that can be combined to form the INSTALL and
DEINSTALL scripts. All of the templates have either leading or trailing
blank lines so that when they are concatentated, the full INSTALL and
DEINSTALL scripts will still be easy to read.
All of the generated template sources for the INSTALL and DEINSTALL
scripts are now stored in ${WRKDIR}/.pkginstall for local consistency
and have been renamed so that they are not dot-files.
The "data" for the +* scriptlets are now generated in a separate step
and instead of being appended to the unpacked scriptlet are now appended
to the INSTALL script itself. When the scriptlets are unpacked, the
corresponding data lines for each scriptlet are pulled out of the
INSTALL script and put into the unpacked scriptlets. This makes it
easy to append more data lines during the install phase without needing
to regenerate the INSTALL script.
diffstat:
mk/install/bsd.pkginstall.mk | 403 ++++++++++++++++++------------------------
mk/install/deinstall | 6 +-
mk/install/deinstall-pre | 5 +-
mk/install/dirs | 17 +-
mk/install/files | 17 +-
mk/install/fonts | 16 +-
mk/install/footer | 5 +-
mk/install/header | 6 +-
mk/install/info-files | 17 +-
mk/install/install | 6 +-
mk/install/install-post | 5 +-
mk/install/perms | 17 +-
mk/install/shell | 16 +-
mk/install/usergroup | 18 +-
14 files changed, 288 insertions(+), 266 deletions(-)
diffs (truncated from 934 to 300 lines):
diff -r 45d2ce13d0fa -r 596a86f9d9de mk/install/bsd.pkginstall.mk
--- a/mk/install/bsd.pkginstall.mk Wed Mar 15 01:33:16 2006 +0000
+++ b/mk/install/bsd.pkginstall.mk Wed Mar 15 04:52:57 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.40 2006/03/14 01:14:36 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.41 2006/03/15 04:52:57 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and implements the
# common INSTALL/DEINSTALL scripts framework. To use the pkginstall
@@ -20,6 +20,13 @@
}' s="$$1" prefix=${PREFIX:Q}/ /dev/null; \
}
+# This is a command that exits with a zero status if the given file
+# is zero-length.
+#
+_ZERO_FILESIZE_P= ${AWK} 'END { exit NR ? 1 : 0; }'
+
+_PKGINSTALL_DIR= ${WRKDIR}/.pkginstall
+
# These are the template scripts for the INSTALL/DEINSTALL scripts.
# Packages may do additional work in the INSTALL/DEINSTALL scripts by
# overriding the variables DEINSTALL_TEMPLATE and INSTALL_TEMPLATE to
@@ -47,6 +54,7 @@
INSTALL_TEMPLATE+= ${PKGDIR}/INSTALL
.endif
_INSTALL_POST_TMPL?= ${.CURDIR}/../../mk/install/install-post
+_INSTALL_DATA_TMPL?= # empty
_FOOTER_TMPL?= ${.CURDIR}/../../mk/install/footer
# _DEINSTALL_TEMPLATES and _INSTALL_TEMPLATES are the list of source
@@ -66,7 +74,8 @@
${_INSTALL_TMPL} \
${INSTALL_TEMPLATE} \
${_INSTALL_POST_TMPL} \
- ${_FOOTER_TMPL}
+ ${_FOOTER_TMPL} \
+ ${_INSTALL_DATA_TMPL} \
_DEINSTALL_TEMPLATES_DFLT= ${_HEADER_TMPL} \
${_DEINSTALL_PRE_TMPL} \
@@ -143,54 +152,46 @@
DEPENDS+= ${_USER_DEPENDS}
.endif
-_INSTALL_USERGROUP_FILE= ${WRKDIR}/.install-usergroup
+_INSTALL_USERGROUP_FILE= ${_PKGINSTALL_DIR}/usergroup
.if exists(../../mk/install/usergroupfuncs.${OPSYS})
_INSTALL_USERGROUPFUNCS_FILE?= ../../mk/install/usergroupfuncs.${OPSYS}
.else
_INSTALL_USERGROUPFUNCS_FILE?= ../../mk/install/usergroupfuncs
.endif
+_INSTALL_USERGROUP_DATAFILE= ${_PKGINSTALL_DIR}/usergroup-data
_INSTALL_UNPACK_TMPL+= ${_INSTALL_USERGROUP_FILE}
-_INSTALL_USERGROUP_MEMBERS= ${PKG_USERS} ${PKG_GROUPS}
+_INSTALL_DATA_TMPL+= ${_INSTALL_USERGROUP_DATAFILE}
+${_INSTALL_USERGROUP_DATAFILE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ set -- dummy ${PKG_GROUPS}; shift; \
+ exec 1>>${.TARGET}.tmp; \
+ while ${TEST} $$# -gt 0; do \
+ i="$$1"; shift; \
+ ${ECHO} "# GROUP: $$i"; \
+ done
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ set -- dummy ${PKG_USERS}; shift; \
+ exec 1>>${.TARGET}.tmp; \
+ while ${TEST} $$# -gt 0; do \
+ i="$$1"; shift; \
+ ${ECHO} "# USER: $$i"; \
+ done
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_INSTALL_USERGROUP_FILE}: ${_INSTALL_USERGROUP_DATAFILE}
${_INSTALL_USERGROUP_FILE}: \
../../mk/install/usergroup \
${INSTALL_USERGROUPFUNCS_FILE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
- ${RM} -f ${.TARGET} ${.TARGET}.tmp; \
- exec 1>>${.TARGET}.tmp; \
- ${ECHO} "# start of install-usergroup"; \
- ${ECHO} "#"; \
- ${ECHO} "# Generate a +USERGROUP script that reference counts users"; \
- ${ECHO} "# and groups that are required for the proper functioning"; \
- ${ECHO} "# of the package."; \
- ${ECHO} "#"; \
- ${ECHO} "case \$${STAGE} in"; \
- ${ECHO} "PRE-INSTALL|UNPACK)"; \
- ${ECHO} " \$${CAT} > ./+USERGROUP << 'EOF_USERGROUP'"; \
- ${SED} -e "/^# platform-specific adduser\/addgroup functions/r${_INSTALL_USERGROUPFUNCS_FILE}" ../../mk/install/usergroup | \
- ${SED} ${FILES_SUBST_SED}; \
- ${ECHO} ""; \
- set -- dummy ${PKG_GROUPS}; shift; \
- while ${TEST} $$# -gt 0; do \
- i="$$1"; shift; \
- ${ECHO} "# GROUP: $$i"; \
- done; \
- set -- dummy ${PKG_USERS}; shift; \
- while ${TEST} $$# -gt 0; do \
- i="$$1"; shift; \
- ${ECHO} "# USER: $$i"; \
- done; \
- ${ECHO} "EOF_USERGROUP"; \
- ${ECHO} " \$${CHMOD} +x ./+USERGROUP"; \
- ${ECHO} " ;;"; \
- ${ECHO} "esac"; \
- ${ECHO} ""; \
- ${ECHO} "# end of install-usergroup"; \
- exec 1>/dev/null; \
- ${MV} -f ${.TARGET}.tmp ${.TARGET}
+ ${SED} -e "/^# platform-specific adduser\/addgroup functions/r${_INSTALL_USERGROUPFUNCS_FILE}" ${FILES_SUBST_SED} \
+ ../../mk/install/usergroup > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG} \
- set -- dummy ${_INSTALL_USERGROUP_MEMBERS}; shift; \
- if ${TEST} $$# -eq 0; then \
+ if ${_ZERO_FILESIZE_P} ${_INSTALL_USERGROUP_DATAFILE}; then \
${RM} -f ${.TARGET}; \
${TOUCH} ${TOUCH_ARGS} ${.TARGET}; \
fi
@@ -213,44 +214,33 @@
SPECIAL_PERMS?= # empty
SETUID_ROOT_PERMS?= ${ROOT_USER} ${ROOT_GROUP} 4711
-_INSTALL_PERMS_FILE= ${WRKDIR}/.install-perms
-_INSTALL_UNPACK_TMPL+= ${_INSTALL_PERMS_FILE}
-_INSTALL_PERMS_MEMBERS= ${SPECIAL_PERMS}
+_INSTALL_PERMS_FILE= ${_PKGINSTALL_DIR}/perms
+_INSTALL_PERMS_DATAFILE= ${_PKGINSTALL_DIR}/perms-data
+_INSTALL_UNPACK_TMPL+= ${_INSTALL_PERMS_FILE}
+_INSTALL_DATA_TMPL+= ${_INSTALL_PERMS_DATAFILE}
-${_INSTALL_PERMS_FILE}: ../../mk/install/perms
+${_INSTALL_PERMS_DATAFILE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${_FUNC_STRIP_PREFIX}; \
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ set -- dummy ${SPECIAL_PERMS}; shift; \
exec 1>>${.TARGET}.tmp; \
- ${ECHO} "# start of install-perms"; \
- ${ECHO} "#"; \
- ${ECHO} "# Generate a +PERMS script that sets the special"; \
- ${ECHO} "# permissions on files and directories used by the"; \
- ${ECHO} "# package."; \
- ${ECHO} "#"; \
- ${ECHO} "case \$${STAGE} in"; \
- ${ECHO} "PRE-INSTALL|UNPACK)"; \
- ${ECHO} " \$${CAT} > ./+PERMS << 'EOF_PERMS'"; \
- ${SED} ${FILES_SUBST_SED} ../../mk/install/perms; \
- ${ECHO} ""; \
- set -- dummy ${SPECIAL_PERMS}; shift; \
while ${TEST} $$# -gt 0; do \
file="$$1"; owner="$$2"; group="$$3"; mode="$$4"; \
shift; shift; shift; shift; \
file=`strip_prefix "$$file"`; \
${ECHO} "# PERMS: $$file $$mode $$owner $$group"; \
- done; \
- ${ECHO} "EOF_PERMS"; \
- ${ECHO} " \$${CHMOD} +x ./+PERMS"; \
- ${ECHO} " ;;"; \
- ${ECHO} "esac"; \
- ${ECHO} ""; \
- ${ECHO} "# end of install-perms"; \
- exec 1>/dev/null; \
- ${MV} -f ${.TARGET}.tmp ${.TARGET}
+ done
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_INSTALL_PERMS_FILE}: ${_INSTALL_PERMS_DATAFILE}
+${_INSTALL_PERMS_FILE}: ../../mk/install/perms
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
- set -- dummy ${_INSTALL_PERMS_MEMBERS}; shift; \
- if ${TEST} $$# -eq 0; then \
+ ${SED} ${FILES_SUBST_SED} ../../mk/install/perms > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if ${_ZERO_FILESIZE_P} ${_INSTALL_PERMS_DATAFILE}; then \
${RM} -f ${.TARGET}; \
${TOUCH} ${TOUCH_ARGS} ${.TARGET}; \
fi
@@ -295,26 +285,15 @@
MESSAGE_SUBST+= RCD_SCRIPTS_DIR=${RCD_SCRIPTS_DIR}
MESSAGE_SUBST+= RCD_SCRIPTS_EXAMPLEDIR=${RCD_SCRIPTS_EXAMPLEDIR}
-_INSTALL_FILES_FILE= ${WRKDIR}/.install-files
-_INSTALL_UNPACK_TMPL+= ${_INSTALL_FILES_FILE}
-_INSTALL_FILES_MEMBERS= ${RCD_SCRIPTS} ${CONF_FILES} ${REQD_FILES} \
- ${CONF_FILES_PERMS} ${REQD_FILES_PERMS}
+_INSTALL_FILES_FILE= ${_PKGINSTALL_DIR}/files
+_INSTALL_FILES_DATAFILE= ${_PKGINSTALL_DIR}/files-data
+_INSTALL_UNPACK_TMPL+= ${_INSTALL_FILES_FILE}
+_INSTALL_DATA_TMPL+= ${_INSTALL_FILES_DATAFILE}
-${_INSTALL_FILES_FILE}: ../../mk/install/files
+${_INSTALL_FILES_DATAFILE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG} \
- exec 1>>${.TARGET}.tmp; \
- ${ECHO} "# start of install-files"; \
- ${ECHO} "#"; \
- ${ECHO} "# Generate a +FILES script that reference counts config"; \
- ${ECHO} "# files that are required for the proper functioning"; \
- ${ECHO} "# of the package."; \
- ${ECHO} "#"; \
- ${ECHO} "case \$${STAGE} in"; \
- ${ECHO} "PRE-INSTALL|UNPACK)"; \
- ${ECHO} " \$${CAT} > ./+FILES << 'EOF_FILES'"; \
- ${SED} ${FILES_SUBST_SED} ../../mk/install/files; \
- ${ECHO} ""
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
set -- dummy ${RCD_SCRIPTS}; shift; \
exec 1>>${.TARGET}.tmp; \
@@ -366,18 +345,15 @@
file=`strip_prefix "$$file"`; \
${ECHO} "# FILE: $$file cf $$egfile $$mode $$owner $$group"; \
done
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_INSTALL_FILES_FILE}: ${_INSTALL_FILES_DATAFILE}
+${_INSTALL_FILES_FILE}: ../../mk/install/files
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
- exec 1>>${.TARGET}.tmp; \
- ${ECHO} "EOF_FILES"; \
- ${ECHO} " \$${CHMOD} +x ./+FILES"; \
- ${ECHO} " ;;"; \
- ${ECHO} "esac"; \
- ${ECHO} ""; \
- ${ECHO} "# end of install-files"; \
- ${MV} -f ${.TARGET}.tmp ${.TARGET}
+ ${SED} ${FILES_SUBST_SED} ../../mk/install/files > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG} \
- set -- dummy ${_INSTALL_FILES_MEMBERS}; shift; \
- if ${TEST} $$# -eq 0; then \
+ if ${_ZERO_FILESIZE_P} ${_INSTALL_FILES_DATAFILE}; then \
${RM} -f ${.TARGET}; \
${TOUCH} ${TOUCH_ARGS} ${.TARGET}; \
fi
@@ -409,95 +385,87 @@
OWN_DIRS?= # empty
OWN_DIRS_PERMS?= # empty
-_INSTALL_DIRS_FILE= ${WRKDIR}/.install-dirs
+_INSTALL_DIRS_FILE= ${_PKGINSTALL_DIR}/dirs
+_INSTALL_DIRS_DATAFILE= ${_PKGINSTALL_DIR}/dirs-data
_INSTALL_UNPACK_TMPL+= ${_INSTALL_DIRS_FILE}
-_INSTALL_DIRS_MEMBERS= ${PKG_SYSCONFSUBDIR} ${RCD_SCRIPTS} \
- ${CONF_FILES} ${CONF_FILES_PERMS} \
- ${MAKE_DIRS} ${MAKE_DIRS_PERMS} \
- ${REQD_DIRS} ${REDQ_DIRS_PERMS} \
- ${OWN_DIRS} ${OWN_DIRS_PERMS}
+_INSTALL_DATA_TMPL+= ${_INSTALL_DIRS_DATAFILE}
-${_INSTALL_DIRS_FILE}: ../../mk/install/dirs
+${_INSTALL_DIRS_DATAFILE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG} \
- exec 1>>${.TARGET}.tmp; \
- ${ECHO} "# start of install-dirs"; \
- ${ECHO} "#"; \
- ${ECHO} "# Generate a +DIRS script that reference counts directories"; \
- ${ECHO} "# that are required for the proper functioning of the"; \
- ${ECHO} "# package."; \
- ${ECHO} "#"; \
- ${ECHO} "case \$${STAGE} in"; \
- ${ECHO} "PRE-INSTALL|UNPACK)"; \
- ${ECHO} " \$${CAT} > ./+DIRS << 'EOF_DIRS'"; \
- ${SED} ${FILES_SUBST_SED} ../../mk/install/dirs; \
- ${ECHO} ""
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG} \
exec 1>>${.TARGET}.tmp; \
case ${PKG_SYSCONFSUBDIR:M*:Q}${CONF_FILES:M*:Q}${CONF_FILES_PERMS:M*:Q}"" in \
"") ;; \
*) ${ECHO} "# DIR: ${PKG_SYSCONFDIR:S/${PREFIX}\///} m" ;; \
- esac; \
+ esac
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ exec 1>>${.TARGET}.tmp; \
case ${RCD_SCRIPTS:M*:Q}"" in \
"") ;; \
*) ${ECHO} "# DIR: ${RCD_SCRIPTS_DIR:S/${PREFIX}\///} m" ;; \
esac
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ set -- dummy ${MAKE_DIRS}; shift; \
exec 1>>${.TARGET}.tmp; \
- set -- dummy ${MAKE_DIRS}; shift; \
while ${TEST} $$# -gt 0; do \
dir="$$1"; shift; \
dir=`strip_prefix "$$dir"`; \
Home |
Main Index |
Thread Index |
Old Index