pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/bulk portability fixes:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c77471fe7615
branches:  trunk
changeset: 466387:c77471fe7615
user:      grant <grant%pkgsrc.org@localhost>
date:      Sat Jan 17 09:38:18 2004 +0000

description:
portability fixes:
- use AWK, GREP, SED and MAIL as set by defs.opsys.mk.
- use $? to test exit code of programs

diffstat:

 mk/bulk/build |  33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diffs (85 lines):

diff -r 856fec0d1215 -r c77471fe7615 mk/bulk/build
--- a/mk/bulk/build     Sat Jan 17 06:50:04 2004 +0000
+++ b/mk/bulk/build     Sat Jan 17 09:38:18 2004 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: build,v 1.29 2003/11/20 00:04:12 hubertf Exp $
+# $NetBSD: build,v 1.30 2004/01/17 09:38:18 grant Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%netbsd.org@localhost>
@@ -111,6 +111,10 @@
        BROKENFILE=`${BMAKE} show-var VARNAME=BROKENFILE` || fail=yes
        BUILDLOG=`${BMAKE} show-var VARNAME=BUILDLOG` || fail=yes
        STARTFILE=`${BMAKE} show-var VARNAME=STARTFILE` || fail=yes
+       AWK=`${BMAKE} show-var VARNAME=AWK` || fail=yes
+       GREP=`${BMAKE} show-var VARNAME=GREP` || fail=yes
+       SED=`${BMAKE} show-var VARNAME=SED` || fail=yes
+       MAIL=`${BMAKE} show-var VARNAME=MAIL` || fail=yes
 else
        echo "The pkgtools/pkglint directory does not exist.  Please update"
        echo "your pkgsrc tree in ${USR_PKGSRC}"
@@ -140,7 +144,11 @@
        -z "$ORDERFILE" -o \
        -z "$BROKENFILE" -o \
        -z "$BUILDLOG" -o \
-       -z "$STARTFILE" \
+       -z "$STARTFILE" -o \
+       -z "$AWK" -o \
+       -z "$GREP" -o \
+       -z "$SED" -o \
+       -z "$MAIL" \
        ]; then
        echo "ERROR:  build failed to extract certain key variables."
        echo "        please examine the above list and correct the"
@@ -191,13 +199,14 @@
 # (usually '.make' or '.make.${MACHINE}').  As a side benefit, this
 # can make a progress-meter very simple to add!
 
-tot=`wc -l $ORDERFILE | awk '{print $1}'`
+tot=`wc -l $ORDERFILE | ${AWK} '{print $1}'`
 for pkgdir in `cat $ORDERFILE`
 do
-        if ! grep -q "^${pkgdir}\$" $BUILDLOG ; then
-               built=`wc -l $BUILDLOG | awk '{print $1}'`
-               percent=`echo $built $tot | awk '{printf("%4.1f%%",$1*100/$2);}'`
-               (cd $pkgdir && nice -n 20 ${BMAKE} USE_BULK_CACHE=yes bulk-package </dev/null | sed "s;^;`date '+%m/%d/%y %H:%M:%S'`  $built/${tot}=$percent $pkgdir @ `uname -p`> ;g")
+       ${GREP} -q "^${pkgdir}\$" $BUILDLOG
+       if [ $? -ne 0 ]; then
+               built=`wc -l $BUILDLOG | ${AWK} '{print $1}'`
+               percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'`
+               (cd $pkgdir && nice -n 20 ${BMAKE} USE_BULK_CACHE=yes bulk-package </dev/null | ${SED} "s;^;`date '+%m/%d/%y %H:%M:%S'`  $built/${tot}=$percent $pkgdir @ `uname -p`> ;g")
                echo "$pkgdir" >> $BUILDLOG
        fi
 done
@@ -206,8 +215,9 @@
 
 for pkgname in `pkg_info -e \*`
 do
-       if `pkg_info -qe $pkgname`; then
-               pkgdir=`grep " $pkgname " $INDEXFILE | awk '{print $1}'`        
+       pkg_info -qe $pkgname
+       if [ $? -eq 0 ]; then
+               pkgdir=`${GREP} " $pkgname " $INDEXFILE | ${AWK} '{print $1}'`  
                case "${BULK_PREREQ}" in
                        *$pkgdir* )
                                echo "Keeping BULK_PREREQ: $pkgname ($pkgdir)" ;
@@ -215,7 +225,8 @@
                        * )
                                echo pkg_delete -r $pkgname
                                pkg_delete -r $pkgname
-                               if `pkg_info -qe $pkgname` ; then
+                               pkg_info -qe $pkgname
+                               if [ $? -eq 0 ]; then
                                        echo "$pkgname ($pkgdir) did not deinstall nicely.  Forcing the deinstall"
                                        pkg_delete -f $pkgname || true
                                fi
@@ -230,7 +241,7 @@
 
 # Perl was wiped, reinstall it!
 ( cd lang/perl5 && ${BMAKE} bulk-install )
-perl mk/bulk/post-build | mail -s "pkgsrc/`uname -p` bulk build results `date +%F`" $ADMIN
+perl mk/bulk/post-build | ${MAIL} -s "pkgsrc/`uname -p` bulk build results `date +%F`" $ADMIN
 
 # Done!
 echo ""



Home | Main Index | Thread Index | Old Index