pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/install Resurrect INFO_DIR for another purpose -- i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fb59055a440d
branches:  trunk
changeset: 510923:fb59055a440d
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Apr 06 17:57:34 2006 +0000

description:
Resurrect INFO_DIR for another purpose -- if defined, it sets the
directory containing the "dir" file that is updated.  This allows
packages to install info files in one place but update the dir file
in a separate location.

diffstat:

 mk/install/bsd.pkginstall.mk |  20 ++++++++++++++++----
 mk/install/info-files        |  19 ++++++++++---------
 2 files changed, 26 insertions(+), 13 deletions(-)

diffs (106 lines):

diff -r c7da2ac6c735 -r fb59055a440d mk/install/bsd.pkginstall.mk
--- a/mk/install/bsd.pkginstall.mk      Thu Apr 06 17:41:17 2006 +0000
+++ b/mk/install/bsd.pkginstall.mk      Thu Apr 06 17:57:34 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.44 2006/03/20 01:48:58 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.45 2006/04/06 17:57:34 jlam Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and implements the
 # common INSTALL/DEINSTALL scripts framework.  To use the pkginstall
@@ -470,6 +470,12 @@
                ${TOUCH} ${TOUCH_ARGS} ${.TARGET};                      \
        fi
 
+# INFO_DIR, if defined, specifies the directory path containing the "dir"
+#      index file that should be updated.  If the pathname is relative,
+#      then it is taken to be relative to ${PREFIX}.  This shouldn't
+#      be needed unless "dir" is not in the same directory as the
+#      installed info files.
+#
 _INSTALL_INFO_FILES_FILE=      ${_PKGINSTALL_DIR}/info-files
 _INSTALL_INFO_FILES_DATAFILE=  ${_PKGINSTALL_DIR}/info-files-data
 _INSTALL_UNPACK_TMPL+=         ${_INSTALL_INFO_FILES_FILE}
@@ -511,12 +517,18 @@
 install-script-data: install-script-data-info-files
 install-script-data-info-files:
 .if defined(INFO_FILES)
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
        if ${TEST} -x ${INSTALL_FILE}; then                             \
                ${INFO_FILES_cmd} |                                     \
                while read file; do                                     \
-                       ${ECHO} "# INFO: $$file"                        \
-                               >> ${INSTALL_FILE};                     \
+                       infodir=${INFO_DIR:Q};                          \
+                       infodir=`strip_prefix "$$infodir"`;             \
+                       case "$$infodir" in                             \
+                       "")     ${ECHO} "# INFO: $$file"                \
+                                       >> ${INSTALL_FILE} ;;           \
+                       *)      ${ECHO} "# INFO: $$file $$infodir"      \
+                                       >> ${INSTALL_FILE} ;;           \
+                       esac;                                           \
                done;                                                   \
                cd ${PKG_DB_TMPDIR} && ${SETENV} ${INSTALL_SCRIPTS_ENV} \
                ${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME}         \
diff -r c7da2ac6c735 -r fb59055a440d mk/install/info-files
--- a/mk/install/info-files     Thu Apr 06 17:41:17 2006 +0000
+++ b/mk/install/info-files     Thu Apr 06 17:57:34 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: info-files,v 1.3 2006/03/19 23:58:14 jlam Exp $
+# $NetBSD: info-files,v 1.4 2006/04/06 17:57:34 jlam Exp $
 #
 # Generate an +INFO_FILES script that handles info file registration for
 # the package.
@@ -18,11 +18,12 @@
 # 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.
+# name the info files and directory containing the "dir" index that will
+# that will be updated.  If the directory is not specified, then the
+# "dir" index is assumed to be in the same directory as the info file.
 #
-#      # INFO: /usr/pkg/info/bar.info
-#      # INFO: /usr/pkg/info/baz.info
+#      # INFO: /usr/pkg/info/bar.info /usr/pkg/info
+#      # INFO: /usr/pkg/info/baz.info /usr/pkg/info
 #
 # For each INFO entry, if the path is relative, that it is taken to be
 # relative to ${PKG_PREFIX}.
@@ -48,7 +49,7 @@
 case $ACTION in
 ADD)
        ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u |
-       { while read file; do
+       { while read file infodir; do
                case $file in
                "")     continue ;;
                [!/]*)  file="${PKG_PREFIX}/$file" ;;
@@ -63,7 +64,7 @@
                        ;;
                esac
 
-               infodir="${file%/*}"
+               ${TEST} -n "$infodir" || infodir="${file%/*}"
                infoindex="$infodir/dir"
                nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`"
                case "$nentries" in
@@ -82,7 +83,7 @@
 
 REMOVE)
        ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u |
-       { while read file; do
+       { while read file infodir; do
                case $file in
                "")     continue ;;
                [!/]*)  file="${PKG_PREFIX}/$file" ;;
@@ -97,7 +98,7 @@
                        ;;
                esac
 
-               infodir="${file%/*}"
+               ${TEST} -n "$infodir" || infodir="${file%/*}"
                infoindex="$infodir/dir"
                ${ECHO} "       $file"
                ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1



Home | Main Index | Thread Index | Old Index