Subject: pkg/6943: some cleanups for the bytebench package
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@proven.weird.com>
List: netbsd-bugs
Date: 02/05/1999 00:10:16
>Number:         6943
>Category:       pkg
>Synopsis:       some cleanups for the bytebench package
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb  4 21:20:00 1999
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        pkgsrc-current Thu Feb  4 08:18:23 EST 1999
>Environment:

System: NetBSD proven 1.3I NetBSD 1.3I (GENERIC)

>Description:

	The bytebench package installs directly into $PREFIX/bin,
	which would be OK except it has extremely badly named
	executables (given their true purpose), *and* not everything
	installed is actually an executable.

	Bytebench wasn't actually intended to be installed as a full
	system tool it would seem, but this would prevent it from being
	"packagized", so perhaps it's best to install it in its own
	isolated little directory.  The custom "do-install" target isn't
	very careful about what it installs, so it's also important to
	have the "post-patch" target clean up patch dregs.

	Second, I discovered that it doesn't really work very well
	without first being fully installed.  Fixing this fully would
	require much more drastic change, so for now I'd suggest just
	using a dependency on "install" as per my patch below.

	It also has some dependencies on the particular shell it runs
	under, in particular with "echo".

	There are many other problems with bytebench, but these are the
	most difficult to work around w.r.t. NetBSD packaging.

>How-To-Repeat:

	first try just running bytebench ("make benchmark") without
	installing it.

	then install it, package it, and install it as a package on a
	virgin machine

	lastly observe the output carefully

>Fix:

	apply the following patch:

Index: benchmarks/bytebench/Makefile
===================================================================
RCS file: /cvs/NetBSD/pkgsrc/benchmarks/bytebench/Makefile,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 benchmarks/bytebench/Makefile
--- benchmarks/bytebench/Makefile	1999/01/07 04:56:20	1.1.1.3
+++ benchmarks/bytebench/Makefile	1999/02/05 03:01:31
@@ -8,19 +8,21 @@
 MAINTAINER=		root@garbled.net
 
 post-patch:
-	${SED} -e 's|@PREFIX@|${PREFIX}|' ${WRKSRC}/Run >${WRKSRC}/run-byte
+	${RM} ${WRKSRC}/pgms/*.orig
+	${SED} -e 's|@PREFIX@|${PREFIX}|' ${WRKSRC}/Run >${WRKSRC}/run-bytebench
 
 do-install:
-	${INSTALL_SCRIPT} ${WRKSRC}/pgms/* ${PREFIX}/bin
+	${MKDIR} ${PREFIX}/bytebench
+	${INSTALL_SCRIPT} ${WRKSRC}/pgms/* ${PREFIX}/bytebench
 	${MKDIR} ${PREFIX}/share/bytebench
 	${MKDIR} ${PREFIX}/share/doc/bytebench
 	${INSTALL_DATA} ${WRKSRC}/testdir/* ${PREFIX}/share/bytebench
 	${INSTALL_MAN} ${WRKSRC}/doc/* ${PREFIX}/share/doc/bytebench
-	${INSTALL_SCRIPT} ${WRKSRC}/run-byte ${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/run-bytebench ${PREFIX}/bin
 
-benchmark:
-	@if [ `id -u` != 0 ]; then echo "This benchmark must be run as root!" ; exit 1 ; fi
-	@${WRKSRC}/run-byte | tee ${WRKSRC}/bytebench.out
+benchmark: install
+	@if [ `id -u` -ne 0 ]; then echo "This benchmark must be run as root!" ; exit 1 ; fi
+	@${PREFIX}/bin/run-bytebench | tee ${WRKSRC}/bytebench.out
 
 results:
 	-@${MKDIR} /tmp/benches/`domainname`
Index: benchmarks/bytebench/patches/patch-aa
===================================================================
RCS file: /cvs/NetBSD/pkgsrc/benchmarks/bytebench/patches/patch-aa,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 benchmarks/bytebench/patches/patch-aa
--- benchmarks/bytebench/patches/patch-aa	1998/10/02 17:38:29	1.1.1.2
+++ benchmarks/bytebench/patches/patch-aa	1999/02/05 01:45:32
@@ -1,6 +1,5 @@
-$NetBSD: patch-aa,v 1.3 1998/09/23 16:01:37 agc Exp $
---- Run.orig	Sat May 13 12:32:15 1995
-+++ Run	Sat Aug 29 10:39:35 1998
+--- Run.orig	Sat May 13 15:32:15 1995
++++ Run	Thu Feb  4 20:42:38 1999
 @@ -1,6 +1,6 @@
  #! /bin/sh
  #################### set your defaults here ##############
@@ -38,7 +37,7 @@
  cd $PWD
  
 -BINDIR=${BINDIR-${HOMEDIR}/pgms}
-+BINDIR=${BINDIR-${HOMEDIR}/bin}
++BINDIR=${BINDIR-${HOMEDIR}/bytebench}
  cd $BINDIR
  BINDIR=`pwd`
  cd $PWD
@@ -46,7 +45,7 @@
  PATH="${PATH}:${BINDIR}"
  
 -SCRPDIR=${SCRPDIR-${HOMEDIR}/pgms}
-+SCRPDIR=${SCRPDIR-${HOMEDIR}/bin}
++SCRPDIR=${SCRPDIR-${HOMEDIR}/bytebench}
  cd $SCRPDIR
  SCRPDIR=`pwd`
  cd $PWD
Index: benchmarks/bytebench/patches/patch-ad
===================================================================
RCS file: /cvs/NetBSD/pkgsrc/benchmarks/bytebench/patches/patch-ad,v
diff -u /dev/null benchmarks/bytebench/patches/patch-ad
--- /dev/null	Thu Feb  4 18:52:32 1999
+++ benchmarks/bytebench/patches/patch-ad	Thu Feb  4 21:58:40 1999
@@ -0,0 +1,69 @@
+--- pgms/index.sh-ORIG	Sat May 13 15:31:48 1995
++++ pgms/index.sh	Thu Feb  4 21:57:51 1999
+@@ -1,3 +1,5 @@
++#! /bin/sh
++:
+ ##############################################################################
+ #  The BYTE UNIX Benchmarks - Release 3
+ #          Module: index.sh   SID: 3.5 5/15/91 19:30:24
+@@ -20,12 +22,50 @@
+ BASE=${BASE-pgms/index.base}
+ TARGET=${TARGET-results/log}
+ TEMP=/tmp/$$.dat
++
++HAVEPRINT=false ; export HAVEPRINT
++if expr "`type print`" : '^print is shell builtint$' >/dev/null 2>&1 ; then
++	HAVEPRINT=true
++fi
++HAVEPRINTF=false ; export HAVEPRINTF
++if expr "`type printf`" : '^printf is shell builtint$' >/dev/null 2>&1 ; then
++	HAVEPRINTF=true
++elif expr "`type printf`" : '.* is .*/printf$' >/dev/null 2>&1 ; then
++	HAVEPRINTF=true
++fi
++if $HAVEPRINT ; then
++	# use ``$echo'' if any of the other variables...
++	echo=print
++	nl='\n'
++	n=''
++	c='\c'
++elif $HAVEPRINTF ; then
++	# use ``$echo'' if any of the other variables...
++	echo=printf
++	nl='\n'
++	n=''
++	c='\c'
++else
++	echo=echo
++	(echo "hi there\c" ; echo " ") >echotmp
++	# Configure checks to make sure grep returns a status...
++	if grep c echotmp >/dev/null 2>&1 ; then
++		nl=''
++		n='-n'
++		c=''
++	else
++		nl='\n'
++		n=''
++		c='\c'
++	fi
++	rm -f echotmp
++fi
+ #
+ # BASELINE DATA
+ #
+ if [ $# -lt 1 ]
+ then
+-	echo "Data File for baseline: \c"
++	$echo $n "Data File for baseline: $c"
+ 	read BASE
+ else
+ 	BASE=$1
+@@ -41,7 +81,7 @@
+ #
+ if [ $# -lt 2 ]
+ then
+-	echo "Source File for target machine results: \c"
++	$echo $n "Source File for target machine results: $c"
+ 	read TARGET
+ else
+ 	TARGET=$2
Index: benchmarks/bytebench/patches/patch-ae
===================================================================
RCS file: /cvs/NetBSD/pkgsrc/benchmarks/bytebench/patches/patch-ae,v
diff -u /dev/null benchmarks/bytebench/patches/patch-ae
--- /dev/null	Thu Feb  4 18:52:32 1999
+++ benchmarks/bytebench/patches/patch-ae	Thu Feb  4 21:58:52 1999
@@ -0,0 +1,58 @@
+--- pgms/report.sh-ORIG	Sat May 13 15:31:52 1995
++++ pgms/report.sh	Thu Feb  4 21:57:40 1999
+@@ -1,3 +1,5 @@
++#! /bin/sh
++:
+ ##############################################################################
+ #  The BYTE UNIX Benchmarks - Release 1
+ #          Module: report.sh   SID: 1.4 5/15/91 19:30:26
+@@ -18,11 +20,48 @@
+ ##############################################################################
+ BINDIR=${BINDIR-pgms}
+ TARGET=${TARGET-results/log}
++HAVEPRINT=false ; export HAVEPRINT
++if expr "`type print`" : '^print is shell builtint$' >/dev/null 2>&1 ; then
++	HAVEPRINT=true
++fi
++HAVEPRINTF=false ; export HAVEPRINTF
++if expr "`type printf`" : '^printf is shell builtint$' >/dev/null 2>&1 ; then
++	HAVEPRINTF=true
++elif expr "`type printf`" : '.* is .*/printf$' >/dev/null 2>&1 ; then
++	HAVEPRINTF=true
++fi
++if $HAVEPRINT ; then
++	# use ``$echo'' if any of the other variables...
++	echo=print
++	nl='\n'
++	n=''
++	c='\c'
++elif $HAVEPRINTF ; then
++	# use ``$echo'' if any of the other variables...
++	echo=printf
++	nl='\n'
++	n=''
++	c='\c'
++else
++	echo=echo
++	(echo "hi there\c" ; echo " ") >$HOME/echotmp
++	# Configure checks to make sure grep returns a status...
++	if grep c $HOME/echotmp >/dev/null 2>&1 ; then
++		nl=''
++		n='-n'
++		c=''
++	else
++		nl='\n'
++		n=''
++		c='\c'
++	fi
++	rm -f $HOME/echotmp
++fi
+ # RESULTS TARGET
+ #
+ if [ $# -lt 1 ]
+ then
+-	echo "Source File for target machine results: \c"
++	$echo $n "Source File for target machine results: $c"
+ 	read TARGET
+ else
+ 	TARGET=$1
Index: benchmarks/bytebench/pkg/PLIST
===================================================================
RCS file: /cvs/NetBSD/pkgsrc/benchmarks/bytebench/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 benchmarks/bytebench/pkg/PLIST
--- benchmarks/bytebench/pkg/PLIST	1998/09/01 18:37:49	1.1.1.1
+++ benchmarks/bytebench/pkg/PLIST	1999/02/05 01:16:32
@@ -1,38 +1,39 @@
 @comment $NetBSD: PLIST,v 1.1 1998/08/30 17:35:58 garbled Exp $
-bin/int
-bin/arithoh
-bin/byte.logo
-bin/cleanup.sh
-bin/context1
-bin/dhry2
-bin/dhry2reg
-bin/double
-bin/execl
-bin/float
-bin/fs.awk
-bin/fstime
-bin/hanoi
-bin/index.awk
-bin/index.base
-bin/index.sh
-bin/long
-bin/looper
-bin/loopm.awk
-bin/loops.awk
-bin/multi.sh
-bin/pipe
-bin/register
-bin/report.awk
-bin/report.sh
-bin/short
-bin/spawn
-bin/syscall
-bin/tst.sh
-bin/run-byte
+bytebench/int
+bytebench/arithoh
+bytebench/byte.logo
+bytebench/cleanup.sh
+bytebench/context1
+bytebench/dhry2
+bytebench/dhry2reg
+bytebench/double
+bytebench/execl
+bytebench/float
+bytebench/fs.awk
+bytebench/fstime
+bytebench/hanoi
+bytebench/index.awk
+bytebench/index.base
+bytebench/index.sh
+bytebench/long
+bytebench/looper
+bytebench/loopm.awk
+bytebench/loops.awk
+bytebench/multi.sh
+bytebench/pipe
+bytebench/register
+bytebench/report.awk
+bytebench/report.sh
+bytebench/short
+bytebench/spawn
+bytebench/syscall
+bytebench/tst.sh
+bin/run-bytebench
 share/doc/bytebench/bench.doc
 share/doc/bytebench/bench3.doc
 share/bytebench/cctest.c
 share/bytebench/dc.dat
 share/bytebench/sort.src
+@dirrm bytebench
 @dirrm share/doc/bytebench
 @unexec rm -rf %D/share/bytebench
>Audit-Trail:
>Unformatted: