RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-5_3: rpm/tests/ Makefile.am devtool devtool.conf spew s...

From: Jeff Johnson <jbj@rpm5.org>
Date: Mon 27 Sep 2010 - 09:40:11 CEST
Message-Id: <20100927074011.9F618DA404@rpm5.org>
  RPM Package Manager, CVS Repository
  /cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   27-Sep-2010 09:40:11
  Branch: rpm-5_3                          Handle: 20100926005227110864

  Added files:              (Branch: rpm-5_3)
    rpm/tests               spew spew.conf
  Modified files:           (Branch: rpm-5_3)
    rpm/tests               Makefile.am
  Removed files:            (Branch: rpm-5_3)
    rpm/tests               devtool devtool.conf

  Log:
    - tests: avoid duplicated devtool file, rename to "spew" to reflect
    its usage.

  Summary:
    Revision    Changes     Path
    1.63.2.28   +2  -2      rpm/tests/Makefile.am
    1.1         +0  -143    rpm/tests/devtool
    1.1         +0  -235    rpm/tests/devtool.conf
    1.1.2.1     +144 -0     rpm/tests/spew
    1.1.2.1     +235 -0     rpm/tests/spew.conf
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/tests/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.63.2.27 -r1.63.2.28 Makefile.am
  --- rpm/tests/Makefile.am	27 Sep 2010 02:33:56 -0000	1.63.2.27
  +++ rpm/tests/Makefile.am	27 Sep 2010 07:40:10 -0000	1.63.2.28
  @@ -507,7 +507,7 @@
   	    then ${find} ${$(@D)_uri} -maxdepth 1 | grep 'rpm$$' > $@; \
   	    else grep -v '^#' ${${@D}_manifest} > $@; \
   	  fi; \
  -	  ./devtool ${@D} > ${@D}/distros.mongo; \
  +	  ./spew ${@D} > ${@D}/distros.mongo; \
   	  ls -l ${@D}/uri $@ ${@D}/distros.mongo; \
   	fi
   
  @@ -557,7 +557,7 @@
   	  --noparentdirs --nolinktos --nosignature \
   	  $(<D)/todo 2>&1 | tee -a $(<D)/install
   	@echo "`$(now)` <== ${<D}: Installed." | tee -a $(<D)/install
  -	@-./devtool ${<D} > ${<D}/install.mongo
  +	@-./spew ${<D} > ${<D}/install.mongo
   	@-${mongo} ${mongoserver} < ${<D}/install.mongo
   
   Verify-%: %/solve
  @@ .
  rm -f rpm/tests/devtool <<'@@ .'
  Index: rpm/tests/devtool
  ============================================================================
  [NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED]
  @@ .
  rm -f rpm/tests/devtool.conf <<'@@ .'
  Index: rpm/tests/devtool.conf
  ============================================================================
  [NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED]
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tests/spew
  ============================================================================
  $ cvs diff -u -r0 -r1.1.2.1 spew
  --- /dev/null	2010-09-27 09:38:39.000000000 +0200
  +++ spew	2010-09-27 09:40:11.525501430 +0200
  @@ -0,0 +1,144 @@
  +#!/bin/sh
  +##
  +##  spew -- Emit "documented structured" momgo JSON
  +##  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com>
  +##  Swiped and renamed to "spew" from top-level "devtool".
  +##
  +
  +#   determine source tree location
  +SPEW_SRCDIR=`echo "$0" | sed -e 's;/spew$;;'`
  +export SPEW_SRCDIR
  +
  +#   build environment sanity check
  +if [ ! -f ${SPEW_SRCDIR}/spew.conf ]; then
  +    echo "spew:ERROR: no spew.conf in current directory" 1>&2
  +    exit 1
  +fi
  +
  +#   usage sanity check
  +if [ $# -eq 0 ]; then
  +    echo "spew:USAGE: spew <command> [<arg> ...]" 1>&2
  +    exit 1
  +fi
  +cmd="$1"
  +shift
  +cmdline=`grep "^%$cmd" ${SPEW_SRCDIR}/spew.conf`
  +if [ ".$cmdline" = . ]; then
  +    echo "spew:ERROR: command $cmd not found in spew.conf" 1>&2
  +    exit 1
  +fi
  +
  +#   ensure a reasonable temporary directory exists
  +if [ ".$TMPDIR" != . ]; then
  +    tmpdir="$TMPDIR"
  +elif [ ".$TEMPDIR" != . ]; then
  +    tmpdir="$TEMPDIR"
  +else
  +    tmpdir="/tmp"
  +fi
  +tmpfile="$tmpdir/spew.$$.tmp"
  +
  +#   generate run-command script
  +rm -f $tmpfile
  +touch $tmpfile
  +( sed <${SPEW_SRCDIR}/spew -e '1,/^##  spew.func {/d' -e '/^##  } spew.func/,$d'
  +  sed <${SPEW_SRCDIR}/spew.conf -e "1,/^%common/d" -e '/^%.*/,$d'
  +  sed <${SPEW_SRCDIR}/spew.conf -e "1,/^%$cmd/d" -e '/^%.*/,$d' ) |\
  +sed -e 's;\([ 	]\)@\([a-zA-Z_][a-zA-Z0-9_-]*\);\1spew_\2;' \
  +    -e 's;\([ 	]\)%\([a-zA-Z_][a-zA-Z0-9_-]*\);\1spew_execute \2;' \
  +>>$tmpfile
  +
  +#   execute run-command script
  +sh $tmpfile "$@"
  +rc=$?
  +
  +#   cleanup and graceful exit
  +rm -f $tmpfile >/dev/null 2>&1 || true
  +exit $rc
  +
  +##  spew.func { # is now embedded. This line used as cutting point. Do not remove.
  +
  +spew_execute () {
  +    sh ${SPEW_SRCDIR}/spew "$@"
  +}
  +
  +spew_source () {
  +    _tmpfile="${TMPDIR-/tmp}/spew.$$.tmp.$2"
  +    rm -f $_tmpfile
  +    sed <${SPEW_SRCDIR}/spew.conf -e "1,/^%$2/d" -e '/^%.*/,$d' |\
  +    sed -e 's;\([ 	]\)@\([a-zA-Z_][a-zA-Z0-9_-]*\);\1spew_\2;' \
  +        -e 's;\([ 	]\)%\([a-zA-Z_][a-zA-Z0-9_-]*\);\1spew_execute \2;' >$_tmpfile
  +    . $_tmpfile
  +    rm -f $_tmpfile
  +}
  +
  +spew_require () {
  +    t="$1"; o="$2"; p="$3"; e="$4"; a="$5"
  +    v=`($t $o | head -1 | awk "{ print \\\$$p; }") 2>/dev/null`
  +    if [ ".$v" = . ]; then
  +        echo "spew:ERROR: unable to determine version of $t" 1>&2
  +        exit 1
  +    fi
  +    case "$v" in
  +        $e )
  +            ;;
  +        $a )
  +            echo "spew:WARNING: $t version $v accepted, but expected $e." 1>&2
  +            ;;
  +        * )
  +            echo "spew:ERROR: $t version $v NOT acceptable, requires $e." 1>&2
  +            exit 1
  +            ;;
  +    esac
  +    echo "$v"
  +}
  +
  +spew_autogen () {
  +    tool=$1
  +    shift
  +    case $tool in
  +        autoconf )
  +            autoconf_version=`spew_require autoconf --version 4 "$1" "$2"`
  +            echo "generating (GNU Autoconf $autoconf_version): configure config.h.in"
  +            autoconf
  +            autoheader 2>&1 | grep -v "is unchanged"
  +            rm -rf autom4te.cache >/dev/null 2>&1
  +            ;;
  +        libtool )
  +            libtoolize_version=`spew_require libtoolize --version 4 "$1" "$2"`
  +            echo "generating (GNU Libtool $libtoolize_version): ltmain.sh, libtool.m4, config.guess, config.sub"
  +            libtoolize --force --copy --install >/dev/null 2>&1
  +            cp `libtoolize --force --copy --dry-run --install | grep "add the contents of" |\
  +                sed -e 's;^[^\`]*\`;;' -e "s;'.*;;"` libtool.m4
  +            ;;
  +        shtool )
  +            shtoolize_version=`spew_require shtoolize -v 3 "$1" "$2"`
  +            echo "generating (GNU Shtool $shtoolize_version): shtool"
  +            shift
  +            shift
  +            shtoolize -q "$@"
  +            ;;
  +    esac
  +}
  +
  +spew_autoclean () {
  +    tool=$1
  +    shift
  +    case $tool in
  +        autoconf )
  +            echo "removing: configure config.h.in"
  +            rm -f configure config.h.in
  +            ;;
  +        libtool )
  +            echo "removing: ltmain.sh libtool.m4 config.guess config.sub"
  +            rm -f ltmain.sh libtool.m4 config.guess config.sub
  +            ;;
  +        shtool )
  +            echo "removing: shtool"
  +            rm -f shtool
  +            ;;
  +    esac
  +}
  +
  +##  } spew.func # is now embedded. This line used as cutting point. Do not remove.
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tests/spew.conf
  ============================================================================
  $ cvs diff -u -r0 -r1.1.2.1 spew.conf
  --- /dev/null	2010-09-27 09:38:39.000000000 +0200
  +++ spew.conf	2010-09-27 09:40:11.555502727 +0200
  @@ -0,0 +1,235 @@
  +##
  +##  devtool.conf -- Development Tool Configuration for RPM 5
  +##
  +
  +%common
  +    Y=mongo
  +    export Y
  +
  +## ----- YAML
  +%init_yaml
  +    echo "---"
  +
  +%next_yaml
  +
  +%fini_yaml
  +    echo "---"
  +
  +%scalar_yaml
  +    T=$1; shift
  +    echo "$T:	$*"
  +
  +%tuple_yaml
  +    T=$1; shift
  +    echo "$T:"
  +    for I in $*; do
  +        echo "  - $I"
  +    done
  +
  +%slurp_yaml
  +    T=$1; shift
  +    echo "$T: |-"
  +    echo "`cat $1 | sed -e 's;^;  ;'`"
  +
  +## ----- JSON
  +%init_json
  +
  +%next_json
  +    echo ", "
  +
  +%fini_json
  +    echo ""
  +
  +%scalar_json
  +    T=$1; shift
  +    echo -n "{ \"$T\" : \"$*\" }"
  +
  +%tuple_json
  +    T=$1; shift
  +    echo -n "{ \"$T\" : "
  +    C="  [ "
  +    for I in $*; do
  +        echo -n "$C\"$I\""; C=", "
  +    done
  +    echo -n " ]"
  +    -n echo " }"
  +
  +%slurp_json
  +    T=$1; shift
  +    echo -n " { \"$T\" : \"`cat $1 | sed -e 's;\";\\\\\";g'`\" }"
  +
  +## ----- MONGO
  +%init_mongo
  +    D=$1
  +    set `../rpm --version`
  +    echo "use distros-`echo $3 | tr . _`;"
  +    echo "log = db.$D;"
  +    echo "log.insert("
  +
  +%next_mongo
  +    echo ", "
  +
  +%fini_mongo
  +    echo ");"
  +
  +%scalar_mongo
  +    T=$1; shift
  +    echo -n " { \"$T\" : \"$*\" }"
  +
  +%tuple_mongo
  +    T=$1; shift
  +    echo " { \"$T\" : "
  +    C="  [ "
  +    for I in $*; do
  +        echo -n "$C\"$I\""; C=",
  +    "
  +    done
  +    echo "
  +  ]"
  +    echo " }"
  +
  +%slurp_mongo
  +    T=$1; shift
  +    echo " { \"$T\" : \"\\"
  +    echo "`cat $1 | sed -e 's;\";\\\\\";g' -e 's;$;\\\\n\\\\;'`"
  +    echo "\"}"
  +
  +## -----
  +%identify
  +    D=$1
  +    Uri=`head -n 1 $D/uri`
  +    Mirror="$(test -f $D/mirror && cat $D/mirror || {
  +        echo $Uri | sed -e 's;^\(.*://[^/]*\)/.*;\1;'
  +    })"
  +    %scalar_$Y here	`hostname`:$PWD/$D
  +    %next_$Y
  +    %scalar_$Y now	`date -u --rfc-3339=seconds`
  +    %next_$Y
  +    set `../rpm --version`
  +    %scalar_$Y rpm	$3
  +    %next_$Y
  +    %scalar_$Y uname	`uname -a`
  +    %next_$Y
  +    %scalar_$Y distro	$D
  +    %next_$Y
  +    %scalar_$Y mirror	$Mirror
  +    %next_$Y
  +    %scalar_$Y base	`echo $Uri | sed -e 's;^'$Mirror'/;;'`
  +
  +%packages
  +    D=$1
  +    F=$D/manifest
  +    %init_$Y		$D
  +    %identify		$D
  +    %next_$Y
  +    set `wc -l $F`
  +    %scalar_$Y npkgs	$1
  +    %next_$Y
  +    %tuple_$Y manifest	`cat $F | sed -e 's;^.*/;;' -e 's;.rpm$;;'`
  +    for F in fetch import install upgrade verify erase bugs note
  +    do
  +        [ -f $D/$F ] || continue
  +        %next_$Y
  +	%slurp_$Y $F $D/$F
  +    done
  +    %fini_$Y
  +
  +## -----
  +%ALT51
  +    %packages		ALT51
  +
  +%ARK
  +    %packages		ARK
  +
  +%CM12
  +    %packages		CM12
  +
  +%CM14
  +    %packages		CM14
  +
  +%CM15
  +    %packages		CM15
  +
  +%CAOS2
  +    %packages		CAOS2
  +
  +%CAOS3
  +    %packages		CAOS3
  +
  +%C55
  +    %packages		C55
  +
  +%C54
  +    %packages		C54
  +
  +%C53
  +    %packages		C53
  +
  +%C52
  +    %packages		C52
  +
  +%C51
  +    %packages		C51
  +
  +%C50
  +    %packages		C50
  +
  +%IDMS
  +    %packages		IDMS
  +
  +%MDV2009
  +    %packages		MDV2009
  +
  +%MDV2010
  +    %packages		MDV2010
  +
  +%MOBLIN21
  +    %packages		MOBLIN21
  +
  +%OJUBA4
  +    %packages		OJUBA4
  +
  +%OWL2
  +    %packages		OWL2
  +
  +%PLD3
  +    %packages		PLD3
  +
  +%SL55
  +    %packages		SL55
  +
  +%SL54
  +    %packages		SL54
  +
  +%SL53
  +    %packages		SL53
  +
  +%SL52
  +    %packages		SL52
  +
  +%SL51
  +    %packages		SL51
  +
  +%SL50
  +    %packages		SL50
  +
  +%SLES11_3
  +    %packages		SLES11_3
  +
  +%SLES11_2
  +    %packages		SLES11_2
  +
  +%SLES11_1
  +    %packages		SLES11_1
  +
  +%UL
  +    %packages		UL
  +
  +%VINE51
  +    %packages		VINE51
  +
  +%YDL62
  +    %packages		YDL62
  +
  +%YDL61
  +    %packages		YDL61
  @@ .
Received on Mon Sep 27 09:40:11 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.