Subject: Re: Message for registering info files necessary?
To: None <tech-pkg@NetBSD.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 06/23/2007 05:35:29
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sat, Jun 23, 2007 at 12:49:35AM +0200, Thomas Klausner wrote:
>
> Do we really need these messages?
>
> ===========================================================================
> Registering info files for gnucash-2.0.5nb5:
>
> /usr/pkg/info/gnucash-design.info
>
> ===========================================================================
>
> The user won't care, the admin usually won't care either, perhaps the
> packager cares to make sure he didn't forget adding the appropriate
> line.
> I think we can silence it by default, and perhaps enable it for
> PKG_DEVELOPER if someone insists.
Yes, this is a good idea. I think we should do the same with the
+FONTS script; the "Updating fonts databases ..." is probably not
necessary either.
The following patch adds a new variable PKGINSTALL_VERBOSE that
can be set by the user in /etc/mk.conf to turn on the messages for
the +FONTS and +INFO_FILES scripts.
It's obviously easy to extend this to every scriptlet. Is this
worthwhile?
If there are no objections, I can commit this after the freeze is over.
Thoughts?
Cheers,
-- Johnny Lam <jlam@pkgsrc.org>
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkginstall.diff"
Index: mk/pkginstall/bsd.pkginstall.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/pkginstall/bsd.pkginstall.mk,v
retrieving revision 1.25
diff -u -r1.25 bsd.pkginstall.mk
--- mk/pkginstall/bsd.pkginstall.mk 15 Jun 2007 22:04:33 -0000 1.25
+++ mk/pkginstall/bsd.pkginstall.mk 23 Jun 2007 05:33:28 -0000
@@ -5,6 +5,18 @@
# 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.
#
Index: mk/pkginstall/fonts
===================================================================
RCS file: /cvsroot/pkgsrc/mk/pkginstall/fonts,v
retrieving revision 1.4
diff -u -r1.4 fonts
--- mk/pkginstall/fonts 2 Jan 2007 11:47:26 -0000 1.4
+++ mk/pkginstall/fonts 23 Jun 2007 05:33:28 -0000
@@ -56,6 +56,15 @@
;;
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
case ${_PKG_UPDATE_FONTS_DB} in
@@ -69,12 +78,12 @@
case "$printed_header" in
yes) ;;
*) printed_header=yes
- ${ECHO} "==========================================================================="
- ${ECHO} "Updating font databases in the following directories:"
- ${ECHO} ""
+ $echo "==========================================================================="
+ $echo "Updating font databases in the following directories:"
+ $echo ""
;;
esac
- ( ${ECHO} " $dir ($font_type)"
+ ( $echo " $dir ($font_type)"
cd $dir
update_args=
post_update_cmd=
@@ -97,8 +106,8 @@
)
done
case "$printed_header" in
-yes) ${ECHO} ""
- ${ECHO} "==========================================================================="
+yes) $echo ""
+ $echo "==========================================================================="
;;
esac; }
Index: mk/pkginstall/info-files
===================================================================
RCS file: /cvsroot/pkgsrc/mk/pkginstall/info-files,v
retrieving revision 1.3
diff -u -r1.3 info-files
--- mk/pkginstall/info-files 29 Dec 2006 07:06:31 -0000 1.3
+++ mk/pkginstall/info-files 23 Jun 2007 05:33:28 -0000
@@ -48,6 +48,15 @@
: ${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)
@@ -64,9 +73,9 @@
case "$printed_header" in
yes) ;;
*) printed_header=yes
- ${ECHO} "==========================================================================="
- ${ECHO} "Registering info files for ${PKGNAME}:"
- ${ECHO} ""
+ $echo "==========================================================================="
+ $echo "Registering info files for ${PKGNAME}:"
+ $echo ""
;;
esac
@@ -79,15 +88,15 @@
case "$nentries" in
[0-9]*) ${TEST} $nentries -gt 0 || ${RM} $infoindex ;;
esac
- ${ECHO} " $file"
+ $echo " $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} "==========================================================================="
+ yes) $echo ""
+ $echo "==========================================================================="
;;
esac; }
;;
@@ -106,9 +115,9 @@
case "$printed_header" in
yes) ;;
*) printed_header=yes
- ${ECHO} "==========================================================================="
- ${ECHO} "Unregistering info files for ${PKGNAME}:"
- ${ECHO} ""
+ $echo "==========================================================================="
+ $echo "Unregistering info files for ${PKGNAME}:"
+ $echo ""
;;
esac
@@ -117,7 +126,7 @@
[!/]*) infodir="${PKG_PREFIX}/$infodir" ;;
esac
infoindex="$infodir/dir"
- ${ECHO} " $file"
+ $echo " $file"
${INSTALL_INFO} --info-dir="$infodir" --delete $file >/dev/null 2>&1
nentries="`${GREP} -c '^\*' $infoindex 2>/dev/null`"
case "$nentries" in
@@ -127,8 +136,8 @@
fi
done
case "$printed_header" in
- yes) ${ECHO} ""
- ${ECHO} "==========================================================================="
+ yes) $echo ""
+ $echo "==========================================================================="
;;
esac; }
;;
--tThc/1wpZn/ma/RB--