pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/bulk - Improved error handling.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f0900f8a2cd2
branches:  trunk
changeset: 502787:f0900f8a2cd2
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Nov 08 22:12:42 2005 +0000

description:
- Improved error handling.
- Changed "foo; if [ $? -eg 0 ]; then" to "if foo; then" in three places.

diffstat:

 mk/bulk/build |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 3e2b874375cc -r f0900f8a2cd2 mk/bulk/build
--- a/mk/bulk/build     Tue Nov 08 21:57:59 2005 +0000
+++ b/mk/bulk/build     Tue Nov 08 22:12:42 2005 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: build,v 1.71 2005/11/08 21:57:59 rillig Exp $
+# $NetBSD: build,v 1.72 2005/11/08 22:12:42 rillig Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -360,13 +360,14 @@
 # can make a progress-meter very simple to add!
 
 # make sure we have something to grep in in the build loop
-touch "${BUILDLOG}"
+touch "${BUILDLOG}" || die "Cannot write to ${pkgsrc_dir}/${BUILDLOG}."
 
 tot=`wc -l $ORDERFILE | ${AWK} '{print $1}'`
 for pkgdir in `cat $ORDERFILE`
 do
-       ${GREP} -q "^${pkgdir}\$" $BUILDLOG
-       if [ $? -ne 0 ]; then
+       if ${GREP} -q "^${pkgdir}\$" "${BUILDLOG}"; then
+               : "skip this package"
+       else
                built=`wc -l $BUILDLOG | ${AWK} '{print $1}'`
                percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'`
                ( cd "${pkgsrc_dir}/${pkgdir}" \
@@ -380,8 +381,7 @@
 echo "Build finished.  Removing all installed packages left over from build..."
 for pkgname in `${PKG_TOOLS_BIN}/pkg_info -e \*`
 do
-       ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
-       if [ $? -eq 0 ]; then
+       if ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname; then
                pkgdir=`${AWK} "/ $pkgname /"'{print $1}{}' $INDEXFILE`
                case "${BULK_PREREQ}" in
                        *$pkgdir* )
@@ -390,8 +390,7 @@
                        * )
                                echo ${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
                                ${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
-                               ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
-                               if [ $? -eq 0 ]; then
+                               if ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname; then
                                        echo "$pkgname ($pkgdir) did not deinstall nicely.  Forcing the deinstall"
                                        ${PKG_TOOLS_BIN}/pkg_delete -f $pkgname || true
                                fi



Home | Main Index | Thread Index | Old Index