summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam>2006-03-09 00:20:27 +0000
committerjlam <jlam>2006-03-09 00:20:27 +0000
commit83517a71ae8009102e062ea4c52cb74fc4562ef4 (patch)
tree057d55d1354373f16305418acfc17bd78ac85929
parent7b6583a7abf80924383e4fbadc700a8de27bd6c0 (diff)
downloadpkgsrc-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.
-rw-r--r--mk/bsd.pkg.mk5
-rw-r--r--mk/bsd.pkg.use.mk10
-rw-r--r--mk/install/bsd.pkginstall.mk49
-rw-r--r--mk/install/deinstall7
-rw-r--r--mk/install/info-files110
-rw-r--r--mk/install/install7
-rw-r--r--mk/install/install-info37
-rw-r--r--mk/install/pkginstall.mk3
-rw-r--r--mk/texinfo.mk30
9 files changed, 176 insertions, 82 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index fe91018f476..2575ce8c719 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1801 2006/03/04 21:30:13 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1802 2006/03/09 00:20:27 jlam Exp $
#
# This file is in the public domain.
#
@@ -585,7 +585,8 @@ CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q}
CONFIGURE_HAS_INFODIR?= yes
GNU_CONFIGURE_INFODIR?= ${GNU_CONFIGURE_PREFIX}/${INFO_DIR}
-. if !empty(INFO_FILES) && !empty(CONFIGURE_HAS_INFODIR:M[yY][eE][sS])
+. if defined(INFO_FILES) && !empty(INFO_FILES) && \
+ !empty(CONFIGURE_HAS_INFODIR:M[yY][eE][sS])
CONFIGURE_ARGS+= --infodir=${GNU_CONFIGURE_INFODIR:Q}
. endif
diff --git a/mk/bsd.pkg.use.mk b/mk/bsd.pkg.use.mk
index 5786956003e..f405648353d 100644
--- a/mk/bsd.pkg.use.mk
+++ b/mk/bsd.pkg.use.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.use.mk,v 1.28 2006/03/05 16:27:29 jlam Exp $
+# $NetBSD: bsd.pkg.use.mk,v 1.29 2006/03/09 00:20:27 jlam Exp $
#
# Turn USE_* macros into proper depedency logic. Included near the top of
# bsd.pkg.mk, after bsd.prefs.mk.
@@ -103,14 +103,6 @@ MAKE_ENV+= LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
LIBTOOL_OVERRIDE?= libtool */libtool */*/libtool
.endif
-### INFO_FILES
-
-INFO_FILES?= # empty
-
-.if !empty(INFO_FILES)
-. include "../../mk/texinfo.mk"
-.endif
-
### USE_RMAN
# Check if we got "rman" with XFree86, for packages that need "rman".
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
diff --git a/mk/texinfo.mk b/mk/texinfo.mk
deleted file mode 100644
index 4ded93b7bfd..00000000000
--- a/mk/texinfo.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# $NetBSD: texinfo.mk,v 1.33 2006/03/06 05:25:45 jlam Exp $
-
-#
-# This Makefile fragment is included by bsd.pkg.mk when INFO_FILES is
-# not empty.
-#
-
-.if !defined(TEXINFO_MK)
-TEXINFO_MK= # defined
-
-.if !empty(INFO_FILES)
-#
-# Handle install-info.
-#
-
-# Pathname relative to ${PREFIX} of directory holding the info
-# files and the Info dir file.
-INFO_DIR?= info
-
-USE_TOOLS+= install-info:run
-
-# Generate INSTALL/DEINSTALL scripts code for handling install-info.
-INSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mk/install/install-info
-DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mk/install/install-info
-FILES_SUBST+= INFO_FILES=${INFO_FILES:Q}
-FILES_SUBST+= INSTALL_INFO=${INSTALL_INFO:Q}
-FILES_SUBST+= INFO_DIR=${INFO_DIR:Q}
-.endif # INFO_FILES
-
-.endif # TEXINFO_MK