pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/bulk nuke two Useless Use of Wc and let awk do the ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/08ddb7b43a60
branches: trunk
changeset: 521727:08ddb7b43a60
user: jschauma <jschauma%pkgsrc.org@localhost>
date: Sun Nov 19 03:06:26 2006 +0000
description:
nuke two Useless Use of Wc and let awk do the legwork. This saves us
two forks per package.
diffstat:
mk/bulk/build | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r e934d406b338 -r 08ddb7b43a60 mk/bulk/build
--- a/mk/bulk/build Sun Nov 19 02:22:42 2006 +0000
+++ b/mk/bulk/build Sun Nov 19 03:06:26 2006 +0000
@@ -1,5 +1,5 @@
-#!/bin/sh
-# $NetBSD: build,v 1.94 2006/02/11 21:44:16 rillig Exp $
+#!/bin/sh
+# $NetBSD: build,v 1.95 2006/11/19 03:06:26 jschauma Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -90,7 +90,7 @@
# For more sophisticated output, you may use all the variables that this
# example function uses.
post_filter_cmd() {
- ${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` ${built}/${tot}=${percent} ${pkgdir} @ ${MACHINE_ARCH}> ;g"
+ ${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` ${percent} ${pkgdir} @ ${MACHINE_ARCH}> ;g"
}
@@ -361,14 +361,16 @@
# make sure we have something to grep in in the build loop
touch "${main_buildlog}" || die "Cannot write to ${main_buildlog}."
-tot=`wc -l "${ORDERFILE}" | ${AWK} '{print $1}'`
+tot=`${AWK} 'END { print NR }' "${ORDERFILE}"`
for pkgdir in `cat "${ORDERFILE}"`
do
if ${GREP} -q "^${pkgdir}\$" "${main_buildlog}"; then
: "skip this package"
else
- built=`wc -l "${main_buildlog}" | ${AWK} '{print $1}'`
- percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'`
+ percent=`${AWK} -v tot="${tot}" '
+ END {
+ printf("%d/%d=%4.1f%%", NR, tot, NR*100/tot);
+ }' "${main_buildlog}"`
( cd "${pkgsrc_dir}/${pkgdir}" \
&& ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes "${target}" \
$makeargs </dev/null | post_filter_cmd
Home |
Main Index |
Thread Index |
Old Index