OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-tools Date: 12-Aug-2005 11:56:33
Branch: HEAD Handle: 2005081210563200
Modified files:
openpkg-tools/cmd dev.sh
Log:
add a convenient "openpkg dev" like option interface for running
various "rpm -b*" build instructions
Summary:
Revision Changes Path
1.57 +104 -2 openpkg-tools/cmd/dev.sh
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/dev.sh
============================================================================
$ cvs diff -u -r1.56 -r1.57 dev.sh
--- openpkg-tools/cmd/dev.sh 12 Aug 2005 06:45:29 -0000 1.56
+++ openpkg-tools/cmd/dev.sh 12 Aug 2005 09:56:32 -0000 1.57
@@ -2152,6 +2152,98 @@
done
}
+rpmbuildconvenience () {
+
+ rpmbuild="$1"; shift
+
+ force=0
+ shortcircuit=""
+ packages=""
+ defall=""
+ defpkg=""
+ while [ ".$1" != . ]; do
+ case ".$1" in
+ .-D ) shift
+ opt="$1"
+ pkg=""; echo "${opt}" | ${EGREP} '::' >/dev/null 2>&1 &&
pkg="`echo ${opt} | sed -e 's;::.*$;;'`"
+ opt="`echo ${opt} | sed -e 's;^.*::;;'`"
+ echo "${opt}" | ${EGREP} '^with_' >/dev/null 2>&1 ||
opt="with_${opt}"
+ echo "${opt}" | ${EGREP} '=' >/dev/null 2>&1 ||
opt="${opt}=yes"
+ if [ ".${pkg}" = . ]; then
+ defall="${defall} ${opt}"
+ else
+ defpkg="${defpkg} ${pkg}::${opt}"
+ fi
+ ;;
+ .-f ) force=1 ;;
+ .-s ) shortcircuit="--short-circuit" ;;
+ .-* ) die "unsupported option \"$1\"." ;;
+ * ) packages="${packages} $1"
+ esac
+ shift
+ done
+
+ if [ ".${packages}" = . ]; then
+ if [ ".$P" = . ]; then
+ die "package cannot be identified. Neither parameter given nor
\$P set."
+ fi
+ all="$P"
+ else
+ all="${packages}"
+ fi
+ for name in $all; do
+ opt="`echo ${defpkg} | tr ' ' '\n' | ${EGREP} ^$name:: | sed
's;^.*::;;' | tr '\n' ' '`"
+ opt="`echo ${opt} $defall`"
+ echo "++ processing ${name} ${opt}"
+ if [ ! -f "${OPENPKG_WORK}/$S/${name}/${name}.spec" ]; then
+ warn "${OPENPKG_WORK}/$S/${name}/${name}.spec not found"
+ continue
+ fi
+
+ logfile="${OPENPKG_WORK}/$S/${name}/[EMAIL PROTECTED]"
+ if [ -f "$logfile" ]; then
+ trim="TRUNC"
+ if [ ".$shortcircuit" != . ]; then
+ case ".$rpmbuild" in
+ .-bc ) trim="build" ;;
+ .-bi ) trim="install" ;;
+ .-bb ) trim="KEEP" ;;
+ .-bs ) trim="KEEP" ;;
+ esac
+ fi
+ if [ ".$trim" = .TRUNC ]; then
+ >$logfile
+ elif [ ".$trim" != .KEEP ]; then
+ sed -e "/^Executing(%${trim})/,\$d" <$logfile >$logfile.n &&
mv $logfile.n $logfile
+ fi
+ fi
+
+ opt="`echo ${opt} | tr ' ' '\n' | ${EGREP} . | sed -e 's;^;--define
\";' -e 's;=; ;' -e 's;$;\";' | tr '\n' ' '`"
+ (builtin cd ${OPENPKG_WORK}/$S/${name} && eval "rpmE ${rpmbuild}
${shortcircuit} ${opt} ${name}.spec" 2>&1 | tee -a [EMAIL PROTECTED])
+ done
+}
+
+bbinary () {
+ rpmbuildconvenience -bb "$@"
+}
+
+bcompile () {
+ rpmbuildconvenience -bc "$@"
+}
+
+binstall () {
+ rpmbuildconvenience -bi "$@"
+}
+
+bprep () {
+ rpmbuildconvenience -bp "$@"
+}
+
+bsource () {
+ rpmbuildconvenience -bs "$@"
+}
+
+
logview () {
packages=""
while [ ".$1" != . ]; do
@@ -2563,12 +2655,17 @@
cmds and parameters
--------------------------------------------------------------------------------------------------------
\$ openpkg dev bash # [[[spec]ctag]exec] enter
development environment
- \$ openpkg dev build # [[spec]...] [-f] [-D with...] build a
package (forcibly) (with option)
+ \$ openpkg dev bbinary # [[spec]...] [-f][-s][-D with...] rpmE -bb
[--short-circuit] spec (force, opt)
+ \$ openpkg dev bcompile# [[spec]...] [-f][-s][-D with...] rpmE -bc
[--short-circuit] spec (force, opt)
+ \$ openpkg dev binstall# [[spec]...] [-f][-s][-D with...] rpmE -bi
[--short-circuit] spec (force, opt)
+ \$ openpkg dev bprep # [[spec]...] [-f] [-D with...] rpmE -bp
spec (force, opt)
\$ openpkg dev branch # [ctag] switch to
a different branch
+ \$ openpkg dev bsource # [[spec]...] [-f][-s][-D with...] rpmE -bs
[--short-circuit] spec (force, opt)
+ \$ openpkg dev build # [[spec]...] [-f][-f][-D with...] build a
package (force, option)
\$ openpkg dev clean # clean the
temporary area
\$ openpkg dev diff # alias for
"release -dry"
\$ openpkg dev execute # [exec] execute
command on instance closest to branch
- \$ openpkg dev fetch # [[spec]...] [-s] [-a] fetch
sources; clean selected or all dst files
+ \$ openpkg dev fetch # [[spec]...] [-s][-a] fetch
sources; clean selected or all dst files
\$ openpkg dev help # display
this command summary and update 00README
\$ openpkg dev install # [[spec]...] [-f] install a
package (forcibly), build if required
\$ openpkg dev kill # kill the
environment
@@ -2632,7 +2729,12 @@
# handle command
case ${cmd} in
bash | ba* ) cmd="bash" ;;
+ bbinary | bb* ) cmd="bbinary" ;;
+ bcompile| bc* ) cmd="bcompile";;
+ binstall| bi* ) cmd="binstall";;
+ bprep | bp* ) cmd="bprep" ;;
branch | br* ) cmd="branch" ;;
+ bsource | bs* ) cmd="bsource" ;;
build | bu* ) cmd="build" ;;
clean | cl* ) cmd="clean" ;;
diff | di* ) cmd="diff" ;;
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]