OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 17-Feb-2004 22:43:14
Branch: HEAD Handle: 2004021721431300
Modified files:
openpkg-re openpkg-dev
Log:
adapt openpkg-dev to new filesystem layout world order
bashification: implement dumpfunc() to get rid of inline document scripting
move some functionality into working environment exporting functions but calling
scripts
overload typical commands/tools (i.e. cd|rpm) with functions in both work env and
inside script
speed up processing by using builtins were appropriate
typical pmod job testing tr|vi|lint|bu|list|pe|in|diff|cl|re passed
Summary:
Revision Changes Path
1.157 +289 -275 openpkg-re/openpkg-dev
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-re/openpkg-dev
============================================================================
$ cvs diff -u -r1.156 -r1.157 openpkg-dev
--- openpkg-re/openpkg-dev 10 Feb 2004 15:10:44 -0000 1.156
+++ openpkg-re/openpkg-dev 17 Feb 2004 21:43:13 -0000 1.157
@@ -53,7 +53,7 @@
OPENPKG_CTAG="${OPENPKG_CTAG}"; B="${B}" # B (cvs tag, branch)
OPENPKG_EXEC="${OPENPKG_EXEC}"; E="${E}" # E (exec, instance)
export OPENPKG_SPEC P OPENPKG_CTAG B OPENPKG_EXEC E
-
+
# use an appropriate egrep
if [ -x /usr/xpg4/bin/${EGREP} ]; then
EGREP="/usr/xpg4/bin/egrep"
@@ -114,13 +114,35 @@
# ------------------------------------------------------------
+# dump a function (optionally only the inner code part)
+dumpfunc () {
+ if [ ".$1" = ".-i" ]; then
+ shift
+ type $1 \
+ | awk -v cmd=$1 'BEGIN { f=0 }
+ /^ / { if (f==1) { print $0 } }
+ /^[a-zA-Z0-9]+ is a function/ { f=1 }'
+ else
+ type $1 \
+ | awk -v cmd=$1 'BEGIN { f=0 }
+ // { if (f==1) { print $0 } }
+ /^[a-zA-Z0-9]+ is a function/ { print "unalias "cmd" >/dev/null
2>&1"; f=1 }'
+ fi
+}
+
+# print a warning
warn () {
- echo "${prog_name}:WARNING: $1" 1>&2
+ echo "${prog_name:-$0}:WARNING: $@" 1>&2
+}
+
+# print an error
+error () {
+ echo "${prog_name:-$0}:ERROR: $@" 1>&2
}
+# print an error and die
die () {
- # exit gracefully
- echo "${prog_name}:ERROR: $1" 1>&2
+ error "$@"
exit 1
}
@@ -159,6 +181,54 @@
unset _rv
}
+# get RPMCMD to the correct rpm cmd for a given instance, see
http://cvs.openpkg.org/chngview?cn=14911
+getrpmcmd () {
+ if [ -x "$1/bin/openpkg" -a -x "$1/libexec/openpkg" ]; then #OpenPKG v2.x
+ RPMCMD="$1/bin/openpkg rpm"
+ elif [ -x "$1/bin/rpm" -a ! -x "$1/libexec/openpkg" ]; then #OpenPKG v1.x
+ RPMCMD="$1/bin/rpm"
+ else #OpenPKG N/A
+ RPMCMD=""
+ fi
+}
+
+# smart dealing with temporary root privileges
+root () {
+ if [ $# -eq 0 ]; then
+ ssh -t -x [EMAIL PROTECTED] builtin cd ${PWD} \&\& ${SHELL}
+ elif [ ".$1" = .rpm ]; then
+ shift
+ getrpmcmd $E
+ if [ ".${RPMCMD}" != . ]; then
+ ssh -t -x [EMAIL PROTECTED] builtin cd ${PWD} \&\& HOME=${OPENPKG_WORK}
command ${RPMCMD} "$@"
+ else
+ echo "$0:ERROR: no openpkg rpm found in instance \"${E}\""
+ return 1
+ fi
+ else
+ ssh -x [EMAIL PROTECTED] builtin cd ${PWD} \&\& "$@"
+ fi
+}
+
+cvs () {
+ cvs_colorize="cat"
+ case "$1" in
+ di|dif|diff ) [ ".`uwhich cvs-diff-colorize`" != . ] &&
cvs_colorize="cvs-diff-colorize" ;;
+ up|upd|update ) [ ".`uwhich cvs-update-colorize`" != . ] &&
cvs_colorize="cvs-update-colorize" ;;
+ esac
+ HOME=${OPENPKG_WORK} command cvs ${1+"$@"} | $cvs_colorize
+}
+
+rpm () {
+ getrpmcmd $E
+ if [ ".${RPMCMD}" != . ]; then
+ HOME=${OPENPKG_WORK} command ${RPMCMD} "$@"
+ else
+ echo "$0:ERROR: no openpkg rpm found in instance \"${E}\""
+ return 1
+ fi
+}
+
setup () {
# honor optional parameters [[[spec]ctag]exec]; use "" to specify a empty
parameter and use it's default
[ ".$1" != . ] && OPENPKG_SPEC="$1"
@@ -277,7 +347,7 @@
# checkout the CVS module(s)
if [ ".${P}" = . ]; then
echo "++ checking out source areas (${OPENPKG_REPO}/{adm,doc,re,src,web})"
- ( cd "${OPENPKG_WORK}"
+ ( builtin cd "${OPENPKG_WORK}"
HOME="${OPENPKG_WORK}"
export HOME
cvs -q -d "${OPENPKG_REPO}" checkout openpkg-dev-adm openpkg-dev-doc
openpkg-dev-re openpkg-dev-web
@@ -289,7 +359,7 @@
)
else
echo "++ checking out minimal source areas (${OPENPKG_REPO}/{re,src})"
- ( cd "${OPENPKG_WORK}"
+ ( builtin cd "${OPENPKG_WORK}"
HOME="${OPENPKG_WORK}"
export HOME
cvs -q -d "${OPENPKG_REPO}" checkout openpkg-dev-re
@@ -320,7 +390,7 @@
update () {
echo "++ updating ${OPENPKG_REPO}/{src,web,doc,re,adm}"
- ( cd ${OPENPKG_WORK} || die "cannot cd to ${OPENPKG_WORK}"
+ ( builtin cd ${OPENPKG_WORK} || die "cannot cd to ${OPENPKG_WORK}"
HOME=${OPENPKG_WORK}
export HOME
cvs -d ${OPENPKG_REPO} update
@@ -360,7 +430,7 @@
if [ -d "${workdir}" ]; then
echo "++ using existing directory ${workdir}"
else
- ( cd ${sourcedir} && cvs up -d ${package} 2>&1 >/dev/null )
+ ( builtin cd ${sourcedir} && cvs up -d ${package} 2>&1 >/dev/null )
if [ -d "${workdir}" ]; then
echo "++ using updated directory ${workdir}"
else
@@ -540,14 +610,17 @@
INSTANCE="$1"
if [ ".$mode" = .exact ]; then
echo "${INSTANCE}" | ${EGREP} "^/" >/dev/null #PATH
- if [ $? -eq 0 -a -x "${INSTANCE}/bin/rpm" ]; then
- RV="${INSTANCE}"
- unset INSTANCE
- return
- else
- RV=""
- unset INSTANCE
- return
+ if [ $? -eq 0 ]; then
+ getrpmcmd ${INSTANCE}
+ if [ ".${RPMCMD}" != . ]; then
+ RV="${INSTANCE}"
+ unset INSTANCE
+ return
+ else
+ RV=""
+ unset INSTANCE
+ return
+ fi
fi
fi
@@ -562,8 +635,9 @@
RE="`echo ${RE} | sed -e 's;\.;\\.;g'`"
for INSTANCE in ${OPENPKG_INST}; do
- if [ -x "${INSTANCE}/bin/rpm" ]; then
- VERSION=`${INSTANCE}/bin/rpm -q --qf "%{VERSION}" openpkg`
+ getrpmcmd ${INSTANCE}
+ if [ ".${RPMCMD}" != . ]; then
+ VERSION=`${RPMCMD} -q --qf "%{VERSION}" openpkg`
echo ${VERSION} | ${EGREP} "$RE" >/dev/null
if [ $? -eq 0 ]; then
RV="${INSTANCE}"
@@ -574,7 +648,8 @@
done
if [ ".$mode" = .any ]; then
for INSTANCE in ${OPENPKG_INST}; do
- if [ -x "${INSTANCE}/bin/rpm" ]; then
+ getrpmcmd ${INSTANCE}
+ if [ ".${RPMCMD}" != . ]; then
RV="${INSTANCE}"
unset INSTANCE
return
@@ -585,100 +660,38 @@
unset INSTANCE
}
-bash () {
- # honor optional parameters [[[spec]ctag]exec]; use "" to specify a empty
parameter and use it's default
- [ ".$1" != . ] && OPENPKG_SPEC="$1"
- [ ".$2" != . ] && OPENPKG_CTAG="$2"
- [ ".$3" != . ] && OPENPKG_EXEC="$3"
-
- # enter working directory
- cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
-
- # canonify OPENPKG_CTAG
- canonifybranch "${OPENPKG_CTAG}"
- OPENPKG_CTAG="${RV}"
-
- # canonify OPENPKG_EXEC
- matchinstance "${OPENPKG_EXEC}" exact
- OPENPKG_EXEC="${RV}"
-
- # set P,B,E without having "cd()" already in place
- P="${OPENPKG_SPEC}"
- B="${OPENPKG_CTAG}"
- E="${OPENPKG_EXEC}"
-
- # we must have a E/bin/rpm somewhere
- if [ ".$E" = . ]; then
- matchinstance "${OPENPKG_CTAG}" any
- E="${RV}"
- fi
-
- # create a .bashrc
- cat <<-EOF >.bashrc
-
+bashrcprolog () {
# use original .bashrc as a baseline
- [ -f \${HOME}/.bashrc ] && source \${HOME}/.bashrc
+ [ -f ${HOME}/.bashrc ] && source ${HOME}/.bashrc
# use SSH for CVS
CVS_RSH=ssh
export CVS_RSH
# import OpenPKG environment
- eval \`\${E}/etc/rc --eval openpkg env\`
-
- # provide a unified which(1) command, because vendor implementations differ
in error results.
- uwhich () {
- _rv=""
- for _tool in \$*; do
- _ifs="\$IFS"; IFS=":"
- for _path in \$PATH; do
- if [ -f "\$_path/\$_tool" ]; then
- _rv="\$_path/\$_tool"
- break
- fi
- done
- IFS="\$_ifs"; unset _ifs
- if [ ".\$_rv" != . ]; then
- break
- fi
- done
- echo \$_rv
- unset _rv
- }
-
- # smart dealing with temporary root privileges
- root () {
- if [ \$# -eq 0 ]; then
- ssh -t -x [EMAIL PROTECTED] cd \${PWD} \&\& \${SHELL}
- elif [ ".\$1" = .rpm ]; then
- shift
- ssh -t -x [EMAIL PROTECTED] cd \${PWD} \&\& HOME=\${OPENPKG_WORK}
\${E}/bin/rpm "\$@"
- else
- ssh -x [EMAIL PROTECTED] cd \${PWD} \&\& "\$@"
- fi
- }
+ eval `${E}/etc/rc --eval openpkg env`
# prompt to indicate openpkg-dev bash environment
declare -a DIRSTACKREV=()
cd () {
- if [ ".\$1" = .- ]; then
+ if [ ".$1" = .- ]; then
# go to previous working directory on forward directory stack
# and move this directory onto the reverse directory stack
- if [ \${#DIRSTACK[*]} -gt 1 ]; then
- workdir="\${DIRSTACK[0]}"
- DIRSTACKREV[\${#DIRSTACKREV[*]}]="\${workdir}"
+ if [ ${#DIRSTACK[*]} -gt 1 ]; then
+ workdir="${DIRSTACK[0]}"
+ DIRSTACKREV[${#DIRSTACKREV[*]}]="${workdir}"
popd >/dev/null
else
echo "cd: no more previous working directories on forward directory
stack" 1>&2
return 1
fi
- elif [ ".\$1" = .+ ]; then
+ elif [ ".$1" = .+ ]; then
# go to previous working directory on reverse directory stack
# and move this directory onto the forward directory stack
- if [ \${#DIRSTACKREV[*]} -gt 0 ]; then
- local i=\$((\${#DIRSTACKREV[*]} - 1))
- eval "pushd \${DIRSTACKREV[\$i]} >/dev/null"
- unset DIRSTACKREV[\$i]
+ if [ ${#DIRSTACKREV[*]} -gt 0 ]; then
+ local i=$((${#DIRSTACKREV[*]} - 1))
+ eval "pushd ${DIRSTACKREV[$i]} >/dev/null"
+ unset DIRSTACKREV[$i]
else
echo "cd: no more previous working directories on reverse directory
stack" 1>&2
return 1
@@ -686,215 +699,235 @@
else
# go to next working directory
# and move this directory onto the forward directory stack
- if [ ".\$1" = . ]; then
- if [ ".\${OPENPKG_SPEC}" = . ]; then
- workdir="\${OPENPKG_WORK}"
+ if [ ".$1" = . ]; then
+ if [ ".${OPENPKG_SPEC}" = . ]; then
+ workdir="${OPENPKG_WORK}"
else
- workdir="\`command \${OPENPKG_WORK}/re/openpkg-dev package
-query workdir \${OPENPKG_SPEC}\`"
+ workdir="`command ${OPENPKG_WORK}/re/openpkg-dev package -query
workdir ${OPENPKG_SPEC}`"
fi
else
- workdir="\$1"
+ workdir="$1"
fi
- pushd \${workdir} >/dev/null
- if [ \${#DIRSTACK[*]} -ge 2 -a \${DIRSTACK[0]} = \${DIRSTACK[1]} ]; then
+ pushd ${workdir} >/dev/null
+ if [ ${#DIRSTACK[*]} -ge 2 -a ${DIRSTACK[0]} = ${DIRSTACK[1]} ]; then
popd >/dev/null
fi
DIRSTACKREV=()
fi
- P=\`command \${OPENPKG_WORK}/re/openpkg-dev package\`
+ P=`command ${OPENPKG_WORK}/re/openpkg-dev package`
# P holds detection
- if [ ".\${OPENPKG_SPEC}" = . ]; then
- if [ ".\${P}" = . ]; then
+ if [ ".${OPENPKG_SPEC}" = . ]; then
+ if [ ".${P}" = . ]; then
# nothing forced, nothing detected; keep nothing; print nothing
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_PX="P=\${P}"
- CD_FUNC_PD="P=\${P}"
+ CD_FUNC_PX="P=${P}"
+ CD_FUNC_PD="P=${P}"
fi
else
- if [ ".\${P}" = . ]; then
+ 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}."
+ P="${OPENPKG_SPEC}"
+ CD_FUNC_PX="[1mP=${P}[m"
+ CD_FUNC_PD="P=${P}."
else
- if [ ".\${OPENPKG_SPEC}" = ".\${P}" ]; then
+ 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}."
+ CD_FUNC_PX="[1mP=${P}[m"
+ CD_FUNC_PD="P=${P}."
else
# forced; detected and mismatch; keep forced; print forced
black ! detected normal (aka forced exclamation mark detected)
- CD_FUNC_PX="[1mP=\${OPENPKG_SPEC}[m![31m\${P}[m"
- CD_FUNC_PD="P=\${OPENPKG_SPEC}!\${P}"
- P="\${OPENPKG_SPEC}"
+ CD_FUNC_PX="[1mP=${OPENPKG_SPEC}[m![31m${P}[m"
+ CD_FUNC_PD="P=${OPENPKG_SPEC}!${P}"
+ P="${OPENPKG_SPEC}"
fi
fi
fi
# P has ultimate content
- B=\`command \${OPENPKG_WORK}/re/openpkg-dev branch\`
+ B=`command ${OPENPKG_WORK}/re/openpkg-dev branch`
# B holds detection
- if [ ".\${OPENPKG_CTAG}" = . ]; then
- if [ ".\${B}" = . ]; then
+ if [ ".${OPENPKG_CTAG}" = . ]; then
+ if [ ".${B}" = . ]; then
# nothing forced, nothing detected; keep nothing; print nothing
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_BX="B=\${B}"
- CD_FUNC_BD="B=\${B}"
+ CD_FUNC_BX="B=${B}"
+ CD_FUNC_BD="B=${B}"
fi
else
- if [ ".\${B}" = . ]; then
+ 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}."
+ B="${OPENPKG_CTAG}"
+ CD_FUNC_BX="[1mB=${B}[m"
+ CD_FUNC_BD="B=${B}."
else
- if [ ".\${OPENPKG_CTAG}" = ".\${B}" ]; then
+ 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}."
+ CD_FUNC_BX="[1mB=${B}[m"
+ CD_FUNC_BD="B=${B}."
else
# forced; detected and mismatch; keep forced; print forced
black ! detected normal (aka forced exclamation mark detected)
- CD_FUNC_BX="[1mB=\${OPENPKG_CTAG}[m![31m\${B}[m"
- CD_FUNC_BD="B=\${OPENPKG_CTAG}!\${B}"
- B="\${OPENPKG_CTAG}"
+ CD_FUNC_BX="[1mB=${OPENPKG_CTAG}[m![31m${B}[m"
+ CD_FUNC_BD="B=${OPENPKG_CTAG}!${B}"
+ B="${OPENPKG_CTAG}"
fi
fi
fi
# B has ultimate content
- E=\`command \${OPENPKG_WORK}/re/openpkg-dev execute\`
+ E=`command ${OPENPKG_WORK}/re/openpkg-dev execute`
# E holds detection
- if [ ".\${OPENPKG_EXEC}" = . ]; then
- if [ ".\${E}" = . ]; then
+ if [ ".${OPENPKG_EXEC}" = . ]; then
+ if [ ".${E}" = . ]; then
# nothing forced, nothing detected; keep nothing; print nothing
:
else
# nothing forced, something detected; keep detected; print detected
normal
- CD_FUNC_EX="E=\${E}"
- CD_FUNC_ED="E=\${E}"
+ CD_FUNC_EX="E=${E}"
+ CD_FUNC_ED="E=${E}"
fi
else
- if [ ".\${E}" = . ]; then
+ 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}."
+ E="${OPENPKG_EXEC}"
+ CD_FUNC_EX="[1mE=${E}[m"
+ CD_FUNC_ED="E=${E}."
else
- if [ ".\${OPENPKG_EXEC}" = ".\${E}" ]; then
+ 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}."
+ CD_FUNC_EX="[1mE=${E}[m"
+ CD_FUNC_ED="E=${E}."
else
# forced; detected and mismatch; keep forced; print forced
black ! detected normal (aka forced exclamation mark detected)
- CD_FUNC_EX="[1mE=\${OPENPKG_EXEC}[m![31m\${E}[m"
- CD_FUNC_ED="E=\${OPENPKG_EXEC}!\${E}"
- E="\${OPENPKG_EXEC}"
+ CD_FUNC_EX="[1mE=${OPENPKG_EXEC}[m![31m${E}[m"
+ CD_FUNC_ED="E=${OPENPKG_EXEC}!${E}"
+ E="${OPENPKG_EXEC}"
fi
fi
fi
# E has ultimate content
CD_FUNC_IX=""
- if [ ".\$CD_FUNC_PX" != . ]; then
- CD_FUNC_IX="\${CD_FUNC_IX}\${CD_FUNC_IX:+ }\${CD_FUNC_PX}"
+ if [ ".$CD_FUNC_PX" != . ]; then
+ CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_PX}"
fi
- if [ ".\$CD_FUNC_BX" != . ]; then
- CD_FUNC_IX="\${CD_FUNC_IX}\${CD_FUNC_IX:+ }\${CD_FUNC_BX}"
+ if [ ".$CD_FUNC_BX" != . ]; then
+ CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_BX}"
fi
- if [ ".\$CD_FUNC_EX" != . ]; then
- CD_FUNC_IX="\${CD_FUNC_IX}\${CD_FUNC_IX:+ }\${CD_FUNC_EX}"
+ if [ ".$CD_FUNC_EX" != . ]; then
+ CD_FUNC_IX="${CD_FUNC_IX}${CD_FUNC_IX:+ }${CD_FUNC_EX}"
fi
- if [ ".\$CD_FUNC_IX" != . ]; then
- CD_FUNC_IX=" [\${CD_FUNC_IX}]"
+ if [ ".$CD_FUNC_IX" != . ]; then
+ CD_FUNC_IX=" [${CD_FUNC_IX}]"
fi
CD_FUNC_ID=""
- if [ ".\$CD_FUNC_PD" != . ]; then
- CD_FUNC_ID="\${CD_FUNC_ID}\${CD_FUNC_ID:+ }\${CD_FUNC_PD}"
+ if [ ".$CD_FUNC_PD" != . ]; then
+ CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_PD}"
fi
- if [ ".\$CD_FUNC_BD" != . ]; then
- CD_FUNC_ID="\${CD_FUNC_ID}\${CD_FUNC_ID:+ }\${CD_FUNC_BD}"
+ if [ ".$CD_FUNC_BD" != . ]; then
+ CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_BD}"
fi
- if [ ".\$CD_FUNC_ED" != . ]; then
- CD_FUNC_ID="\${CD_FUNC_ID}\${CD_FUNC_ID:+ }\${CD_FUNC_ED}"
+ if [ ".$CD_FUNC_ED" != . ]; then
+ CD_FUNC_ID="${CD_FUNC_ID}${CD_FUNC_ID:+ }${CD_FUNC_ED}"
fi
- if [ ".\$CD_FUNC_ID" != . ]; then
- CD_FUNC_ID=" [\${CD_FUNC_ID}]"
+ if [ ".$CD_FUNC_ID" != . ]; then
+ CD_FUNC_ID=" [${CD_FUNC_ID}]"
fi
- if [ ".\${TERM}" = .xterm ]; then
- PS1="[EMAIL PROTECTED]:\${PWD}\${CD_FUNC_IX}\\nopenpkg-dev\$ "
- echo -n "]0;openpkg-dev [EMAIL PROTECTED]:\${PWD}\${CD_FUNC_ID}"
+ if [ ".${TERM}" = .xterm ]; then
+ PS1="[EMAIL PROTECTED]:${PWD}${CD_FUNC_IX}\nopenpkg-dev$ "
+ echo -n "]0;openpkg-dev [EMAIL PROTECTED]:${PWD}${CD_FUNC_ID}"
else
- PS1="[EMAIL PROTECTED]:\${PWD}\${CD_FUNC_ID}\\nopenpkg-dev\$ "
+ PS1="[EMAIL PROTECTED]:${PWD}${CD_FUNC_ID}\nopenpkg-dev$ "
fi
unset CD_FUNC_PX CD_FUNC_PD CD_FUNC_BX CD_FUNC_BD CD_FUNC_EX CD_FUNC_ED
CD_FUNC_IX CD_FUNC_ID
}
openpkg-dev () {
- case \$1 in
- package | pa* ) OPENPKG_SPEC="\`command \${OPENPKG_WORK}/re/openpkg-dev
package -query package \$2\`"; cd . ;;
- branch | br* ) OPENPKG_CTAG="\`command \${OPENPKG_WORK}/re/openpkg-dev
branch -query branch \$2\`"; cd . ;;
- execute | e* ) OPENPKG_EXEC="\`command \${OPENPKG_WORK}/re/openpkg-dev
execute -query execute \$2\`"; cd . ;;
+ case $1 in
+ package | pa* ) OPENPKG_SPEC="`command ${OPENPKG_WORK}/re/openpkg-dev
package -query package $2`"; cd . ;;
+ branch | br* ) OPENPKG_CTAG="`command ${OPENPKG_WORK}/re/openpkg-dev
branch -query branch $2`"; cd . ;;
+ execute | e* ) OPENPKG_EXEC="`command ${OPENPKG_WORK}/re/openpkg-dev
execute -query execute $2`"; cd . ;;
esac
- command \${OPENPKG_WORK}/re/openpkg-dev \${1+"\$@"}
- case \$1 in
- package | pa* ) if [ ".\$2" = . ]; then cd .; else cd
\${OPENPKG_WORK}/src/\${P}; fi ;;
+ command ${OPENPKG_WORK}/re/openpkg-dev ${1+"$@"}
+ case $1 in
+ package | pa* ) if [ ".$2" = . ]; then cd .; else cd
${OPENPKG_WORK}/src/${P}; fi ;;
branch | br* ) cd . ;;
execute | e* ) cd . ;;
esac
}
alias opd=openpkg-dev
+}
- # override cvs and rpm commands to use local config files
- unalias cvs >/dev/null 2>&1
- cvs () {
- cvs_colorize="cat"
- case "\$1" in
- di|dif|diff ) [ ".\`uwhich cvs-diff-colorize\`" != . ] &&
cvs_colorize="cvs-diff-colorize" ;;
- up|upd|update ) [ ".\`uwhich cvs-update-colorize\`" != . ] &&
cvs_colorize="cvs-update-colorize" ;;
- esac
- HOME=\${OPENPKG_WORK} command cvs \${1+"\$@"} | \$cvs_colorize
- }
-
- unalias rpm >/dev/null 2>&1
- rpm () {
- if [ ".\$E" = . -o ! -x \$E/bin/rpm ]; then
- echo "\$E/bin/rpm not executable. \\\$E might not be set properly."
- fi
- HOME=\${OPENPKG_WORK} command \$E/bin/rpm "\$@"
- }
-
+bashrcepilog () {
# sane environment
umask 022
# prepare for a individual package
- if [ ".${OPENPKG_SPEC}" != . ]; then openpkg-dev package ${OPENPKG_SPEC}; fi
- if [ ".${OPENPKG_CTAG}" != . ]; then openpkg-dev branch ${OPENPKG_CTAG}; fi
- if [ ".${OPENPKG_EXEC}" != . ]; then openpkg-dev execute ${OPENPKG_EXEC}; fi
- if [ ".\${P}" = . ]; then
- builtin cd src
+ 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 [ ".${P}" = . ]; then
+ cd src
+ else
+ cd
fi
- cd .
# pass-through environment
- export TMPDIR="${TMPDIR-/tmp}"
+ export TMPDIR="/tmp"
# self destruction
- rm \${OPENPKG_WORK}/.bashrc
-EOF
+ rm ${OPENPKG_WORK}/.bashrc
+}
+
+bash () {
+ # honor optional parameters [[[spec]ctag]exec]; use "" to specify a empty
parameter and use it's default
+ [ ".$1" != . ] && OPENPKG_SPEC="$1"
+ [ ".$2" != . ] && OPENPKG_CTAG="$2"
+ [ ".$3" != . ] && OPENPKG_EXEC="$3"
+
+ # enter working directory
+ builtin cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
+ P="${OPENPKG_SPEC}"
+
+ # canonify OPENPKG_CTAG
+ canonifybranch "${OPENPKG_CTAG}"
+ B="${RV}"
+
+ # canonify OPENPKG_EXEC
+ matchinstance "${OPENPKG_EXEC}" exact
+ E="${RV}"
+
+ # we must have a E/bin/rpm somewhere
+ if [ ".$E" = . ]; then
+ matchinstance "${OPENPKG_CTAG}" any
+ E="${RV}"
+ fi
+
+ # create a .bashrc
+ dumpfunc -i bashrcprolog >.bashrc
+ dumpfunc warn >>.bashrc
+ dumpfunc error >>.bashrc
+ dumpfunc makedir >>.bashrc
+ dumpfunc uwhich >>.bashrc
+ dumpfunc getrpmcmd >>.bashrc
+ dumpfunc root >>.bashrc
+ dumpfunc cvs >>.bashrc
+ dumpfunc rpm >>.bashrc
+ dumpfunc -i bashrcepilog >>.bashrc
# make sure temporary area exists
if [ ! -d ${OPENPKG_TEMP} ]; then
makedir 700 ${OPENPKG_TEMP} || die "cannot create ${OPENPKG_TEMP}"
fi
- # find reasonable Bash
+ # find reasonable bash
matchinstance "" any
if [ -f "${RV}/bin/bash" ]; then
bash="${RV}/bin/bash"
@@ -925,10 +958,7 @@
else
all="$*"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
- locationid=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval %{_rpmfilename} | sed -e
's;^.*}-;;' -e 's;\.rpm$;;'`
+ locationid=`rpm --eval %{_rpmfilename} | sed -e 's;^.*}-;;' -e 's;\.rpm$;;'`
for name in $all; do
name=`echo $name | sed -e 's;\.src\.rpm$;;' -e 's;\.nosrc\.rpm$;;'` #
convenience
ls -l ${OPENPKG_WORK}/pkg/src/$name* | ${EGREP}
"/$name[^-]*-[^-]+-[^-]+\.(no)?src.rpm$"
@@ -945,36 +975,29 @@
else
all="$*"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
for name in $all; do
name=`echo $name | sed -e 's;\.src\.rpm$;;' -e 's;\.nosrc\.rpm$;;'` #
convenience
if [ ! -f "${OPENPKG_WORK}/src/${name}/${name}.spec" ]; then
warn "${OPENPKG_WORK}/src/${name}/${name}.spec not found"
continue
fi
- template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmfilename}'`
- rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "${template}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpmdir=`HOME=${OPENPKG_WORK} ${E}/bin/rpm --eval '%{_rpmdir}'`
+ template=`rpm --eval '%{_rpmfilename}'`
+ rpmfile=`rpm -q --qf "${template}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
+ rpmdir=`rpm --eval '%{_rpmdir}'`
if [ ! -f "$rpmdir/$rpmfile" ]; then
die "binary RPM not found: $rpmdir/$rpmfile"
fi
echo "++ peeking at file list of binary RPM: $rpmfile"
filter="sed -e 's;^;\\ \\ \\ ;'"
tmpfile="${OPENPKG_TEMP}/${name}${GUID}"
- OIFS="$IFS"; IFS="
-"
- for configfile in `HOME=${OPENPKG_WORK} $E/bin/rpm -qplc $rpmdir/$rpmfile`;
do
- IFS="$OIFS"
+ for configfile in `rpm -qplc $rpmdir/$rpmfile`; do
filter="$filter -e \"s;^ \\\\(.* ${configfile}\\\\)\$;C\\\\1;\""
done
- for docfile in `HOME=${OPENPKG_WORK} $E/bin/rpm -qpld $rpmdir/$rpmfile`; do
+ for docfile in `rpm -qpld $rpmdir/$rpmfile`; do
IFS="$OIFS"
filter="$filter -e \"s;^ \\\\(.* ${docfile}\\\\)\$;D\\\\1;\""
done
- IFS="$OIFS"
- HOME=${OPENPKG_WORK} ${E}/bin/rpm -qplv $rpmdir/$rpmfile | eval $filter
+ rpm -qplv $rpmdir/$rpmfile | eval $filter
done
}
@@ -1023,9 +1046,6 @@
else
all="${packages}"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
# determine whether CVS commit messages can be bundled
bundle=0
@@ -1054,11 +1074,11 @@
if [ ! -f "${OPENPKG_WORK}/src/${name}/${name}.spec" ]; then
die "${OPENPKG_WORK}/src/${name}/${name}.spec not found"
fi
- template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmfilename}' | sed -e
's;\..*$;;'`
- rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "${template}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
+ template=`rpm --eval '%{_rpmfilename}' | sed -e 's;\..*$;;'`
+ rpmfile=`rpm -q --qf "${template}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
echo "++ cleaning up sources"
- HOME=${OPENPKG_WORK} $E/bin/rpm --clean --nodeps
${OPENPKG_WORK}/src/${name}/${name}.spec >/dev/null 2>&1 || true
+ rpm --clean --nodeps ${OPENPKG_WORK}/src/${name}/${name}.spec >/dev/null
2>&1 || true
# developer section
if [ ".${OPENPKG_MODE}" = .developer ]; then
@@ -1088,7 +1108,7 @@
echo "++ determine old version (if any)"
tmpfile="${OPENPKG_TEMP}/${name}${GUID}"
- cvs_stat=`cd ${OPENPKG_WORK}; cvs -d ${OPENPKG_REPO} stat
src/${name}/${name}.spec 2>/dev/null | grep 'Repository revision:'`
+ cvs_stat=`builtin cd ${OPENPKG_WORK}; cvs -d ${OPENPKG_REPO} stat
src/${name}/${name}.spec 2>/dev/null | grep 'Repository revision:'`
cvs_rev=`echo "${cvs_stat}" | awk '/Repository revision:/ { print $3;
}'`
cvs_dead=`echo "${cvs_stat}" | grep '/Attic/'`
if [ ".${cvs_dead}" != . ]; then
@@ -1096,18 +1116,18 @@
fi
if [ ".${cvs_rev}" != .No ]; then
cvs -d ${OPENPKG_REPO} co -p -r${cvs_rev}
openpkg-src/${name}/${name}.spec >${tmpfile} 2>/dev/null
- rpm_version_old=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"%{VERSION}" --specfile ${tmpfile} 2>/dev/null`
- rpm_release_old=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"%{RELEASE}" --specfile ${tmpfile} 2>/dev/null`
+ rpm_version_old=`rpm -q --qf "%{VERSION}" --specfile ${tmpfile}
2>/dev/null`
+ rpm_release_old=`rpm -q --qf "%{RELEASE}" --specfile ${tmpfile}
2>/dev/null`
rm -f ${tmpfile}
[ ".${rpm_version_old}" = . ] && die "cannot determine old version
number"
[ ".${rpm_release_old}" = . ] && die "cannot determine old release
number"
fi
echo "++ determine new version"
- rpm_version_new=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "%{VERSION}"
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpm_release_new=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "%{RELEASE}"
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpm_name=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "%{NAME}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpm_summary=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "%{SUMMARY}"
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
+ rpm_version_new=`rpm -q --qf "%{VERSION}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
+ rpm_release_new=`rpm -q --qf "%{RELEASE}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
+ rpm_name=`rpm -q --qf "%{NAME}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
+ rpm_summary=`rpm -q --qf "%{SUMMARY}" --specfile
${OPENPKG_WORK}/src/${name}/${name}.spec`
[ ".${rpm_version_new}" = . ] && die "cannot determine new version
number"
[ ".${rpm_release_new}" = . ] && die "cannot determine new release
number"
@@ -1163,7 +1183,8 @@
if [ ".${BRANCH}" = .HEAD ]; then
echo "++ linting ${name}.spec (package specification)"
- HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm=${E}/bin/rpm ${OPENPKG_WORK}/src/${name}/${name}.spec
+ getrpmcmd $E
+ HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm="${RPMCMD}" ${OPENPKG_WORK}/src/${name}/${name}.spec
if [ $? -gt 0 ]; then
die "unacceptable specification:
${OPENPKG_WORK}/src/${name}/${name}.spec"
fi
@@ -1184,8 +1205,8 @@
fi
if [ ".${BRANCH}" = .HEAD -a ".$extra" = .1 ]; then
- bin_template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval
'%{_rpmfilename}'`
- bin_rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"${bin_template}" \
+ bin_template=`rpm --eval '%{_rpmfilename}'`
+ bin_rpmfile=`rpm -q --qf "${bin_template}" \
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
bin_rpmdir=`HOME=${OPENPKG_WORK} ${E}/bin/rpm --eval '%{_rpmdir}'`
if [ -f "$bin_rpmdir/$bin_rpmfile" ]; then
@@ -1254,7 +1275,7 @@
files="src/${name}"
echo "++ comitting changes to CVS repository"
- cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
+ builtin cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
if [ ".${msg}" != . -a -f "${msg}" ]; then
if [ ${bundle} -eq 1 ]; then
bundle_files="${bundle_files} ${files}"
@@ -1307,7 +1328,7 @@
fi
echo "Subject: ${msg}"
echo ""
- ( cd ${OPENPKG_WORK}; cvs -d ${OPENPKG_REPO} diff -N -u3 src/${name} )
+ ( builtin cd ${OPENPKG_WORK}; cvs -d ${OPENPKG_REPO} diff -N -u3
src/${name} )
) >${OPENPKG_WORK}/${name}.diff
echo "++ uploading patch file to OpenPKG contribution area"
@@ -1322,7 +1343,7 @@
# lazy execution of bundled CVS commit
if [ ${bundle} -eq 1 ]; then
- cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
+ builtin cd "${OPENPKG_WORK}" || die "cannot cd to ${OPENPKG_WORK}"
if [ ${dry} -eq 0 ]; then
chmod 664 ${bundle_srpms}
scp -o "Compression no" -o "Cipher blowfish" ${bundle_srpms}
${OPENPKG_DIST}/${upload}
@@ -1384,7 +1405,7 @@
if [ ${dry} -eq 0 ]; then
makedir 755 ${OPENPKG_WORK}/src/${name} || die "cannot create
${OPENPKG_WORK}/src/${name}"
if [ ".${OPENPKG_MODE}" = .developer ]; then
- ( cd ${OPENPKG_WORK}/src && cvs -d ${OPENPKG_REPO} add ${name} )
+ ( builtin cd ${OPENPKG_WORK}/src && cvs -d ${OPENPKG_REPO} add
${name} )
fi
else
echo "makedir 755 ${OPENPKG_WORK}/src/${name}"
@@ -1482,7 +1503,7 @@
echo ""
) >${OPENPKG_WORK}/src/${name}/${name}.spec
if [ ".${OPENPKG_MODE}" = .developer ]; then
- ( cd ${OPENPKG_WORK}/src/${name} && cvs -d ${OPENPKG_REPO} add
${name}.spec )
+ ( builtin cd ${OPENPKG_WORK}/src/${name} && cvs -d ${OPENPKG_REPO}
add ${name}.spec )
fi
else
echo "creating ${OPENPKG_WORK}/src/${name}/${name}.spec"
@@ -1511,21 +1532,18 @@
else
all="${packages}"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
for name in $all; do
echo "++ installing ${name}"
if [ ! -f "${OPENPKG_WORK}/src/${name}/${name}.spec" ]; then
warn "${OPENPKG_WORK}/src/${name}/${name}.spec not found"
continue
fi
- package=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"%{NAME}-%{VERSION}-%{RELEASE}" \
+ package=`rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}" \
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmfilename}'`
- rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "${template}" \
+ template=`rpm --eval '%{_rpmfilename}'`
+ rpmfile=`rpm -q --qf "${template}" \
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpmdir=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmdir}'`
+ rpmdir=`rpm --eval '%{_rpmdir}'`
if [ ! -f "$rpmdir/$rpmfile" ]; then
build ${name}
fi
@@ -1534,18 +1552,18 @@
fi
if [ $force -ne 0 ]; then
echo "++ installing $package ($rpmfile) forced"
- ssh -t -x "[EMAIL PROTECTED]" HOME=${OPENPKG_WORK} $E/bin/rpm -Uvh
"$rpmdir/$rpmfile" --force --nodeps
+ ssh -t -x "[EMAIL PROTECTED]" rpm -Uvh "$rpmdir/$rpmfile" --force
--nodeps
else
- HOME=${OPENPKG_WORK} $E/bin/rpm -q $package >/dev/null 2>&1 && continue
+ rpm -q $package >/dev/null 2>&1 && continue
echo "++ installing $package ($rpmfile)"
- ssh -t -x "[EMAIL PROTECTED]" HOME=${OPENPKG_WORK} $E/bin/rpm -Uvh
"$rpmdir/$rpmfile"
+ ssh -t -x "[EMAIL PROTECTED]" ${RPMCMD} -Uvh "$rpmdir/$rpmfile"
fi
- HOME=${OPENPKG_WORK} $E/bin/rpm -q $package >/dev/null 2>&1
+ rpm -q $package >/dev/null 2>&1
if [ $? -ne 0 ]; then
warn "failed to install $package"
fi
echo "++ cleaning up sources"
- HOME=${OPENPKG_WORK} $E/bin/rpm --clean --nodeps
${OPENPKG_WORK}/src/${name}/${name}.spec >/dev/null 2>&1 || true
+ rpm --clean --nodeps ${OPENPKG_WORK}/src/${name}/${name}.spec >/dev/null
2>&1 || true
done
}
@@ -1592,17 +1610,17 @@
warn "${OPENPKG_WORK}/src/${name}/${name}.spec not found"
continue
fi
- package=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"%{NAME}-%{VERSION}-%{RELEASE}" \
+ package=`rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}" \
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmfilename}'`
- rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf "${template}" \
+ template=`rpm --eval '%{_rpmfilename}'`
+ rpmfile=`rpm -q --qf "${template}" \
--specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
- rpmdir=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval '%{_rpmdir}'`
+ rpmdir=`rpm --eval '%{_rpmdir}'`
if [ ! -f "$rpmdir/$rpmfile" -o $force -ne 0 ]; then
echo "++ building $package ($rpmfile)"
opt="`echo ${opt} | tr ' ' '\n' | ${EGREP} . | sed -e 's;^;--define
\";' -e 's;=; ;' -e 's;$;\";' | tr '\n' ' '`"
- (cd ${OPENPKG_WORK}/src/${name} && HOME=${OPENPKG_WORK} $E/bin/rpm
--fetch ${name}.spec)
- (cd ${OPENPKG_WORK}/src/${name} && eval "HOME=${OPENPKG_WORK}
$E/bin/rpm -ba ${opt} ${name}.spec")
+ (builtin cd ${OPENPKG_WORK}/src/${name} && rpm --fetch ${name}.spec)
+ (builtin cd ${OPENPKG_WORK}/src/${name} && eval "rpm -ba ${opt}
${name}.spec")
if [ ! -f "$rpmdir/$rpmfile" ]; then
warn "failed to build $package ($rpmfile)"
continue
@@ -1700,7 +1718,8 @@
name=`echo ${name} | sed -e 's;\.spec$;;'`
echo "++ linting $file (package specification)"
- HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm=${E}/bin/rpm $file
+ getrpmcmd $E
+ HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm="${RPMCMD}" $file
if [ $? -gt 0 -a $force -ne 1 ]; then
die "unacceptable specification"
fi
@@ -1722,8 +1741,8 @@
fi
if [ ".$extra" = .1 ]; then
- bin_template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval
'%{_rpmfilename}'`
- bin_rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf
"${bin_template}" --specfile $file`
+ bin_template=`rpm --eval '%{_rpmfilename}'`
+ bin_rpmfile=`rpm -q --qf "${bin_template}" --specfile $file`
bin_rpmdir=`HOME=${OPENPKG_WORK} ${E}/bin/rpm --eval '%{_rpmdir}'`
if [ -f "$bin_rpmdir/$bin_rpmfile" ]; then
echo "++ linting ${bin_rpmdir}/${bin_rpmfile} (binary package)"
@@ -1739,7 +1758,7 @@
testit () {
# FIXME consider test() [shell function] vs. test(1) [builtin] vs. rpm
[non-OpenPKG] --test
- $E/bin/rpm --help | grep -- --test >/dev/null && echo "$E/bin/rpm does not
support --test" # FIXME s/echo/die/
+ rpm --help | grep -- --test >/dev/null && echo "${RPMCMD:-rpm} does not support
--test" # FIXME s/echo/die/
die "testit not yet implemented. Developer: consider testit vs. test(1)"
}
@@ -1749,7 +1768,7 @@
}
track () {
- $E/bin/rpm --help | grep -- --track >/dev/null || die "$E/bin/rpm does not
support --track"
+ rpm --help | grep -- --track >/dev/null || die "${RPMCMD:-rpm} does not support
--track"
if [ ".${packages}" = . ]; then
if [ ".$P" = . ]; then
die "package cannot be identified. Neither parameter given nor \$P set."
@@ -1759,7 +1778,7 @@
all="${packages}"
fi
for name in $all; do
- HOME=${OPENPKG_WORK} $E/bin/rpm --track ${name}.spec
+ rpm --track ${name}.spec
done
}
@@ -1790,9 +1809,6 @@
else
all="${packages}"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
for name in $all; do
echo "$name" | ${EGREP} "^[./]+" >/dev/null 2>&1
@@ -1819,9 +1835,9 @@
/^$/ { if (flag == 1) print " "execute" #"file; flag=0 }
// { print $0 }'
if [ ${dry} -eq 0 ]; then
- HOME=${OPENPKG_WORK} $E/bin/rpm -bp ${tmpfile} --nodeps
+ rpm -bp ${tmpfile} --nodeps
rc=$?
- HOME=${OPENPKG_WORK} $E/bin/rpm --clean ${tmpfile} --nodeps
+ rpm --clean ${tmpfile} --nodeps
else
sed <${tmpfile} -n -e '/^%prep$/,/^$/p'
rc=$?
@@ -1857,9 +1873,6 @@
else
all="${packages}"
fi
- if [ ".$E" = . -o ! -x $E/bin/rpm ]; then
- die "$E/bin/rpm not executable. \$E might not be set properly."
- fi
for name in $all; do
echo "$name" | ${EGREP} "^[./]+" >/dev/null 2>&1
@@ -1881,7 +1894,7 @@
if [ $cleana -ne 0 ]; then
spec=`echo ${file} | sed -e 's;^.*/;;' -e 's;\.spec$;;'`
echo "++ Cleaning out all dst files for $spec"
- for s in `cd ${OPENPKG_WORK}/dst/${spec}/ && echo *`; do
+ for s in `builtin cd ${OPENPKG_WORK}/dst/${spec}/ && echo *`; do
f="${OPENPKG_WORK}/dst/${spec}/${s}"
[ -f "${f}" ] && rm "${f}"
[ -e "${f}" -o -L "${f}" ] && die "Problem wiping out ${f}"
@@ -1890,14 +1903,14 @@
if [ $cleans -ne 0 ]; then
spec=`echo ${file} | sed -e 's;^.*/;;' -e 's;\.spec$;;'`
echo "++ Cleaning out selected dst files for $spec"
- for s in `cd ${OPENPKG_WORK}/src/${spec}/ && echo *`; do
+ for s in `builtin cd ${OPENPKG_WORK}/src/${spec}/ && echo *`; do
f="${OPENPKG_WORK}/dst/${spec}/${s}"
[ -f "${f}" ] && rm "${f}"
[ -e "${f}" -o -L "${f}" ] && die "Problem wiping out ${f}"
done
fi
echo "++ Fetching files for package specification: $file"
- HOME=${OPENPKG_WORK} $E/bin/rpm --fetch ${file}
+ rpm --fetch ${file}
if [ $? -gt 0 -a $force -ne 1 ]; then
die "fetching sources for ${file} failed"
fi
@@ -1944,7 +1957,8 @@
for file in $files; do
TERM=${TERM}-color command vim "${file}"
if [ ".${OPENPKG_MODE}" = .developer -a ".${B}" = .HEAD -o $force -ne 0
]; then
- HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm=${E}/bin/rpm ${file}
+ getrpmcmd $E
+ HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl
--rpm="${RPMCMD}" ${file}
if [ $? -gt 0 ]; then
die "unacceptable specification: ${file}"
fi
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]