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:   16-Jan-2004 14:20:57
  Branch: HEAD                             Handle: 2004011613205600

  Modified files:
    openpkg-re              openpkg-dev todo.txt

  Log:
    add support for /openpkg, remove branch to foldername guessing magic,
    allow list of instances in OPENPKG_INST

  Summary:
    Revision    Changes     Path
    1.149       +77 -86     openpkg-re/openpkg-dev
    1.155       +0  -1      openpkg-re/todo.txt
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/openpkg-dev
  ============================================================================
  $ cvs diff -u -r1.148 -r1.149 openpkg-dev
  --- openpkg-re/openpkg-dev    8 Jan 2004 12:54:12 -0000       1.148
  +++ openpkg-re/openpkg-dev    16 Jan 2004 13:20:56 -0000      1.149
  @@ -37,8 +37,7 @@
   prog_date="14-Jul-2003"
   
   #   default configuration
  -OPENPKG_INST=/cw
  -OPENPKG_WILD="*"
  +OPENPKG_INST="/openpkg-dev /openpkg-20 /openpkg-13 /cw13 /cw12 /cw11 /cw10"
   OPENPKG_WORK=${HOME}/work/openpkg
   OPENPKG_TEMP=/tmp/${LOGNAME}/openpkg
   OPENPKG_MODE=contributor                                        # contributor
  @@ -47,7 +46,7 @@
   #OPENPKG_MODE=developer                                         # developer
   [EMAIL PROTECTED]:/e/openpkg/cvs        # developer
   #OPENPKG_DIST=master.openpkg.org:/e/openpkg/ftp/                # developer
  -export OPENPKG_INST OPENPKG_WILD OPENPKG_WORK OPENPKG_TEMP OPENPKG_MODE 
OPENPKG_REPO OPENPKG_DIST
  +export OPENPKG_INST 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)
  @@ -92,7 +91,6 @@
           -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} ;;
  @@ -527,78 +525,57 @@
   #   $1 = requested branch
   #   $2 = optional mode one of "exact", "best", "any"; if omitted, defaults to "any"
   #        exact = find executable rpm exactly matching branch
  -#        best  = see "exact" with fallback SOLID->STABLE->HEAD (no fallback if HEAD 
itself was requested)
  -#        any   = see "best" with fallback to any other out-of-branch rpm (no 
fallback if HEAD itself was requested)
  +#        any   = take first executable rpm
   matchinstance () {
       mode="${2:-any}"
  -    [ ".$mode" != .exact -a ".$mode" != .best -a ".$mode" != .any ] && die 
"matchinstance() assertion"
  +    [ ".$mode" != .exact -a ".$mode" != .any ] && die "matchinstance() assertion"
   
  -    INSTANCE=`echo "$1" | 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`
  -
  -    #   find all available instances with executable rpm
  -    AVAILINS=""
  -    for INSTANCE in `echo ${OPENPKG_INST}${OPENPKG_WILD}`; do
  -        [ -x "${INSTANCE}/bin/rpm" ] && AVAILINS="${AVAILINS} ${INSTANCE}"
  -    done
  -    AVAILINS=`echo ${AVAILINS} | tr ' ' '\n' | sort`
  -
  -    INSTANCE=""
  -    if [ ".$1" = .HEAD ]; then         # HEAD (explicitly requested)
  -        if [ ".$mode" = .exact ]; then
  -            ADD=`echo "${AVAILINS}"      | egrep    "^${OPENPKG_INST}$"`
  -            AVAILINS=`echo "${AVAILINS}" | egrep -v "^${OPENPKG_INST}$"`
  -            INSTANCE="${INSTANCE} ${ADD}"
  -            RV="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  -            unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  +    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="`echo ${AVAILINS} | tr ' ' '\n' | head -n 1`"
  -            unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  +            RV=""
  +            unset INSTANCE
               return
           fi
       fi
  -    if [ ".${OPMINORV}" != . ]; then  # SOLID (explicitly requested)
  -        ADD=`echo "${AVAILINS}"      | egrep    
"^${OPENPKG_INST}${OPMAJORV}${OPMINORV}$"`
  -        AVAILINS=`echo "${AVAILINS}" | egrep -v 
"^${OPENPKG_INST}${OPMAJORV}${OPMINORV}$"`
  -        INSTANCE="${INSTANCE} ${ADD}"
  -        if [ ".$mode" = .exact ]; then
  -            RV="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  -            unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  -            return
  -        fi
  -    fi
  -    if [ ".${OPMAJORV}" != . ]; then  # STABLE (explicitly requested or implicit 
fallback from SOLID)
  -        ADD=`echo "${AVAILINS}"      | egrep    "^${OPENPKG_INST}${OPMAJORV}$"`
  -        AVAILINS=`echo "${AVAILINS}" | egrep -v "^${OPENPKG_INST}${OPMAJORV}$"`
  -        INSTANCE="${INSTANCE} ${ADD}"
  -        if [ ".$mode" = .exact ]; then
  -            RV="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  -            unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  -            return
  -        fi
  -    fi
  -    if [ true ]; then                 # HEAD (implicit fallback from STABLE)
  -        ADD=`echo "${AVAILINS}"      | egrep    "^${OPENPKG_INST}$"`
  -        AVAILINS=`echo "${AVAILINS}" | egrep -v "^${OPENPKG_INST}$"`
  -        INSTANCE="${INSTANCE} ${ADD}"
  -    fi
  -
  -    if [ ".$mode" = .best ]; then
  -        RV="`echo ${INSTANCE} | tr ' ' '\n' | head -n 1`"
  -        unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  -        return
  -    fi
   
  +    INSTANCE=`echo "$1" | sed -e 's;^OPENPKG_;;' -e 's;_STABLE$;;' -e 's;_SOLID$;;' 
-e 's;^HEAD$;;' -e 's;_;.;g'`
  +    RE=""
  +    echo "${INSTANCE}" | egrep -i "^head$"                    >/dev/null && 
RE="^[0-9]{8}$"     #HEAD (any)
  +    echo "${INSTANCE}" | egrep "^[0-9]{8}$"                   >/dev/null && 
RE="^${INSTANCE}$"  #HEAD
  +    echo "${INSTANCE}" | egrep "^[0-9]{1,7}$"                 >/dev/null && 
RE="^${INSTANCE}\." #STABLE
  +    echo "${INSTANCE}" | egrep "^[0-9]+\.[0-9]{8}$"           >/dev/null && 
RE="^${INSTANCE}$"  #SNAPSHOT
  +    echo "${INSTANCE}" | egrep "^[0-9]+\.[0-9]{1,7}$"         >/dev/null && 
RE="^${INSTANCE}"   #SOLID (any UPD)
  +    echo "${INSTANCE}" | egrep "^[0-9]+\.[0-9]{1,7}\.[0-9]+$" >/dev/null && 
RE="^${INSTANCE}$"  #SOLID
  +    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`
  +            echo ${VERSION} | egrep "$RE" >/dev/null
  +            if [ $? -eq 0 ]; then
  +                RV="${INSTANCE}"
  +                unset INSTANCE
  +                return
  +            fi
  +        fi
  +    done
       if [ ".$mode" = .any ]; then
  -        RV="`echo ${INSTANCE} ${AVAILINS} | tr ' ' '\n' | head -n 1`"
  -        unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  -        return
  +        for INSTANCE in ${OPENPKG_INST}; do
  +            if [ -x "${INSTANCE}/bin/rpm" ]; then
  +                RV="${INSTANCE}"
  +                unset INSTANCE
  +                return
  +            fi
  +        done
       fi
  -
       RV=""
  -    unset ADD AVAILINS OPMINORV OPMAJORV INSTANCE
  +    unset INSTANCE
   }
   
   bash () {
  @@ -615,18 +592,20 @@
       OPENPKG_CTAG="${RV}"
   
       #   canonify OPENPKG_EXEC
  -    echo ${OPENPKG_EXEC} | grep / >/dev/null
  -    if [ $? -ne 0 ]; then
  -        canonifybranch "${OPENPKG_EXEC}"
  -        matchinstance "${RV}" exact
  -        OPENPKG_EXEC="${RV}"
  -    fi
  +    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
   
  @@ -638,7 +617,7 @@
       export CVS_RSH
   
       #   import OpenPKG environment
  -    eval \`\${OPENPKG_INST}/etc/rc --eval openpkg env\`
  +    eval \`\${E}/etc/rc --eval openpkg env\`
   
       #   provide a unified which(1) command, because vendor implementations differ 
in error results.
       uwhich () {
  @@ -666,7 +645,7 @@
               ssh -t -x [EMAIL PROTECTED] cd \${PWD} \&\& \${SHELL}
           elif [ ".\$1" = .rpm ]; then
               shift
  -            ssh -t -x [EMAIL PROTECTED] cd \${PWD} \&\& HOME=\${OPENPKG_WORK} 
\${OPENPKG_INST}/bin/rpm "\$@"
  +            ssh -t -x [EMAIL PROTECTED] cd \${PWD} \&\& HOME=\${OPENPKG_WORK} 
\${E}/bin/rpm "\$@"
           else
               ssh -x [EMAIL PROTECTED] cd \${PWD} \&\& "\$@"
           fi
  @@ -970,7 +949,7 @@
           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} ${OPENPKG_INST}/bin/rpm --eval '%{_rpmdir}'`
  +        rpmdir=`HOME=${OPENPKG_WORK} ${E}/bin/rpm --eval '%{_rpmdir}'`
           if [ ! -f "$rpmdir/$rpmfile" ]; then
               die "binary RPM not found: $rpmdir/$rpmfile"
           fi
  @@ -988,7 +967,7 @@
               filter="$filter -e \"s;^ \\\\(.* ${docfile}\\\\)\$;D\\\\1;\""
           done
           IFS="$OIFS"
  -        HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm -qplv $rpmdir/$rpmfile | eval 
$filter
  +        HOME=${OPENPKG_WORK} ${E}/bin/rpm -qplv $rpmdir/$rpmfile | eval $filter
       done
   }
   
  @@ -1086,6 +1065,13 @@
                   sleep 3
                   OPENPKG_DIST=`echo ${OPENPKG_DIST} | sed -e 's;/$;;' -e 
's;/current/SRC$;;'`
               fi
  +            if [ ".${OPENPKG_WILD}" != . ]; then
  +                warn "deprecated use of OPENPKG_WILD. Do not use it."
  +                warn "Please list all instances in OPENPKG_INST (space delimited)."
  +                warn "This might come from your ~/.openpkg-dev.rc file. Please fix."
  +                warn "Three second penalty :-)"
  +                sleep 3
  +            fi
   
               echo "++ determine [no]src extension"
               ext=""
  @@ -1170,7 +1156,7 @@
   
               if [ ".${BRANCH}" = .HEAD ]; then
                   echo "++ linting ${name}.spec (package specification)"
  -                HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl 
--rpm=${OPENPKG_INST}/bin/rpm ${OPENPKG_WORK}/src/${name}/${name}.spec 
  +                HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl 
--rpm=${E}/bin/rpm ${OPENPKG_WORK}/src/${name}/${name}.spec 
                   if [ $? -gt 0 ]; then
                       die "unacceptable specification: 
${OPENPKG_WORK}/src/${name}/${name}.spec"
                   fi
  @@ -1194,7 +1180,7 @@
                   bin_template=`HOME=${OPENPKG_WORK} $E/bin/rpm --eval 
'%{_rpmfilename}'`
                   bin_rpmfile=`HOME=${OPENPKG_WORK} $E/bin/rpm -q --qf 
"${bin_template}" \
                                --specfile ${OPENPKG_WORK}/src/${name}/${name}.spec`
  -                bin_rpmdir=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm --eval 
'%{_rpmdir}'`
  +                bin_rpmdir=`HOME=${OPENPKG_WORK} ${E}/bin/rpm --eval '%{_rpmdir}'`
                   if [ -f "$bin_rpmdir/$bin_rpmfile" ]; then
                       echo "++ linting ${bin_rpmfile} (binary package)"
                       HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/rpmlint.pl 
--check=layout,attrib $bin_rpmdir/$bin_rpmfile
  @@ -1321,9 +1307,9 @@
           # contributor section
           else
               echo "++ determining contributor identification"
  -            thisdate=`${OPENPKG_INST}/lib/openpkg/shtool echo -e '%D-%m-%Y'`
  -            username=`${OPENPKG_INST}/lib/openpkg/shtool echo -e '%u'`
  -            hostname=`${OPENPKG_INST}/lib/openpkg/shtool echo -e '%h%d'`
  +            thisdate=`${OPENPKG_EXEC}/lib/openpkg/shtool echo -e '%D-%m-%Y'`
  +            username=`${OPENPKG_EXEC}/lib/openpkg/shtool echo -e '%u'`
  +            hostname=`${OPENPKG_EXEC}/lib/openpkg/shtool echo -e '%h%d'`
               realname=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd 
.) 2>/dev/null |\
                         grep "^${username}:" | awk -F: '{ print $5; }'`
               if [ ".$realname" = . ]; then
  @@ -1346,9 +1332,9 @@
   
               echo "++ uploading patch file to OpenPKG contribution area"
               if [ ${dry} -eq 0 ]; then
  -                ${OPENPKG_INST}/lib/openpkg/curl --upload-file 
${OPENPKG_WORK}/${name}.diff ${OPENPKG_DIST}/${name}.diff
  +                ${E}/lib/openpkg/curl --upload-file ${OPENPKG_WORK}/${name}.diff 
${OPENPKG_DIST}/${name}.diff
               else
  -                echo ${OPENPKG_INST}/lib/openpkg/curl --upload-file 
${OPENPKG_WORK}/${name}.diff ${OPENPKG_DIST}/${name}.diff
  +                echo ${E}/lib/openpkg/curl --upload-file 
${OPENPKG_WORK}/${name}.diff ${OPENPKG_DIST}/${name}.diff
                   cat ${OPENPKG_WORK}/${name}.diff | ${cvs_diff_colorize}
               fi
           fi
  @@ -1661,7 +1647,7 @@
   
   search_for () {
       URL=`echo $2 | sed -e 's| *$||'`
  -    PKG=`${OPENPKG_INST}/lib/openpkg/curl -l -s $URL |\
  +    PKG=`${E}/lib/openpkg/curl -l -s $URL |\
            sed -e 's|[^-a-zA-Z0-9_\.]||g' |\
            grep "^$1" | sort`
       if [ ".$PKG" != . ]; then
  @@ -1675,6 +1661,12 @@
   }
   
   search () {
  +    #   we must have a E/bin/rpm somewhere
  +    if [ ".$E" = . ]; then
  +        matchinstance "${OPENPKG_CTAG}" any
  +        E="${RV}"
  +    fi
  +
       if [ ".$1" = . ]; then
           if [ ".$P" = . ]; then
               die "package cannot be identified. Neither parameter given nor \$P set."
  @@ -1742,7 +1734,7 @@
               name=`echo ${name} | sed -e 's;\.spec$;;'`
   
               echo "++ linting $file (package specification)"
  -            HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl 
--rpm=${OPENPKG_INST}/bin/rpm $file
  +            HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl 
--rpm=${E}/bin/rpm $file
               if [ $? -gt 0 -a $force -ne 1 ]; then
                   die "unacceptable specification"
               fi
  @@ -1766,7 +1758,7 @@
               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_rpmdir=`HOME=${OPENPKG_WORK} ${OPENPKG_INST}/bin/rpm --eval 
'%{_rpmdir}'`
  +                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)"
                       HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/rpmlint.pl 
--check=layout,attrib $bin_rpmdir/$bin_rpmfile
  @@ -2001,7 +1993,7 @@
           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=${OPENPKG_INST}/bin/rpm ${file}
  +                HOME=${OPENPKG_WORK} perl ${OPENPKG_WORK}/re/speclint.pl 
--rpm=${E}/bin/rpm ${file}
                   if [ $? -gt 0 ]; then
                       die "unacceptable specification: ${file}"
                   fi
  @@ -2063,7 +2055,6 @@
   
   #   make sure environment is set up
   [ ".${OPENPKG_INST}" = . ] && die "OPENPKG_INST is not set";
  -[ ".${OPENPKG_WILD}" = . ] && die "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";
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-re/todo.txt
  ============================================================================
  $ cvs diff -u -r1.154 -r1.155 todo.txt
  --- openpkg-re/todo.txt       16 Jan 2004 09:40:13 -0000      1.154
  +++ openpkg-re/todo.txt       16 Jan 2004 13:20:56 -0000      1.155
  @@ -21,7 +21,6 @@
   -------------------------------------------------------
   MUST HAVE:
   o create new environment on all servers in build farm [thl]
  -  - adjust openpkg-dev
   o fix bootstrap %pre problem [rse]
     buildfarm reports "install: %pre scriptlet failed (2), skipping openpkg ..."
   o openpkg.boot does not find rpmtool through macro while bootstrapping [rse]
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to