Subject: Call for review - Make "pkg_view -v" more verbose
To: None <tech-pkg@NetBSD.org>
From: Masao Uebayashi <uebayasi@pultek.co.jp>
List: tech-pkg
Date: 06/03/2004 23:09:51
Short Explanation:
Make "pkg_view -v" more verbose. linkfarm(1) shouldn't confuse stdout
/ stderr.
(And one "grep + sed -> sed" change.)
Longer Explanation:
The point is that pkg_view(1) / linkfarm(1) output a list of files
(links) to stdout, and the list is used to check sanity in
mk/bsd.pkg.mk, like
...; dups=`...; pkg_view check ...`; case "$$dups" ...
See output of "grep PKG_VIEW mk/bsd.pkg.mk".
If I add -v flag to pkg_view (${PKG_VIEW_ARGS}), the verbose message
are mixed into the file list, that looks really broken to me.
Masao
diff -u src/usr.sbin/pkg_install/view.orig/linkfarm.sh view/linkfarm.sh
--- src/usr.sbin/pkg_install/view.orig/linkfarm.sh 2004-06-03 22:13:42.000000000 +0900
+++ src/usr.sbin/pkg_install/view/linkfarm.sh 2004-06-03 21:46:53.000000000 +0900
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: linkfarm.sh,v 1.5 2004/06/03 13:13:42 uebayasi Exp $
+# $NetBSD: linkfarm.sh,v 1.3 2003/09/13 09:20:27 jlam Exp $
#
# Copyright (c) 2002 Alistair G. Crooks. All rights reserved.
@@ -172,7 +172,7 @@
case $ignore in
no)
if [ $verbose -gt 0 ]; then
- echo "$rmprog -f $todir/$f"
+ echo "$rmprog -f $todir/$f" 1>&2
fi
$doit $rmprog -f $todir/$f ;;
esac
@@ -182,7 +182,7 @@
$sortprog -r | \
while read d; do
if [ $verbose -gt 0 ]; then
- echo "$rmdirprog $todir/$d"
+ echo "$rmdirprog $todir/$d" 1>&2
fi
$doit $rmdirprog $todir/$d > /dev/null 2>&1
done)
@@ -201,7 +201,7 @@
"") continue ;;
esac
if [ $verbose -gt 0 ]; then
- echo "$mkdirprog -p $todir/$d"
+ echo "$mkdirprog -p $todir/$d" 1>&2
fi
$doit $mkdirprog -p $todir/$d > /dev/null 2>&1
done
@@ -217,7 +217,7 @@
case $ignore in
no)
if [ $verbose -gt 0 ]; then
- echo "$lnprog ${linktype} $fromdir/$f $todir/$f"
+ echo "$lnprog ${linktype} $fromdir/$f $todir/$f" 1>&2
fi
$doit $lnprog ${linktype} $fromdir/$f $todir/$f ;;
esac
diff -u src/usr.sbin/pkg_install/view.orig/pkg_view.sh view/pkg_view.sh
--- src/usr.sbin/pkg_install/view.orig/pkg_view.sh 2004-06-02 01:08:10.000000000 +0900
+++ src/usr.sbin/pkg_install/view/pkg_view.sh 2004-06-03 22:17:54.000000000 +0900
@@ -167,14 +167,14 @@
delete) linkfarmflags="-D" ;;
esac
if [ -f ${depot_pkg_dbdir}/$pkg/+BUILD_INFO ]; then
- ignore=`$grepprog "^_PLIST_IGNORE_FILES=" ${depot_pkg_dbdir}/$pkg/+BUILD_INFO | $sedprog -e 's|^_PLIST_IGNORE_FILES=[ ]*||'`
+ ignore=`$sedprog -ne "/^_PLIST_IGNORE_FILES=/ { s|^_PLIST_IGNORE_FILES=[ ]*||; p; }" ${depot_pkg_dbdir}/$pkg/+BUILD_INFO`
fi
case "$ignore" in
"") ignore="${dflt_ignorefiles}" ;;
esac
dbs=`(cd ${depot_pkg_dbdir}/$pkg; echo +*)`
ignore="${ignore} ${ignorefiles} $dbs"
- $doit $envprog PLIST_IGNORE_FILES="${ignore}" $linkfarmprog $linkfarmflags --target=${targetdir} --dir=${depot_pkg_dbdir} $pkg
+ $doit $envprog PLIST_IGNORE_FILES="${ignore}" $linkfarmprog $linkfarmflags --target=${targetdir} --dir=${depot_pkg_dbdir} `[ $verbose -gt 0 ] && echo -v` $pkg
}
#############
@@ -189,7 +189,7 @@
echo "pkg_view: \`$1' already exists in $viewstr" 1>&2
exit 1
fi
- $echo1 "Adding $1 to ${targetdir}."
+ $echo1 "Adding $1 to ${targetdir}." 1>&2
symlinks add $1
$doit $mkdirprog -p ${depot_pkg_dbdir}/$1
temp=${depot_pkg_dbdir}/$1/+VIEWS.$$
@@ -225,7 +225,7 @@
;;
check)
checkpkg $1 ${depot_pkg_dbdir}
- $echo1 "Checking $1 in ${targetdir}."
+ $echo1 "Checking $1 in ${targetdir}." 1>&2
symlinks check $1
exit $?
;;
@@ -235,12 +235,12 @@
echo "pkg_view: \`$1' doesn't exist in $viewstr" 1>&2
exit 1
fi
- $echo1 "Deleting $1 from ${targetdir}."
+ $echo1 "Deleting $1 from ${targetdir}." 1>&2
if [ -f ${pkg_dbdir}/$1/+REQUIRED_BY ]; then
if $cmpprog -s ${pkg_dbdir}/$1/+REQUIRED_BY /dev/null; then
: # not really required by another pkg
else
- (echo "pkg_view: \`$1' is required by other packages:"
+ (echo "pkg_view: \`$1' is required by other packages:" 1>&2
$sedprog -e 's|^| |' ${pkg_dbdir}/$1/+REQUIRED_BY) 1>&2
exit 1
fi