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:   11-Mar-2003 10:10:25
  Branch: HEAD                             Handle: 2003031109102400

  Modified files:
    openpkg-re              openpkg-dev

  Log:
    introduce execute (on instance closest to branch) command

  Summary:
    Revision    Changes     Path
    1.60        +63 -1      openpkg-re/openpkg-dev
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/openpkg-dev
  ============================================================================
  $ cvs diff -u -r1.59 -r1.60 openpkg-dev
  --- openpkg-re/openpkg-dev    10 Mar 2003 14:36:30 -0000      1.59
  +++ openpkg-re/openpkg-dev    11 Mar 2003 09:10:24 -0000      1.60
  @@ -42,6 +42,7 @@
   
   #   default configuration
   OPENPKG_INST=/cw
  +OPENPKG_WILD=*
   OPENPKG_WORK=${HOME}/work/openpkg
   OPENPKG_TEMP=/tmp/${LOGNAME}/openpkg
   OPENPKG_MODE=contributor                                        # contributor
  @@ -51,7 +52,8 @@
   [EMAIL PROTECTED]:/e/openpkg/cvs        # developer
   #OPENPKG_DIST=master.openpkg.org:/e/openpkg/ftp/current/SRC/    # developer
   OPENPKG_REV=
  -export OPENPKG_INST OPENPKG_WORK OPENPKG_TEMP OPENPKG_MODE OPENPKG_REPO 
OPENPKG_DIST OPENPKG_REV
  +OPENPKG_EXEC=
  +export OPENPKG_INST OPENPKG_WILD OPENPKG_WORK OPENPKG_TEMP OPENPKG_MODE 
OPENPKG_REPO OPENPKG_DIST OPENPKG_REV OPENPKG_EXEC
   
   #   override configuration from ${HOME}/.openpkg-dev*.rc
   progname=`basename $0`
  @@ -76,6 +78,7 @@
           -h|--help    ) help=1              ;;
           -V|--version ) version=1           ;;
           --inst=*     ) OPENPKG_INST=${arg} ;;
  +        --wild=*     ) OPENPKG_WILD=${arg} ;;
           --work=*     ) OPENPKG_WORK=${arg} ;;
           --temp=*     ) OPENPKG_TEMP=${arg} ;;
           --mode=*     ) OPENPKG_MODE=${arg} ;;
  @@ -227,6 +230,7 @@
           \$ openpkg-dev bash ...... enter development environment
           \$ openpkg-dev update .... update development environment from master server
           \$ openpkg-dev branch .... switch to a different branch
  +        \$ openpkg-dev execute ... execute command on instance closest to branch
           \$ openpkg-dev install ... install a package
           \$ openpkg-dev list ...... list source and binary packages
           \$ openpkg-dev diff ...... dry run "release"
  @@ -256,6 +260,40 @@
       echo "FIXME: still using ${OPENPKG_INST}, automatic instance selection not 
implemented, yet"
   }
   
  +execute () {
  +    #   check for "dry" run
  +    if [ .$1 = .-dry ]; then
  +        dry=1
  +        shift
  +    else
  +        dry=0
  +    fi
  +
  +    #   check for "silent" run
  +    if [ .$1 = .-silent ]; then
  +        silent=1
  +        shift
  +    else
  +        silent=0
  +    fi
  +
  +    anybin2branch $1
  +    shift
  +    branch2instance ${BRANCH}
  +
  +    if [ ${dry} -eq 0 ]; then
  +        (
  +        export HOME=${OPENPKG_WORK}
  +        eval `${OPENPKG_EXEC}/etc/rc --eval all env`
  +        [EMAIL PROTECTED]
  +        )
  +    else
  +        if [ ${silent} -eq 0 ]; then
  +            echo "[EMAIL PROTECTED]"
  +        fi
  +    fi
  +}
  +
   #   convert any (branch|instance|name) into branch and set ${BRANCH}
   #
   #   Branch              Instance   Name
  @@ -304,6 +342,28 @@
       fi
   }
   
  +branch2instance () {
  +    INSTANCE=`echo "${BRANCH}" | sed -e 's;^OPENPKG_;;' -e 's;_STABLE$;;' -e 
's;SOLID$;;' -e 's;^HEAD$;;' -e 's;_;;g'`
  +    OPMAJORV=`echo ${INSTANCE} | cut -c 1`
  +    OPMINORV=`echo ${INSTANCE} | cut -c 2`
  +    AVAILINS=`echo ${OPENPKG_INST}${OPENPKG_WILD} | tr ' ' '\n' | sort`
  +    INSTANCE=""
  +    if [ ".${OPMINORV}" != "." ]; then  # SOLID
  +        ADD=`echo "${AVAILINS}" | egrep "^${OPENPKG_INST}${OPMAJORV}${OPMINORV}$"`
  +        INSTANCE="${INSTANCE} ${ADD}"
  +    fi
  +    if [ ".${OPMAJORV}" != "." ]; then  # STABLE
  +        ADD=`echo "${AVAILINS}" | egrep "^${OPENPKG_INST}${OPMAJORV}$"`
  +        INSTANCE="${INSTANCE} ${ADD}"
  +    fi
  +    if [ true ]; then                   # HEAD
  +        ADD=`echo "${AVAILINS}" | egrep "^${OPENPKG_INST}$"`
  +        INSTANCE="${INSTANCE} ${ADD}"
  +    fi
  +    OPENPKG_EXEC="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  +    unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  +}
  +
   bash () {
       cd ${OPENPKG_WORK} || die "cannot cd to ${OPENPKG_WORK}"
   
  @@ -779,6 +839,7 @@
   
   # make sure environment is set up
   [ ".${OPENPKG_INST}" = . ] && die "OPENPKG_INST is not set";
  +[ ".${OPENPKG_WILD}" = . ] && echo "OPENPKG_WILD is not set";
   [ ".${OPENPKG_WORK}" = . ] && die "OPENPKG_WORK is not set";
   [ ".${OPENPKG_REPO}" = . ] && die "OPENPKG_REPO is not set";
   [ ".${OPENPKG_DIST}" = . ] && die "OPENPKG_DIST is not set";
  @@ -789,6 +850,7 @@
       update  | u* ) cmd="update"  ;;
       branch  | br* ) cmd="branch"  ;;
       bash    | b* ) cmd="bash"    ;;
  +    execute | e* ) cmd="execute" ;;
       list    | l* ) cmd="list"    ;;
       diff    | d* ) cmd="diff"    ;;
       release | r* ) cmd="release" ;;
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to