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:   12-Mar-2003 16:12:25
  Branch: HEAD                             Handle: 2003031215122400

  Modified files:
    openpkg-re              openpkg-dev pmod-psod.txt

  Log:
    getting air after a deep dive

  Summary:
    Revision    Changes     Path
    1.62        +336 -94    openpkg-re/openpkg-dev
    1.34        +30 -6      openpkg-re/pmod-psod.txt
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/openpkg-dev
  ============================================================================
  $ cvs diff -u -r1.61 -r1.62 openpkg-dev
  --- openpkg-re/openpkg-dev    11 Mar 2003 09:12:35 -0000      1.61
  +++ openpkg-re/openpkg-dev    12 Mar 2003 15:12:24 -0000      1.62
  @@ -34,11 +34,13 @@
   # - create a "reinstall" option which includes -bs, -bb, -Uvh on demand
   # - allow skipping of repository modules, i.e. no -doc
   # - copy proprietary packages to private area based on license description
  +# - should we eval the environment and, if yes, at which time
  +# - environment/script interaction may need performance improvements
   
   #   program version
   prog_name="openpkg-dev"
  -prog_vers="0.9.1"
  -prog_date="30-Dec-2002"
  +prog_vers="0.9.2"
  +prog_date="12-Mar-2003"
   
   #   default configuration
   OPENPKG_INST=/cw
  @@ -51,9 +53,13 @@
   #OPENPKG_MODE=developer                                         # developer
   [EMAIL PROTECTED]:/e/openpkg/cvs        # developer
   #OPENPKG_DIST=master.openpkg.org:/e/openpkg/ftp/current/SRC/    # developer
  -OPENPKG_REV=
  -OPENPKG_EXEC=
  -export OPENPKG_INST OPENPKG_WILD 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
  +
  +#   enforced and user controlled (through package/branch/execute) variables
  +OPENPKG_SPEC="${OPENPKG_SPEC}"; P="${P}" # P (package, spec file without .spec 
suffix)
  +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
   
   #   override configuration from ${HOME}/.openpkg-dev*.rc
   progname=`basename $0`
  @@ -84,6 +90,9 @@
           --mode=*     ) OPENPKG_MODE=${arg} ;;
           --repo=*     ) OPENPKG_REPO=${arg} ;;
           --dist=*     ) OPENPKG_DIST=${arg} ;;
  +        --spec=*     ) OPENPKG_SPEC=${arg} ;;
  +        --ctag=*     ) OPENPKG_CTAG=${arg} ;;
  +        --exec=*     ) OPENPKG_EXEC=${arg} ;;
           -*           ) help="Invalid option \`${opt}'"; break ;;
           *            ) break              ;;
       esac
  @@ -217,7 +226,7 @@
         HOME=${OPENPKG_WORK}
         export HOME
         cvs -q -d ${OPENPKG_REPO} checkout openpkg-dev-web openpkg-dev-doc 
openpkg-dev-re openpkg-dev-adm
  -      cvs -q -d ${OPENPKG_REPO} checkout ${OPENPKG_REV} openpkg-dev-src
  +      cvs -q -d ${OPENPKG_REPO} checkout -r ${OPENPKG_CTAG:-HEAD} openpkg-dev-src
         # mv openpkg-dev/* .
         # rmdir openpkg-dev
       )
  @@ -228,6 +237,7 @@
   
           \$ openpkg-dev setup ..... already been done ;)
           \$ openpkg-dev bash ...... enter development environment
  +        \$ openpkg-dev package ... switch to a different package
           \$ 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
  @@ -250,51 +260,145 @@
       )
   }
   
  +package () {
  +    #   no parameter means guessing
  +    if [ ".$1" = . ]; then
  +        P=`echo ${PWD} | sed -e "s;^${OPENPKG_WORK}/src/;;" -e 's;/.*$;;'`
  +        echo "${P}"
  +        return
  +    fi
  +
  +    #   setup query, if any query=""
  +    if [ ".$1" = .-query ]; then
  +        shift
  +        query="echo \$${1}"
  +        shift
  +    fi
  +
  +    #   setup variables for use or query
  +    package="$1"
  +    sourcedir="${OPENPKG_WORK}/src"
  +    workdir="${sourcedir}/${package}"
  +
  +    #   execute query, if any
  +    if [ ".${query}" != . ]; then
  +        eval "${query}"
  +        return
  +    fi
  +
  +    #   switch to given package
  +    if [ ! -d "${sourcedir}" ]; then
  +        die "no ${sourcedir} directory found"
  +    fi
  +    if [ -d "${workdir}" ]; then
  +        echo "++ using existing directory ${workdir}"
  +    else
  +        echo "++ creating new directory ${workdir}"
  +        mkdir "${workdir}"
  +    fi
  +}
  +
   branch () {
  -    anybin2branch $1
  -    echo "++ branching to ${BRANCH}"
  +    #   no parameter means guessing
  +    if [ ".$1" = . ]; then
  +        CVSTAGFILES=""
  +        if [ -r CVS/Entries ]; then
  +            CVSTAGFILES="${CVSTAGFILES} CVS/Entries"
  +        fi
  +        if [ -r CVS/Tag ]; then
  +            CVSTAGFILES="${CVSTAGFILES} CVS/Tag"
  +        fi
  +        if [ ".${CVSTAGFILES}" = . ]; then
  +            B=""
  +        else
  +            B=`cat ${CVSTAGFILES} | sed -e 's;//$;//THEAD;' -n -e 's;^.*//T;;p' | 
sort | uniq | tr '\n' ':' | sed -e 's;:$;;'`
  +        fi
  +        unset CVSTAGFILES
  +        echo "${B}"
  +        return
  +    fi
  +
  +    #   setup query, if any
  +    query=""
  +    if [ ".$1" = .-query ]; then
  +        shift
  +        query="echo \$${1}"
  +        shift
  +    fi
  +
  +    #   setup variables for use or query
  +    anybin2branch "${1}"
  +    branch="${B}"
  +
  +    #   execute query, if any
  +    if [ ".${query}" != . ]; then
  +        eval "${query}"
  +        return
  +    fi
  +
  +    #   switch to given branch
  +    echo "++ updating to branch ${branch}"
       ( HOME=${OPENPKG_WORK}
         export HOME
  -      cvs update -r ${BRANCH}
  +      cvs update -r ${branch}
       )
  -    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
  +    #   no parameter means guessing
  +    if [ ".$1" = . ]; then
  +        #B=`command ${OPENPKG_WORK}/re/openpkg-dev branch -query branch "$1"`
  +        branch2instance
  +        echo "${E}"
  +        return
       fi
   
  -    #   check for "silent" run
  -    if [ .$1 = .-silent ]; then
  -        silent=1
  +    #   setup query, if any query=""
  +    if [ ".$1" = .-query ]; then
  +        shift
  +        query="echo \$${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]
  -        )
  +    #   setup variables for use or query
  +    if [ ".$1" = . ]; then
  +        #   no parameter enters clear mode
  +        execute=""
  +        command=""
  +        mode="clear"
       else
  -        if [ ${silent} -eq 0 ]; then
  -            echo "[EMAIL PROTECTED]"
  -        fi
  +        echo "$1" | egrep -q "^/"
  +        if [ $? -eq 0 ]; then
  +            #   leading slash enters setup mode
  +            execute="${1}"
  +            command=""
  +            mode="setup"
  +        else
  +            #   no leading slash enters execute mode
  +            execute="${OPENPKG_EXEC}"
  +            command="${E}/[EMAIL PROTECTED]"
  +            mode="execute"
  +        fi
  +    fi
  +    
  +    #   execute query, if any
  +    if [ ".${query}" != . ]; then
  +        eval "${query}"
  +        return
  +    fi
  +
  +    #   execute given command
  +    if [ ".${mode}" = ".execute" ]; then
  +        ( HOME=${OPENPKG_WORK}
  +          export HOME
  +          #FIXME eval `${E}/etc/rc --eval all env`
  +          echo ${command}
  +          ${command}
  +        )
       fi
   }
   
  -#   convert any (branch|instance|name) into branch and set ${BRANCH}
  +#   convert any (branch|instance|name) into branch and set ${B}
   #
   #   Branch              Instance   Name
   #   ------------------- ---------- --------
  @@ -306,35 +410,38 @@
   #
   anybin2branch () {
       #   remove surrounding whitespaces, take first arg only, toupper
  -    BRANCH=`echo $1 | cut -f 1 -d" " | tr '[a-z]' '[A-Z]'`
  +    B=`echo $1 | cut -f 1 -d" " | tr '[a-z]' '[A-Z]'`
   
       #   strip off any abbreviated form of a leading OPENPKG_
  -    BRANCH=`echo "${BRANCH}" | sed -e 
's;^O\{0,1\}P\{0,1\}E\{0,1\}N\{0,1\}P\{0,1\}K\{0,1\}G\{0,1\}_\{0,1\};;'`
  +    B=`echo "${B}" | sed -e 
's;^O\{0,1\}P\{0,1\}E\{0,1\}N\{0,1\}P\{0,1\}K\{0,1\}G\{0,1\}_\{0,1\};;'`
   
       #   transform instance into branch
  -    BRANCH=`echo "${BRANCH}" | sed -e 's;^/[A-Z]\{1,\}$;HEAD;' -e 
's;^/[A-Z]\{1,\}\([1-9]\);\1_;'`
  +    B=`echo "${B}" | sed -e 's;^/[A-Z]\{1,\}$;HEAD;' -e 
's;^/[A-Z]\{1,\}\([1-9]\);\1_;'`
   
       #   replace dots from (SOLID name) and dashes (STABLE name) with underscore for 
convenience
  -    BRANCH=`echo "${BRANCH}" | sed -e 's;[\.-];_;g'`
  +    B=`echo "${B}" | sed -e 's;[\.-];_;g'`
  +
  +    #   emptiness means invalid branch
  +    if [ ".${B}" = . ]; then
  +        return
  +    fi
   
       #   check for HEAD (branch) aka CURRENT (name)
  -    echo "CURRENT" | egrep -q "^${BRANCH}" && BRANCH="HEAD"
  -    echo "HEAD"    | egrep -q "^${BRANCH}" && BRANCH="HEAD"
  +    echo "CURRENT" | egrep -q "^${B}" && B="HEAD"
  +    echo "HEAD"    | egrep -q "^${B}" && B="HEAD"
   
  -    if [ .${BRANCH} != ".HEAD" ]; then
  +    if [ .${B} != ".HEAD" ]; then
   
           #   extract branchpoint (1, 1_1 ...) and optional direction
  -        BRANBP=`echo "${BRANCH}" | sed -e 
's;^\([1-9][0-9]*\(_\{0,1\}[0-9]*\)\)\(.*\)$;\1;' -e 's;_*$;;'`
  -        BRANDR=`echo "${BRANCH}" | sed -e 
's;^\([1-9][0-9]*\(_\{0,1\}[0-9]*\)\)\(.*\)$;\3;' -e 's;^_*;;'`
  +        BRANBP=`echo "${B}" | sed -e 
's;^\([1-9][0-9]*\(_\{0,1\}[0-9]*\)\)\(.*\)$;\1;' -e 's;_*$;;'`
  +        BRANDR=`echo "${B}" | sed -e 
's;^\([1-9][0-9]*\(_\{0,1\}[0-9]*\)\)\(.*\)$;\3;' -e 's;^_*;;'`
   
           #   select direction, check optional direction
           echo ${BRANBP} | grep -q '_'
           if [ $? = 0 ]; then
  -            BRANCH="OPENPKG_${BRANBP}_SOLID"
  -            echo "SOLID"  | egrep -q "^${BRANDR}" || die "automatic (SOLID) vs. 
manual (${BRANDR}) direction mismatch"
  +            B="OPENPKG_${BRANBP}_SOLID"
           else
  -            BRANCH="OPENPKG_${BRANBP}_STABLE"
  -            echo "STABLE" | egrep -q "^${BRANDR}" || die "automatic (STABLE) vs. 
manual (${BRANDR}) direction mismatch"
  +            B="OPENPKG_${BRANBP}_STABLE"
           fi
   
           unset BRANBP
  @@ -343,7 +450,7 @@
   }
   
   branch2instance () {
  -    INSTANCE=`echo "${BRANCH}" | sed -e 's;^OPENPKG_;;' -e 's;_STABLE$;;' -e 
's;SOLID$;;' -e 's;^HEAD$;;' -e 's;_;;g'`
  +    INSTANCE=`echo "${B}" | 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`
  @@ -360,13 +467,24 @@
           ADD=`echo "${AVAILINS}" | egrep "^${OPENPKG_INST}$"`
           INSTANCE="${INSTANCE} ${ADD}"
       fi
  -    OPENPKG_EXEC="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  +    E="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
       unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
   }
   
   bash () {
       cd ${OPENPKG_WORK} || die "cannot cd to ${OPENPKG_WORK}"
   
  +    #   honor optional parameters [[[spec]ctag]exec]
  +    if [ ".$1" != . ]; then
  +        OPENPKG_SPEC="$1"
  +    fi
  +    if [ ".$2" != . ]; then
  +        OPENPKG_CTAG="$2"
  +    fi
  +    if [ ".$3" != . ]; then
  +        OPENPKG_EXEC="$3"
  +    fi
  +
       #   create a .bashrc
       cat <<-EOF >.bashrc
   
  @@ -394,39 +512,165 @@
   
       #   prompt to indicate openpkg-dev bash environment
       cd () {
  -        builtin cd \${1-\${OPENPKG_WORK}}
  -        CD_FUNC_PACKET=\${P:[EMAIL PROTECTED]
  -        CD_FUNC_TAGSRC=''
  -        if [ -r CVS/Entries ]; then
  -            CD_FUNC_TAGSRC="\$CD_FUNC_TAGSRC CVS/Entries"
  +        if [ ".\$1" = . ]; then
  +            if [ ".\${OPENPKG_SPEC}" = . ]; then
  +                workdir="\${OPENPKG_WORK}"
  +            else
  +                workdir="\`command \${OPENPKG_WORK}/re/openpkg-dev package -query 
workdir \${OPENPKG_SPEC}\`"
  +            fi
  +        else
  +            workdir="\$1"
           fi
  -        if [ -r CVS/Tag ]; then
  -            CD_FUNC_TAGSRC="\$CD_FUNC_TAGSRC CVS/Tag"
  +        builtin cd \${workdir}
  +
  +        P=\`command \${OPENPKG_WORK}/re/openpkg-dev package\`
  +        # P holds detection
  +        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}"
  +            fi
  +        else
  +            if [ ".\${P}" = . ]; then
  +                # forced, nothing detected; take forced; print forced black (aka 
trailing dot)
  +                P="\${OPENPKG_SPEC}"
  +                CD_FUNC_PX="P=\${P}"
  +                CD_FUNC_PD="P=\${P}."
  +            else
  +                if [ ".\${OPENPKG_SPEC}" = ".\${P}" ]; then
  +                    # forced; detected and matched; keep; print black (aka trailing 
dot)
  +                    CD_FUNC_PX="P=\${P}"
  +                    CD_FUNC_PD="P=\${P}."
  +                else
  +                    # forced; detected and mismatch; print forced black ! detected 
normal (aka forced exclamation mark detected)
  +                    CD_FUNC_PX="P=\${OPENPKG_SPEC}!\${P}"
  +                    CD_FUNC_PD="P=\${OPENPKG_SPEC}.\${P}!"
  +                    P="\${OPENPKG_SPEC}"
  +                fi
  +            fi
           fi
  -        if [ ".\$CD_FUNC_TAGSRC" = "." ]; then
  -            CD_FUNC_CVSTAG="no CVS"
  +        # P has ultimate content
  +
  +        B=\`command \${OPENPKG_WORK}/re/openpkg-dev branch\`
  +        # B holds detection
  +        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}"
  +            fi
           else
  -            CD_FUNC_CVSTAG=\`cat \$CD_FUNC_TAGSRC | sed -e 's;^\(/.*//\)$;\1THEAD;' 
-n -e 's;^/.*//T;;p' | sort | uniq | tr '\n' '|' | sed -e 's;|$;;'\`
  -            CD_FUNC_CVSTAG=\${CD_FUNC_CVSTAG:-HEAD}
  +            if [ ".\${B}" = . ]; then
  +                # forced, nothing detected; take forced; print forced black (aka 
trailing dot)
  +                B="\${OPENPKG_CTAG}"
  +                CD_FUNC_BX="B=\${B}"
  +                CD_FUNC_BD="B=\${B}."
  +            else
  +                if [ ".\${OPENPKG_CTAG}" = ".\${B}" ]; then
  +                    # forced; detected and matched; keep; print black (aka trailing 
dot)
  +                    CD_FUNC_BX="B=\${B}"
  +                    CD_FUNC_BD="B=\${B}."
  +                else
  +                    # forced; detected and mismatch; print forced black ! detected 
normal (aka forced exclamation mark detected)
  +                    CD_FUNC_BX="B=\${OPENPKG_CTAG}!\${B}"
  +                    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 holds detection
  +        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}"
  +            fi
  +        else
  +            if [ ".\${E}" = . ]; then
  +                # forced, nothing detected; take forced; print forced black (aka 
trailing dot)
  +                E="\${OPENPKG_EXEC}"
  +                CD_FUNC_EX="E=\${E}"
  +                CD_FUNC_ED="E=\${E}."
  +            else
  +                if [ ".\${OPENPKG_EXEC}" = ".\${E}" ]; then
  +                    # forced; detected and matched; keep; print black (aka trailing 
dot)
  +                    CD_FUNC_EX="E=\${E}"
  +                    CD_FUNC_ED="E=\${E}."
  +                else
  +                    # forced; detected and mismatch; print forced black ! detected 
normal (aka forced exclamation mark detected)
  +                    CD_FUNC_EX="E=\${OPENPKG_EXEC}!\${E}"
  +                    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}"
  +        fi
  +        if [ ".\$CD_FUNC_BX" != . ]; then
  +            CD_FUNC_IX="\${CD_FUNC_IX}\${CD_FUNC_IX:+ }\${CD_FUNC_BX}"
           fi
  -        PS1="[EMAIL PROTECTED]:\${PWD} 
[\$CD_FUNC_PACKET\${CD_FUNC_CVSTAG}]\\nopenpkg-dev\$ "
  +        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}]"
  +        fi
  +
  +        CD_FUNC_ID=""
  +        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}"
  +        fi
  +        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}]"
  +        fi
  +
           if [ ".\${TERM}" = .xterm ]; then
  -            echo -n "]0;[EMAIL PROTECTED]:\${PWD}"
  +            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\$ "
           fi
  -        unset CD_FUNC_PACKET CD_FUNC_TAGSRC CD_FUNC_CVSTAG
  +
  +        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 | p*  ) 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+"\$@"}
  -        if [ ".\$1" = ".branch" ]; then
  -            cd \$PWD
  -        fi
  +        case \$1 in
  +            package | p*  ) if [ ".\$2" = . ]; then cd .; else cd 
\${OPENPKG_WORK}/src/\${P}; fi ;;
  +            branch  | br* ) cd . ;;
  +            execute | e*  ) cd . ;;
  +        esac
       }
   
  -    #   prepare for a indivdual package
  -    P="$1"
  -    cd \${INITIAL_CWD}
  -
       #   override cvs and rpm commands to use local config files
       unalias cvs >/dev/null 2>&1
       if [ ".`which cvs-diff-colorize`" != . ]; then
  @@ -445,6 +689,7 @@
               HOME=\${OPENPKG_WORK} command cvs \${1+"\$@"}
           fi
       }
  +
       unalias rpm >/dev/null 2>&1
       rpm () {
           HOME=\${OPENPKG_WORK} command \${OPENPKG_INST}/bin/rpm "\$@"
  @@ -453,6 +698,15 @@
       #   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
  +    fi
  +    cd .
  +
       #   self destruction
       rm \${OPENPKG_WORK}/.bashrc
   EOF
  @@ -471,19 +725,6 @@
           die "no \"bash\" found in OpenPKG instance"
       fi
   
  -    #   determine initial working directory
  -    INITIAL_CWD=${OPENPKG_WORK}
  -    if [ ".$1" != . ]; then
  -        if [ -d ${INITIAL_CWD}/src/$1 ]; then
  -            INITIAL_CWD="${INITIAL_CWD}/src/$1"
  -        fi
  -    else
  -        if [ -d ${INITIAL_CWD}/src ]; then
  -            INITIAL_CWD=${INITIAL_CWD}/src
  -        fi
  -    fi
  -    export INITIAL_CWD
  -
       #   enter environment
       echo "++ entering OpenPKG shell environment"
       ${bash} --rcfile .bashrc
  @@ -846,17 +1087,18 @@
   
   # handle command
   case ${cmd} in
  -    setup   | s* ) cmd="setup"   ;;
  -    update  | u* ) cmd="update"  ;;
  +    setup   | s*  ) cmd="setup"   ;;
  +    bash    | ba* ) cmd="bash"    ;;
  +    update  | u*  ) cmd="update"  ;;
  +    package | p*  ) cmd="package" ;;
       branch  | br* ) cmd="branch"  ;;
  -    bash    | b* ) cmd="bash"    ;;
  -    execute | e* ) cmd="execute" ;;
  -    list    | l* ) cmd="list"    ;;
  -    diff    | d* ) cmd="diff"    ;;
  -    release | r* ) cmd="release" ;;
  -    kill    | k* ) cmd="kill"    ;;
  -    new     | n* ) cmd="new"     ;;
  -    install | i* ) cmd="install" ;;
  +    execute | e*  ) cmd="execute" ;;
  +    list    | l*  ) cmd="list"    ;;
  +    diff    | d*  ) cmd="diff"    ;;
  +    release | r*  ) cmd="release" ;;
  +    kill    | k*  ) cmd="kill"    ;;
  +    new     | n*  ) cmd="new"     ;;
  +    install | i*  ) cmd="install" ;;
       *) die "unknown command \"${cmd}\"" ;;
   esac
   ${cmd} "$@"
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-re/pmod-psod.txt
  ============================================================================
  $ cvs diff -u -r1.33 -r1.34 pmod-psod.txt
  --- openpkg-re/pmod-psod.txt  3 Mar 2003 10:16:47 -0000       1.33
  +++ openpkg-re/pmod-psod.txt  12 Mar 2003 15:12:24 -0000      1.34
  @@ -91,11 +91,37 @@
   
       $ ./openpkg-dev bash
   
  -  Alternatively append the name of the package. This immediately sets
  -  the current working to ${OPENPKG_WORK}/src/<package> and also sets the
  -  $P environment variable for later reference.
  +  Alternatively append the name of the package, the branch to work on
  +  and instance to execute rpm from.
   
  -    $ ./openpkg-dev bash <package>
  +    $ ./openpkg-dev bash [<package> [<branch> [<execute>]]
  +
  +  Providing all options is equal to
  +
  +    $ ./openpkg-dev bash
  +    # internal variables exposed to user shell - enforcement, current
  +    openpkg-dev$ openpkg-dev package <package> # ${OPENPKG_SPEC},  $P
  +    openpkg-dev$ openpkg-dev branch <branch>   # ${OPENPKG_CTAG},  $B
  +    openpkg-dev$ openpkg-dev execute <execute> # ${OPENPKG_EXEC},  $E
  +
  +  The prompt shows the current values of $P, $B, $E and additional
  +  information. A black value [1] indicates it was forced through "bash"
  +  "package", "branch" or "execute". Values which were not forced are set
  +  by automatic guessing. Even when values are forced, guessing takes
  +  place to detect odd situations. Differences between forced values and
  +  manual guessing are shown in red [2] However, forced settings take
  +  precedence. Executing the "package", "branch" or "execute" commands
  +  without parameter clears the enforment and reverts back to guessing.
  +  The variables listed above are exported can be used by the user in own
  +  scripts or directly on the command line. Guessing takes place with
  +  every "cd" command. If external changes have been made to the
  +  environment, a "cd ." will clear things.
  +
  +  [1] xterm uses black, dumb terminals and xterm window title show a dot
  +      '.' after the value.
  +  
  +  [2] xterm uses red, dumb terminals and xterm window title show a
  +      exclamation mark '!' after the value.
   
   - update the development environment any time by executing the "update"
     function. This will update the workspace. This needs to be done often,
  @@ -108,8 +134,6 @@
     few useful commands are listed as an example for a typical package
     update.
   
  -    openpkg-dev$ cd                      #leads to ${OPENPKG_WORK}
  -    openpkd-dev$ cd src/$P
       openpkg-dev$ vi $P.spec
       openpkg-dev$ for i in `echo *`; do f="${OPENPKG_WORK}/dst/$P/$i"; if [ -f $f ]; 
then rm $f; fi; done #OPTION1
       openpkg-dev$ rm ${OPENPKG_WORK}/dst/$P/*                                        
                     #OPTION2
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to