diff options
author | jlam <jlam> | 2006-03-09 00:20:27 +0000 |
---|---|---|
committer | jlam <jlam> | 2006-03-09 00:20:27 +0000 |
commit | 83517a71ae8009102e062ea4c52cb74fc4562ef4 (patch) | |
tree | 057d55d1354373f16305418acfc17bd78ac85929 /mk/install | |
parent | 7b6583a7abf80924383e4fbadc700a8de27bd6c0 (diff) | |
download | pkgsrc-83517a71ae8009102e062ea4c52cb74fc4562ef4.tar.gz |
Reimplement the info-file handling so that we use an +INFO_FILES
scriptlet to manage the info-file registration. The new scriptlet's
template is install/info-files. Remove obsolete texinfo.mk and
install/install-info.
No changes to package Makefiles are necessary -- the re-implementation
is internal to pkgsrc infrastructure.
Diffstat (limited to 'mk/install')
-rw-r--r-- | mk/install/bsd.pkginstall.mk | 49 | ||||
-rw-r--r-- | mk/install/deinstall | 7 | ||||
-rw-r--r-- | mk/install/info-files | 110 | ||||
-rw-r--r-- | mk/install/install | 7 | ||||
-rw-r--r-- | mk/install/install-info | 37 | ||||
-rw-r--r-- | mk/install/pkginstall.mk | 3 |
6 files changed, 172 insertions, 41 deletions
diff --git a/mk/install/bsd.pkginstall.mk b/mk/install/bsd.pkginstall.mk index fb4121ab558..436f2a055ef 100644 --- a/mk/install/bsd.pkginstall.mk +++ b/mk/install/bsd.pkginstall.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkginstall.mk,v 1.34 2006/01/01 18:53:03 wiz Exp $ +# $NetBSD: bsd.pkginstall.mk,v 1.35 2006/03/09 00:20:27 jlam Exp $ # # This Makefile fragment is included by mk/install/pkginstall.mk and is # the implemenation file for the common INSTALL/DEINSTALL scripts @@ -492,6 +492,53 @@ ${INSTALL_DIRS_FILE}: ../../mk/install/dirs ${MV} -f ${.TARGET}.tmp ${.TARGET} .endif +# INFO_FILES contains names of info files that should be registered or +# removed from the info directory indices. The listed info files +# are assumed to be directly under ${INFO_DIR}. +# +INFO_FILES?= # empty + +INSTALL_INFO_FILES_FILE= ${WRKDIR}/.install-info-files +INSTALL_INFO_FILES_MEMBERS= ${INFO_FILES} +INSTALL_UNPACK_TMPL+= ${INSTALL_INFO_FILES_FILE} + +.if !empty(INFO_FILES:M*) +USE_TOOLS+= install-info:run +FILES_SUBST+= INSTALL_INFO=${INSTALL_INFO:Q} +.endif + +${INSTALL_INFO_FILES_FILE}: ../../mk/install/info-files + ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${_FUNC_STRIP_PREFIX}; \ + exec 1>>${.TARGET}.tmp; \ + ${ECHO} "# start of install-info-files"; \ + ${ECHO} "#"; \ + ${ECHO} "# Generate an +INFO_FILES script that handles info file registration."; \ + ${ECHO} "#"; \ + ${ECHO} "case \$${STAGE} in"; \ + ${ECHO} "PRE-INSTALL|UNPACK)"; \ + ${ECHO} " \$${CAT} > ./+INFO_FILES << 'EOF_INFO_FILES'"; \ + ${SED} ${FILES_SUBST_SED} ../../mk/install/info-files; \ + ${ECHO} ""; \ + set -- dummy ${INFO_FILES}; shift; \ + while ${TEST} $$# -gt 0; do \ + file="$$1"; shift; \ + file=${INFO_DIR:Q}"/$$file"; \ + ${ECHO} "# INFO: $$file"; \ + done; \ + ${ECHO} "EOF_INFO_FILES"; \ + ${ECHO} " \$${CHMOD} +x ./+INFO_FILES"; \ + ${ECHO} " ;;"; \ + ${ECHO} "esac"; \ + ${ECHO} ""; \ + ${ECHO} "# end of install-info-files"; \ + exec 1>/dev/null; \ + ${MV} -f ${.TARGET}.tmp ${.TARGET} + ${_PKG_SILENT}${_PKG_DEBUG} \ + set -- dummy ${INFO_FILES}; shift; \ + ${TEST} $$# -gt 0 || ${ECHO} > ${.TARGET} + # PKG_SHELL contains the pathname of the shell that should be added or # removed from the shell database, /etc/shells. If a pathname # is relative, then it is taken to be relative to ${PREFIX}. diff --git a/mk/install/deinstall b/mk/install/deinstall index ec75988d222..21f4b41b8a0 100644 --- a/mk/install/deinstall +++ b/mk/install/deinstall @@ -1,7 +1,7 @@ # -*- sh -*- # start of deinstall # -# $NetBSD: deinstall,v 1.37 2005/12/29 03:44:38 jlam Exp $ +# $NetBSD: deinstall,v 1.38 2006/03/09 00:20:27 jlam Exp $ case ${STAGE} in VIEW-DEINSTALL) @@ -21,6 +21,11 @@ VIEW-DEINSTALL) ;; esac # + # Unregister info files. + # + ${TEST} ! -x ./+INFO_FILES || + ./+INFO_FILES REMOVE ${PKG_METADATA_DIR} + # # Remove shells from /etc/shells. # ${TEST} ! -x ./+SHELL || diff --git a/mk/install/info-files b/mk/install/info-files new file mode 100644 index 00000000000..def4b50ea59 --- /dev/null +++ b/mk/install/info-files @@ -0,0 +1,110 @@ +#!@SH@ +# +# $NetBSD: info-files,v 1.1 2006/03/09 00:20:27 jlam Exp $ +# +# +INFO_FILES - info file registration management script +# +# Usage: ./+INFO_FILES ADD|REMOVE [metadatadir] +# +# This script supports two actions, ADD and REMOVE, that will add or +# remove entries for info files from the package associated with +# <metadatadir> from the info index files (the "dir" file in the +# same directory as the info files). +# +# Lines starting with "# INFO: " are data read by this script that +# name the info files that will be added or removed from the "dir" +# index files. +# +# # INFO: /usr/pkg/info/bar.info +# # INFO: /usr/pkg/info/baz.info +# +# For each INFO entry, if the path is relative, that it is taken to be +# relative to ${PKG_PREFIX}. +# + +ECHO="@ECHO@" +GREP="@GREP@" +INSTALL_INFO="@INSTALL_INFO@" +PWD_CMD="@PWD_CMD@" +RM="@RM@" +SED="@SED@" +SORT="@SORT@" +TEST="@TEST@" + +SELF=$0 +ACTION=$1 + +PKG_METADATA_DIR="${2-`${PWD_CMD}`}" +: ${PKGNAME=${PKG_METADATA_DIR##*/}} +: ${PKG_PREFIX=@PREFIX@} + +exitcode=0 +case $ACTION in +ADD) + ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u | + { while read file; do + case $file in + "") continue ;; + [!/]*) file="${PKG_PREFIX}/$file" ;; + esac + + case "$printed_header" in + yes) ;; + *) printed_header=yes + ${ECHO} "===========================================================================" + ${ECHO} "Registering info files for ${PKGNAME}:" + ${ECHO} "" + ;; + esac + + infodir="${file%/*}" + infoindex="$infodir/dir" + nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`" + case "$nentries" in + [0-9]*) ${TEST} $nentries -gt 0 || ${RM} $infoindex ;; + esac + ${ECHO} " $file" + ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1 + ${INSTALL_INFO} --info-dir="$infodir" $file >/dev/null 2>&1 + done + case "$printed_header" in + yes) ${ECHO} "" + ${ECHO} "===========================================================================" + ;; + esac; } + ;; + +REMOVE) + ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u | + { while read file; do + case $file in + "") continue ;; + [!/]*) file="${PKG_PREFIX}/$file" ;; + esac + + case "$printed_header" in + yes) ;; + *) printed_header=yes + ${ECHO} "===========================================================================" + ${ECHO} "Unregistering info files for ${PKGNAME}:" + ${ECHO} "" + ;; + esac + + infodir="${file%/*}" + infoindex="$infodir/dir" + ${ECHO} " $file" + ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1 + nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`" + case "$nentries" in + [0-9]*) ${TEST} $nentries -gt 1 || ${RM} $infoindex ;; + esac + done + case "$printed_header" in + yes) ${ECHO} "" + ${ECHO} "===========================================================================" + ;; + esac; } + ;; +esac +exit $exitcode diff --git a/mk/install/install b/mk/install/install index 0a701413846..3abe5690487 100644 --- a/mk/install/install +++ b/mk/install/install @@ -1,7 +1,7 @@ # -*- sh -*- # start of install # -# $NetBSD: install,v 1.42 2005/12/29 03:44:38 jlam Exp $ +# $NetBSD: install,v 1.43 2006/03/09 00:20:27 jlam Exp $ case ${STAGE} in PRE-INSTALL) @@ -74,6 +74,11 @@ VIEW-INSTALL) ./+SHELL ADD ${PKG_METADATA_DIR} ${TEST} ! -x ./+SHELL || ./+SHELL CHECK-ADD ${PKG_METADATA_DIR} + # + # Register info files. + # + ${TEST} ! -x ./+INFO_FILES || + ./+INFO_FILES ADD ${PKG_METADATA_DIR} # If ${PKG_SYSCONFBASE} points outside of ${PREFIX}, then add the # package config files to the proper view. diff --git a/mk/install/install-info b/mk/install/install-info deleted file mode 100644 index 76ba6d0b1d6..00000000000 --- a/mk/install/install-info +++ /dev/null @@ -1,37 +0,0 @@ -# $NetBSD: install-info,v 1.7 2003/11/23 07:03:07 jlam Exp $ -# -# Handle registration of Info files; used by texinfo.mk. -# - -INFO_FILES="@INFO_FILES@" -INSTALL_INFO="@INSTALL_INFO@" -INFO_DIR="@INFO_DIR@" - -case ${STAGE} in -VIEW-INSTALL) - if [ -f ${PKG_PREFIX}/${INFO_DIR}/dir ]; then - _nentries="`${GREP} -c '^\*' ${PKG_PREFIX}/${INFO_DIR}/dir 2>/dev/null`" - if [ x"${_nentries}" != x -a "${_nentries}" -lt 1 ]; then - ${RM} ${PKG_PREFIX}/${INFO_DIR}/dir - fi - - fi - for f in ${INFO_FILES}; do - ${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \ - ${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1 - ${INSTALL_INFO} --info-dir=${PKG_PREFIX}/${INFO_DIR} \ - ${PKG_PREFIX}/${INFO_DIR}/${f} - done - ;; - -VIEW-DEINSTALL) - for f in ${INFO_FILES}; do - ${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \ - ${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1 - done - _nentries="`${GREP} -c '^\*' ${PKG_PREFIX}/${INFO_DIR}/dir 2>/dev/null`" - if [ x"${_nentries}" != x -a "${_nentries}" -le 1 ]; then - ${RM} ${PKG_PREFIX}/${INFO_DIR}/dir - fi - ;; -esac diff --git a/mk/install/pkginstall.mk b/mk/install/pkginstall.mk index c22fce12289..85851a89279 100644 --- a/mk/install/pkginstall.mk +++ b/mk/install/pkginstall.mk @@ -1,4 +1,4 @@ -# $NetBSD: pkginstall.mk,v 1.3 2006/01/11 04:42:12 jlam Exp $ +# $NetBSD: pkginstall.mk,v 1.4 2006/03/09 00:20:27 jlam Exp $ # # This Makefile fragment is included by bsd.pkg.mk and determines whether # or not the bsd.pkginstall.mk implementation file should be included. @@ -26,6 +26,7 @@ _PKGINSTALL_VARS+= SPECIAL_PERMS _PKGINSTALL_VARS+= CONF_FILES CONF_FILES_PERMS \ REQD_FILES REQD_FILES_PERMS \ RCD_SCRIPTS +_PKGINSTALL_VARS+= INFO_FILES _PKGINSTALL_VARS+= MAKE_DIRS MAKE_DIRS_PERMS \ REQD_DIRS REQD_DIRS_PERMS \ OWN_DIRS OWN_DIRS_PERMS |