OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-tools Date: 04-Feb-2005 14:59:06
Branch: HEAD Handle: 2005020413590600
Modified files:
openpkg-tools/cmd dev.sh
Log:
search whole PATH for suitable egrep(1) and awk(1); avoid problem when
egrep is given an empty argument
Summary:
Revision Changes Path
1.34 +36 -27 openpkg-tools/cmd/dev.sh
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/dev.sh
============================================================================
$ cvs diff -u -r1.33 -r1.34 dev.sh
--- openpkg-tools/cmd/dev.sh 1 Jan 2005 11:17:38 -0000 1.33
+++ openpkg-tools/cmd/dev.sh 4 Feb 2005 13:59:06 -0000 1.34
@@ -82,16 +82,22 @@
S="${S:-src}" # chicken-egg hack FIXME
# use appropriate tools
-if [ -x /usr/xpg4/bin/egrep ]; then
- EGREP="/usr/xpg4/bin/egrep"
-else
- EGREP="`type -f -p egrep`"
-fi
-if [ -x /usr/xpg4/bin/awk ]; then
- AWK="/usr/xpg4/bin/awk"
-else
- AWK="`type -f -p awk`"
-fi
+EGREP=""
+for i in `echo $PATH: | sed -e 's;:; ;g'` /usr/xpg4/bin; do
+ i=${i}/egrep
+ if [ -x $i -a .`echo foo | $i 2>/dev/null '^f[nop]+$'` = .foo ]; then
+ EGREP=$i
+ break;
+ fi
+done
+AWK=""
+for i in `echo $PATH: | sed -e 's;:; ;g'` /usr/xpg4/bin; do
+ i=${i}/awk
+ if [ -x $i -a .`echo foo | $i 2>/dev/null -v foo=bar '/foo/ { print foo
}'` = .bar ]; then
+ AWK=$i
+ break;
+ fi
+done
# a note about CVS HEAD
# CVS calls the latest version of a file "head". It also supports two
@@ -983,18 +989,21 @@
echo "${INSTANCE}" | ${EGREP} "^[0-9]+\.[0-9]{1,7}\.[0-9]+$" >/dev/null
&& RE="^${INSTANCE}$" #SOLID
RE="`echo ${RE} | sed -e 's;\.;\\.;g'`"
- for INSTANCE in ${OPENPKG_INST}; do
- initmpx ${INSTANCE}
- if [ ".${RPMCMD}" != . ]; then
- VERSION=`${RPMCMD} -q --qf "%{VERSION}" openpkg`
- echo ${VERSION} | ${EGREP} "$RE" >/dev/null
- if [ $? -eq 0 ]; then
- RV="${INSTANCE}"
- unset INSTANCE
- return
+ if [ ".$RE" != . ]; then
+ for INSTANCE in ${OPENPKG_INST}; do
+ initmpx ${INSTANCE}
+ if [ ".${RPMCMD}" != . ]; then
+ VERSION=`${RPMCMD} -q --qf "%{VERSION}" openpkg`
+ echo ${VERSION} | ${EGREP} "$RE" >/dev/null
+ if [ $? -eq 0 ]; then
+ RV="${INSTANCE}"
+ unset INSTANCE
+ return
+ fi
fi
- fi
- done
+ done
+ fi
+
if [ ".$mode" = .any ]; then
OPENPKG_INST="${OPENPKG_INST} `uwhich openpkg | sed -e
's;/bin/openpkg$;;'`"
OPENPKG_INST="${OPENPKG_INST} `uwhich rpm | sed -e 's;/bin/rpm$;;'`"
@@ -2492,15 +2501,15 @@
set -- help
fi
-# check whether EGREP really supports regular expressions
-if [ ! .`echo foo | ${EGREP} '^f[nop]+$'` = .foo ]; then
- error "$0:ERROR: found ${EGREP} but it doesn't support regular
expressions"
+# check whether EGREP was found
+if [ ".${EGREP}" = . ]; then
+ error "$0:ERROR: no egrep(1) found that really supports required regular
expressions"
exit 1
fi
-# check whether AWK supports -v var=val option
-if [ ! .`echo foo | ${AWK} -v foo=bar '/foo/ { print foo }'` = .bar ]; then
- error "$0:ERROR: found ${AWK} but it doesn't support -v var=val option"
+# check whether AWK was found
+if [ ".${AWK}" = . ]; then
+ error "$0:ERROR: no awk(1) found that supports the required \"-v
var=val\" option"
exit 1
fi
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]