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: 21-Apr-2004 13:59:24
Branch: HEAD Handle: 2004042112592300
Modified files:
openpkg-tools/cmd dev.sh
Log:
bugfixing execute and tools functions; omit CD_FUNC_ prefix for local
variables inside cd function
Summary:
Revision Changes Path
1.15 +120 -99 openpkg-tools/cmd/dev.sh
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/dev.sh
============================================================================
$ cvs diff -u -r1.14 -r1.15 dev.sh
--- openpkg-tools/cmd/dev.sh 18 Apr 2004 10:42:46 -0000 1.14
+++ openpkg-tools/cmd/dev.sh 21 Apr 2004 11:59:23 -0000 1.15
@@ -611,18 +611,17 @@
local execute=""
if [ ".$1" = .-q -o ".$1" = .--query ]; then
#FIXME matchinstance "${B}"
- echo $E
+ execute="$E"
+ echo "${execute}"
else
execute="$1"
- if [ ".${execute}" = . ]; then
- return
- fi
- initmpx ${execute}
- if [ ".${RPMCMD}" = . ]; then
- error "${execute} is not a OpenPKG instance"
- return 1
+ if [ ".${execute}" != . ]; then
+ initmpx ${execute}
+ if [ ".${RPMCMD}" = . ]; then
+ error "${execute} is not a OpenPKG instance"
+ return 1
+ fi
fi
-
OPENPKG_EXEC="${execute}"
cd .
fi
@@ -633,11 +632,21 @@
}
openpkg_dev_tools () {
+ local tools=""
if [ ".$1" = .-q -o ".$1" = .--query ]; then
- echo $T
+ tools="$E"
+ echo "${tools}"
else
- OPENPKG_TRUN="$1"
- T="${OPENPKG_TRUN}"
+ tools="$1"
+ if [ ".${tools}" != . ]; then
+ initmpx ${tools}
+ if [ ".${RPMCMD}" = . ]; then
+ error "${tools} is not a OpenPKG instance"
+ return 1
+ fi
+ fi
+ OPENPKG_TRUN="${tools}"
+ cd .
fi
}
@@ -646,15 +655,21 @@
}
openpkg_dev_srcdir () {
+ local srcdir=""
if [ ".$1" = .-q -o ".$1" = .--query ]; then
- S=`pwd | sed -e 's;^;X;' -e 's;^X.*/\(src\.[^/][^/]*\).*$;\1;' -e
's;^X.*;src;'`
- echo "$S"
+ srcdir=`pwd | sed -e 's;^;X;' -e 's;^X.*/\(src\.[^/][^/]*\).*$;\1;' -e
's;^X.*;src;'`
+ echo "${srcdir}"
else
- if [ -d "${OPENPKG_WORK}/src.$1" ]; then
- OPENPKG_SDIR="src.$1"
- cd .
+ srcdir="$1"
+ if [ ".${srcdir}" != . ]; then
+ if [ ! -d "${OPENPKG_WORK}/$1" ]; then
+ error "${srcdir} is not a directory"
+ return 1
+ fi
+ OPENPKG_SDIR="$1"
+ cd
else
- OPENPKG_SDIR="src"
+ OPENPKG_SDIR="${srcdir}"
cd .
fi
fi
@@ -790,7 +805,7 @@
# prompt to indicate openpkg dev bash environment
declare -a DIRSTACKREV=()
cd () {
- local CD_FUNC_PX CD_FUNC_PD CD_FUNC_BX CD_FUNC_BD CD_FUNC_EX CD_FUNC_ED
CD_FUNC_TX CD_FUNC_TD CD_FUNC_SX CD_FUNC_SD CD_FUNC_IX CD_FUNC_ID
+ local PX PD BX BD EX ED TX TD SX SD IX ID workdir
if [ ".$1" = .- ]; then
# go to previous working directory on forward directory stack
# and move this directory onto the reverse directory stack
@@ -842,24 +857,24 @@
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_PX="P=${P}"
- CD_FUNC_PD="P=${P}"
+ PX="P=${P}"
+ PD="P=${P}"
fi
else
if [ ".${P}" = . ]; then
# forced, nothing detected; take forced; print forced black (aka
trailing dot)
P="${OPENPKG_SPEC}"
- CD_FUNC_PX="[1mP=${P}[m"
- CD_FUNC_PD="P=${P}."
+ PX="[1mP=${P}[m"
+ PD="P=${P}."
else
if [ ".${OPENPKG_SPEC}" = ".${P}" ]; then
# forced; detected and matched; keep; print black (aka trailing
dot)
- CD_FUNC_PX="[1mP=${P}[m"
- CD_FUNC_PD="P=${P}."
+ PX="[1mP=${P}[m"
+ PD="P=${P}."
else
# forced; detected and mismatch; keep forced; print forced red
(aka trailing exclamation mark)
- CD_FUNC_PX="[31mP=${OPENPKG_SPEC}[m"
- CD_FUNC_PD="P=${OPENPKG_SPEC}!"
+ PX="[31mP=${OPENPKG_SPEC}[m"
+ PD="P=${OPENPKG_SPEC}!"
P="${OPENPKG_SPEC}"
fi
fi
@@ -874,24 +889,24 @@
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_BX="B=$B"
- CD_FUNC_BD="B=$B"
+ BX="B=$B"
+ BD="B=$B"
fi
else
if [ ".$B" = . ]; then
# forced, nothing detected; take forced; print forced black (aka
trailing dot)
B="${OPENPKG_CTAG}"
- CD_FUNC_BX="[1mB=$B[m"
- CD_FUNC_BD="B=$B."
+ BX="[1mB=$B[m"
+ BD="B=$B."
else
if [ ".${OPENPKG_CTAG}" = ".$B" ]; then
# forced; detected and matched; keep; print black (aka trailing
dot)
- CD_FUNC_BX="[1mB=$B[m"
- CD_FUNC_BD="B=$B."
+ BX="[1mB=$B[m"
+ BD="B=$B."
else
# forced; detected and mismatch; keep forced; print forced red
(aka trailing exclamation mark)
- CD_FUNC_BX="[31mB=${OPENPKG_CTAG}[m"
- CD_FUNC_BD="B=${OPENPKG_CTAG}!"
+ BX="[31mB=${OPENPKG_CTAG}[m"
+ BD="B=${OPENPKG_CTAG}!"
B="${OPENPKG_CTAG}"
fi
fi
@@ -906,31 +921,31 @@
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_EX="E=$E"
- CD_FUNC_ED="E=$E"
+ EX="E=$E"
+ ED="E=$E"
fi
else
if [ ".$E" = . ]; then
# forced, nothing detected; take forced; print forced black (aka
trailing dot)
E="${OPENPKG_EXEC}"
- CD_FUNC_EX="[1mE=$E[m"
- CD_FUNC_ED="E=$E."
+ EX="[1mE=$E[m"
+ ED="E=$E."
else
if [ ".${OPENPKG_EXEC}" = ".$E" ]; then
# forced; detected and matched; keep; print black (aka trailing
dot)
- CD_FUNC_EX="[1mE=$E[m"
- CD_FUNC_ED="E=$E."
+ EX="[1mE=$E[m"
+ ED="E=$E."
else
# forced; detected and mismatch; keep forced; print forced red
(aka trailing exclamation mark)
- CD_FUNC_EX="[1mE=${OPENPKG_EXEC}[m"
- CD_FUNC_ED="E=${OPENPKG_EXEC}!"
+ EX="[1mE=${OPENPKG_EXEC}[m"
+ ED="E=${OPENPKG_EXEC}!"
E="${OPENPKG_EXEC}"
fi
fi
fi
# E has ultimate content
- T=`openpkg_dev_execute --query`
+ T=`openpkg_dev_tools --query`
# T holds detection
if [ ".${OPENPKG_TRUN}" = . ]; then
if [ ".$T" = . ]; then
@@ -938,24 +953,24 @@
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_TX="T=$T"
- CD_FUNC_TD="T=$T"
+ TX="T=$T"
+ TD="T=$T"
fi
else
if [ ".$T" = . ]; then
# forced, nothing detected; take forced; print forced black (aka
trailing dot)
T="${OPENPKG_TRUN}"
- CD_FUNC_TX="[1mT=$T[m"
- CD_FUNC_TD="T=$T."
+ TX="[1mT=$T[m"
+ TD="T=$T."
else
if [ ".${OPENPKG_TRUN}" = ".$T" ]; then
# forced; detected and matched; keep; print black (aka trailing
dot)
- CD_FUNC_TX="[1mT=$T[m"
- CD_FUNC_TD="T=$T."
+ TX="[1mT=$T[m"
+ TD="T=$T."
else
# forced; detected and mismatch; keep forced; print forced red
(aka trailing exclamation mark)
- CD_FUNC_TX="[1mT=${OPENPKG_TRUN}[m"
- CD_FUNC_TD="T=${OPENPKG_TRUN}!"
+ TX="[1mT=${OPENPKG_TRUN}[m"
+ TD="T=${OPENPKG_TRUN}!"
T="${OPENPKG_TRUN}"
fi
fi
@@ -970,75 +985,75 @@
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_SX="S=$S"
- CD_FUNC_SD="S=$S"
+ SX="S=$S"
+ SD="S=$S"
fi
else
if [ ".$S" = . ]; then
# forced, nothing detected; take forced; print forced black (aka
trailing dot)
S="${OPENPKG_SDIR}"
- CD_FUNC_SX="[1mS=$S[m"
- CD_FUNC_SD="S=$S."
+ SX="[1mS=$S[m"
+ SD="S=$S."
else
if [ ".${OPENPKG_SDIR}" = ".$S" ]; then
# forced; detected and matched; keep; print black (aka trailing
dot)
- CD_FUNC_SX="[1mS=$S[m"
- CD_FUNC_SD="S=$S."
+ SX="[1mS=$S[m"
+ SD="S=$S."
else
# forced; detected and mismatch; keep forced; print forced red
(aka trailing exclamation mark)
- CD_FUNC_SX="[1mS=${OPENPKG_SDIR}[m"
- CD_FUNC_SD="S=${OPENPKG_SDIR}!"
+ SX="[1mS=${OPENPKG_SDIR}[m"
+ SD="S=${OPENPKG_SDIR}!"
S="${OPENPKG_SDIR}"
fi
fi
fi
# S has ultimate content
- CD_FUNC_IX=""
- if [ ".$CD_FUNC_PX" != . ]; then
- CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_PX}"
+ IX=""
+ if [ ".$PX" != . ]; then
+ IX="${IX}${IX:+ }${PX}"
fi
- if [ ".$CD_FUNC_BX" != . ]; then
- CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_BX}"
+ if [ ".$BX" != . ]; then
+ IX="${IX}${IX:+ }${BX}"
fi
- if [ ".$CD_FUNC_EX" != . ]; then
- CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_EX}"
+ if [ ".$EX" != . ]; then
+ IX="${IX}${IX:+ }${EX}"
fi
- if [ ".$CD_FUNC_TX" != . ]; then
- CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_TX}"
+ if [ ".$TX" != . ]; then
+ IX="${IX}${IX:+ }${TX}"
fi
- if [ ".$CD_FUNC_SX" != . ]; then
- CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_SX}"
+ if [ ".$SX" != . ]; then
+ IX="${IX}${IX:+ }${SX}"
fi
- if [ ".$CD_FUNC_IX" != . ]; then
- CD_FUNC_IX=" [${CD_FUNC_IX}]"
+ if [ ".$IX" != . ]; then
+ IX=" [${IX}]"
fi
- CD_FUNC_ID=""
- if [ ".$CD_FUNC_PD" != . ]; then
- CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_PD}"
+ ID=""
+ if [ ".$PD" != . ]; then
+ ID="${ID}${ID:+ }${PD}"
fi
- if [ ".$CD_FUNC_BD" != . ]; then
- CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_BD}"
+ if [ ".$BD" != . ]; then
+ ID="${ID}${ID:+ }${BD}"
fi
- if [ ".$CD_FUNC_ED" != . ]; then
- CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_ED}"
+ if [ ".$ED" != . ]; then
+ ID="${ID}${ID:+ }${ED}"
fi
- if [ ".$CD_FUNC_TD" != . ]; then
- CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_TD}"
+ if [ ".$TD" != . ]; then
+ ID="${ID}${ID:+ }${TD}"
fi
- if [ ".$CD_FUNC_SD" != . ]; then
- CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_SD}"
+ if [ ".$SD" != . ]; then
+ ID="${ID}${ID:+ }${SD}"
fi
- if [ ".$CD_FUNC_ID" != . ]; then
- CD_FUNC_ID=" [${CD_FUNC_ID}]"
+ if [ ".$ID" != . ]; then
+ ID=" [${ID}]"
fi
if [ ".${TERM}" = .xterm ]; then
- PS1="[EMAIL PROTECTED]:${PWD}${CD_FUNC_IX}\n${OPENPKG_MODE}\$ "
- echo -n "]0;openpkg dev [EMAIL PROTECTED]:${PWD}${CD_FUNC_ID}"
+ PS1="[EMAIL PROTECTED]:${PWD}${IX}\n${OPENPKG_MODE}\$ "
+ echo -n "]0;openpkg dev [EMAIL PROTECTED]:${PWD}${ID}"
else
- PS1="[EMAIL PROTECTED]:${PWD}${CD_FUNC_ID}\n${OPENPKG_MODE}\$ "
+ PS1="[EMAIL PROTECTED]:${PWD}${ID}\n${OPENPKG_MODE}\$ "
fi
}
@@ -1050,16 +1065,12 @@
umask 022
# prepare for a individual package
- if [ ".$1" != . ]; then openpkg_dev_package $1; fi
- if [ ".$2" != . ]; then openpkg_dev_branch $2; fi
- if [ ".$3" != . ]; then openpkg_dev_execute $3; fi
- if [ ".$4" != . ]; then openpkg_dev_tools $4; fi
- if [ ".$5" != . ]; then openpkg_dev_src $5; fi
- if [ ".${P}" = . ]; then
- cd src
- else
- cd
- fi
+ [ ".$1" != . ] && openpkg_dev_package "$1"
+ [ ".$2" != . ] && openpkg_dev_branch "$2"
+ [ ".$3" != . ] && openpkg_dev_execute "$3"
+ [ ".$4" != . ] && openpkg_dev_tools "$4"
+ [ ".$5" != . ] && openpkg_dev_src "$5"
+ cd
# self destruction
rm ${OPENPKG_WORK}/.bashrc
@@ -1085,10 +1096,20 @@
matchinstance "${OPENPKG_EXEC}" exact
E="${RV}"
+ # canonify OPENPKG_TRUN
+ matchinstance "${OPENPKG_TRUN}" exact
+ T="${RV}"
+
# we must have a E/bin/rpm somewhere
if [ ".$E" = . ]; then
matchinstance "${OPENPKG_CTAG}" any
E="${RV}"
+ fi
+
+ # we must have a T/bin/rpm somewhere
+ if [ ".$T" = . ]; then
+ matchinstance "${OPENPKG_CTAG}" any
+ T="${RV}"
fi
# create a .bashrc
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]