pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/pkginstall * Add a user-settable variable to tune t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f9e78500af47
branches:  trunk
changeset: 530871:f9e78500af47
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Jul 12 19:41:46 2007 +0000

description:
* Add a user-settable variable to tune the default verbosity of the
  +INSTALL and +DEINSTALL scripts:

  PKGINSTALL_VERBOSE
        A list of scriptlets that will be verbose and output a message
        noting the actions taken.

        * "all" is a special value that implies all of the other items
        * "fonts" for +FONTS
        * "info-files" for +INFO_FILES

        Default value: "all" for PKG_DEVELOPERs, empty otherwise.

* Be "one-liner brief" when doing the default actions.  For example,
  the info files output now looks like:

        gmake-3.81: registering info file /usr/pkg/info/make.info

  We retain the current verbosity for the CHECK-* actions.

diffstat:

 mk/pkginstall/bsd.pkginstall.mk        |  30 ++++++++++++++++++++-
 mk/pkginstall/files                    |  23 ++-------------
 mk/pkginstall/fonts                    |  28 ++++++++-----------
 mk/pkginstall/info-files               |  47 ++++++++++-----------------------
 mk/pkginstall/perms                    |  28 +++++--------------
 mk/pkginstall/shell                    |  36 +++----------------------
 mk/pkginstall/usergroupfuncs           |   6 ++--
 mk/pkginstall/usergroupfuncs.DragonFly |   6 ++--
 mk/pkginstall/usergroupfuncs.FreeBSD   |   6 ++--
 mk/pkginstall/usergroupfuncs.Linux     |   6 ++--
 10 files changed, 84 insertions(+), 132 deletions(-)

diffs (truncated from 519 to 300 lines):

diff -r 78aa16f594bf -r f9e78500af47 mk/pkginstall/bsd.pkginstall.mk
--- a/mk/pkginstall/bsd.pkginstall.mk   Thu Jul 12 19:38:18 2007 +0000
+++ b/mk/pkginstall/bsd.pkginstall.mk   Thu Jul 12 19:41:46 2007 +0000
@@ -1,10 +1,22 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.25 2007/06/15 22:04:33 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.26 2007/07/12 19:41:46 jlam Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and implements the
 # common INSTALL/DEINSTALL scripts framework.  To use the pkginstall
 # framework, simply set the relevant variables to customize the install
 # scripts to the package.
 #
+# User-settable variables:
+#
+# PKGINSTALL_VERBOSE
+#      A list of scriptlets that will be verbose and output a message
+#      noting the actions taken.
+#
+#      * "all" is a special value that implies all of the other items
+#      * "fonts" for +FONTS
+#      * "info-files" for +INFO_FILES
+#
+#      Default value: "all" for PKG_DEVELOPERs, empty otherwise.
+#
 
 # The Solaris /bin/sh does not know the ${foo#bar} shell substitution.
 # This shell function serves a similar purpose, but is specialized on
@@ -809,6 +821,22 @@
 FILES_SUBST+=          PKG_REGISTER_SHELLS=${PKG_REGISTER_SHELLS:Q}
 FILES_SUBST+=          PKG_UPDATE_FONTS_DB=${PKG_UPDATE_FONTS_DB:Q}
 
+.if defined(PKG_DEVELOPER)
+PKGINSTALL_VERBOSE?=   all
+.else
+PKGINSTALL_VERBOSE?=   # empty
+.endif
+.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Mfonts)
+FILES_SUBST+=          FONTS_VERBOSE=yes
+.else
+FILES_SUBST+=          FONTS_VERBOSE=no
+.endif
+.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Minfo-files)
+FILES_SUBST+=          INFO_FILES_VERBOSE=yes
+.else
+FILES_SUBST+=          INFO_FILES_VERBOSE=no
+.endif
+
 # Substitute for various programs used in the DEINSTALL/INSTALL scripts and
 # in the rc.d scripts.
 #
diff -r 78aa16f594bf -r f9e78500af47 mk/pkginstall/files
--- a/mk/pkginstall/files       Thu Jul 12 19:38:18 2007 +0000
+++ b/mk/pkginstall/files       Thu Jul 12 19:41:46 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.3 2006/12/15 13:15:06 martti Exp $
+# $NetBSD: files,v 1.4 2007/07/12 19:41:46 jlam Exp $
 #
 # Generate a +FILES script that reference counts config files that are
 # required for the proper functioning of the package.
@@ -118,7 +118,7 @@
 case $ACTION in
 ADD)
        ${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -u |
-       { while read file f_flags f_eg f_mode f_user f_group; do
+       while read file f_flags f_eg f_mode f_user f_group; do
                case $file in
                "")     continue ;;
                [!/]*)  file="${PKG_PREFIX}/$file" ;;
@@ -157,20 +157,10 @@
                else
                        case "$f_flags:$_PKG_CONFIG:$_PKG_RCD_SCRIPTS" in
                        *f*:*:*|[!r]:yes:*|[!r][!r]:yes:*|[!r][!r][!r]:yes:*|*r*:yes:yes)
-                               case "$printed_header" in
-                               yes)    ;;
-                               *)      printed_header=yes
-                                       ${ECHO} "==========================================================================="
-                                       ${ECHO} "Installing files needed by ${PKGNAME}:"
-                                       ;;
-                               esac
                                if ${TEST} -f "$file"; then
-                                       ${ECHO} ""
-                                       ${ECHO} "       $file already exists."
+                                       ${ECHO} "${PKGNAME}: $file already exists"
                                elif ${TEST} -f "$f_eg"; then
-                                       ${ECHO} ""
-                                       ${ECHO} "       $file"
-                                       ${ECHO} "           [$f_eg]"
+                                       ${ECHO} "${PKGNAME}: copying $f_eg to $file"
                                        ${CP} $f_eg $file
                                        case $f_user in
                                        "")     ;;
@@ -189,11 +179,6 @@
                        esac
                fi
        done
-       case "$printed_header" in
-       yes)    ${ECHO} ""
-               ${ECHO} "==========================================================================="
-               ;;
-       esac; }
        ;;
 
 REMOVE)
diff -r 78aa16f594bf -r f9e78500af47 mk/pkginstall/fonts
--- a/mk/pkginstall/fonts       Thu Jul 12 19:38:18 2007 +0000
+++ b/mk/pkginstall/fonts       Thu Jul 12 19:41:46 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: fonts,v 1.4 2007/01/02 11:47:26 joerg Exp $
+# $NetBSD: fonts,v 1.5 2007/07/12 19:41:46 jlam Exp $
 #
 # Generate a +FONTS script that updates font databases for the package.
 #
@@ -56,8 +56,17 @@
        ;;
 esac
 
+case "${FONTS_VERBOSE:-@FONTS_VERBOSE@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+       echo="${ECHO}"
+       ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+       echo=":"
+       ;;
+esac
+
 ${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u |
-{ while read dir font_type; do
+while read dir font_type; do
        case ${_PKG_UPDATE_FONTS_DB} in
        no)     continue ;;
        esac
@@ -66,15 +75,7 @@
        [!/]*)  dir="${PKG_PREFIX}/$dir" ;;
        esac
        ${TEST} -d "$dir" || continue
-       case "$printed_header" in
-       yes)    ;;
-       *)      printed_header=yes
-               ${ECHO} "==========================================================================="
-               ${ECHO} "Updating font databases in the following directories:"
-               ${ECHO} ""
-               ;;
-       esac
-       ( ${ECHO} "     $dir ($font_type)"
+       ( $echo "${PKGNAME}: updating font database in $dir ($font_type)"
          cd $dir
          update_args=
          post_update_cmd=
@@ -96,11 +97,6 @@
          ${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\.scale" | ${GREP} -v "/fonts\.dir" | ${GREP} -v "/Fontmap" >/dev/null || ${RM} -f fonts.dir fonts.scale Fontmap* 
encodings.dir > /dev/null
        )
 done
-case "$printed_header" in
-yes)   ${ECHO} ""
-       ${ECHO} "==========================================================================="
-       ;;
-esac; }
 
 EOF
        ${SED} -n "/^\# FONTS: /p" ${SELF} >> ./+FONTS
diff -r 78aa16f594bf -r f9e78500af47 mk/pkginstall/info-files
--- a/mk/pkginstall/info-files  Thu Jul 12 19:38:18 2007 +0000
+++ b/mk/pkginstall/info-files  Thu Jul 12 19:41:46 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: info-files,v 1.3 2006/12/29 07:06:31 obache Exp $
+# $NetBSD: info-files,v 1.4 2007/07/12 19:41:46 jlam Exp $
 #
 # Generate an +INFO_FILES script that handles info file registration for
 # the package.
@@ -48,11 +48,20 @@
 : ${PKGNAME=${PKG_METADATA_DIR##*/}}
 : ${PKG_PREFIX=@PREFIX@}
 
+case "${INFO_FILES_VERBOSE:-@INFO_FILES_VERBOSE@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+       echo="${ECHO}"
+       ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+       echo=":"
+       ;;
+esac
+
 exitcode=0
 case $ACTION in
 ADD)
        ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u |
-       { while read file infodir; do
+       while read file infodir; do
                case $file in
                "")     continue ;;
                [!/]*)  file="${PKG_PREFIX}/$file" ;;
@@ -61,15 +70,6 @@
                if ${TEST} ! -f "$file"; then
                        :
                else
-                       case "$printed_header" in
-                       yes)    ;;
-                       *)      printed_header=yes
-                               ${ECHO} "==========================================================================="
-                               ${ECHO} "Registering info files for ${PKGNAME}:"
-                               ${ECHO} ""
-                               ;;
-                       esac
-
                        case $infodir in
                        "")     infodir="${file%/*}" ;;
                        [!/]*)  infodir="${PKG_PREFIX}/$infodir" ;;
@@ -79,22 +79,17 @@
                        case "$nentries" in
                        [0-9]*) ${TEST} $nentries -gt 0 || ${RM} $infoindex ;;
                        esac
-                       ${ECHO} "       $file"
+                       $echo "${PKGNAME}: registering info file $file"
                        ${MKDIR} -p "$infodir"
                        ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1
                        ${INSTALL_INFO} --info-dir="$infodir" $file >/dev/null 2>&1
                fi
        done
-       case "$printed_header" in
-       yes)    ${ECHO} ""
-               ${ECHO} "==========================================================================="
-               ;;
-       esac; }
        ;;
 
 REMOVE)
        ${SED} -n "/^\# INFO: /{s/^\# INFO: //;p;}" ${SELF} | ${SORT} -u |
-       { while read file infodir; do
+       while read file infodir; do
                case $file in
                "")     continue ;;
                [!/]*)  file="${PKG_PREFIX}/$file" ;;
@@ -103,21 +98,12 @@
                if ${TEST} ! -f "$file"; then
                        :
                else
-                       case "$printed_header" in
-                       yes)    ;;
-                       *)      printed_header=yes
-                               ${ECHO} "==========================================================================="
-                               ${ECHO} "Unregistering info files for ${PKGNAME}:"
-                               ${ECHO} ""
-                               ;;
-                       esac
-
                        case $infodir in
                        "")     infodir="${file%/*}" ;;
                        [!/]*)  infodir="${PKG_PREFIX}/$infodir" ;;
                        esac
                        infoindex="$infodir/dir"
-                       ${ECHO} "       $file"
+                       $echo "${PKGNAME}: unregistering info file $file"
                        ${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1
                        nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`"
                        case "$nentries" in
@@ -126,11 +112,6 @@
                        ${RMDIR} -p "$infodir" 2>/dev/null || ${TRUE}
                fi
        done
-       case "$printed_header" in
-       yes)    ${ECHO} ""
-               ${ECHO} "==========================================================================="
-               ;;
-       esac; }
        ;;
 esac
 exit $exitcode
diff -r 78aa16f594bf -r f9e78500af47 mk/pkginstall/perms
--- a/mk/pkginstall/perms       Thu Jul 12 19:38:18 2007 +0000
+++ b/mk/pkginstall/perms       Thu Jul 12 19:41:46 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: perms,v 1.2 2006/07/19 22:26:26 jlam Exp $
+# $NetBSD: perms,v 1.3 2007/07/12 19:41:46 jlam Exp $
 #
 # Generate a +PERMS script that sets the special permissions on files
 # and directories used by the package.
@@ -42,35 +42,28 @@
 : ${PKG_PREFIX=@PREFIX@}
 
 ${SED} -n "/^\# PERMS: /{s/^\# PERMS: //;p;}" ${SELF} | ${SORT} -u |
-{ while read file f_mode f_user f_group; do
+while read file f_mode f_user f_group; do
        case $file in
        "")     continue ;;
        [!/]*)  file="${PKG_PREFIX}/$file" ;;
        esac
        ${TEST} -f "$file" || continue
-       case "$printed_header" in
-       yes)    ;;
-       *)      printed_header=yes
-               ${ECHO} "==========================================================================="
-               ${ECHO} "The following files and directories needed by ${PKGNAME}"
-               ${ECHO} "have special permissions:"
-               ${ECHO} ""
-               ;;
-       esac
+       filemsg=
        case $f_mode/$f_user/$f_group in
        //)
-               ${ECHO} "       $file"



Home | Main Index | Thread Index | Old Index