OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 26-Jan-2003 11:41:28 Branch: HEAD Handle: 2003012610412700 Modified files: openpkg-re openpkg-dev Log: Add an "openpkg-dev install <pkg> [<pkg> ...]" command which allows me to easily bump up the /cw instance with dependend packages without having to do manually lots of "cd <pkg> && rpm -bb .. && rpm -Uvh .." Summary: Revision Changes Path 1.50 +38 -0 openpkg-re/openpkg-dev ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/openpkg-dev ============================================================================ $ cvs diff -u -r1.49 -r1.50 openpkg-dev --- openpkg-re/openpkg-dev 20 Jan 2003 12:36:56 -0000 1.49 +++ openpkg-re/openpkg-dev 26 Jan 2003 10:41:27 -0000 1.50 @@ -89,6 +89,10 @@ # ------------------------------------------------------------ +warn () { + echo "${prog_name}:WARNING: $1" 1>&2 +} + die () { # exit gracefully echo "${prog_name}:ERROR: $1" 1>&2 @@ -644,6 +648,39 @@ ( cd ${OPENPKG_WORK}/re/vcheck && cvs -d ${OPENPKG_REPO} add vc.${name} ) } +install () { + for name in $*; do + if [ ! -f "${OPENPKG_WORK}/src/${name}/${name}.spec" ]; then + warn "${OPENPKG_WORK}/src/${name}/${name}.spec not found" + continue + fi + package=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}" \ + --specfile ${OPENPKG_WORK}/src/${name}/${name}.spec` + template=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm --eval '%{_rpmfilename}'` + rpmfile=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -q --qf "${template}" \ + --specfile ${OPENPKG_WORK}/src/${name}/${name}.spec` + rpmdir=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm --eval '%{_rpmdir}'` + if [ ! -f "$rpmdir/$rpmfile" ]; then + echo "++ building $package ($rpmfile)" + (cd ${OPENPKG_WORK}/src/${name} && HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -bb ${name}.spec) + if [ ! -f "$rpmdir/$rpmfile" ]; then + warn "failed to build $package ($rpmfile)" + continue + fi + fi + HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -q $package >/dev/null 2>&1 && continue + echo "++ installing $package ($rpmfile)" + if [ ".$HOSTNAME" = . ]; then + HOSTNAME=`hostname` + fi + ssh -t -x "root@${HOSTNAME}" HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -Uvh "$rpmdir/$rpmfile" + HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -q $package >/dev/null 2>&1 + if [ $? -ne 0 ]; then + warn "failed to install $package" + fi + done +} + # ------------------------------------------------------------ if [ $# -eq 0 ]; then @@ -672,6 +709,7 @@ release | r* ) cmd="release" ;; kill | k* ) cmd="kill" ;; new | n* ) cmd="new" ;; + install | i* ) cmd="install" ;; *) die "unknown command \"${cmd}\"" ;; esac ${cmd} "$@" @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]