From: <sg...@us...> - 2003-08-30 19:20:35
|
Update of /cvsroot/libfunutil/libfunutil/toc/sbin In directory sc8-pr-cvs1:/tmp/cvs-serv30672/sbin Modified Files: toc_core.sh toconfigure Log Message: a number of changes from the toc tree. Index: toc_core.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/sbin/toc_core.sh,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- toc_core.sh 29 Aug 2003 10:45:07 -0000 1.21 +++ toc_core.sh 30 Aug 2003 19:20:31 -0000 1.22 @@ -93,7 +93,7 @@ function toc_debug { test "$TOC_DEBUG" -ne 0 || return 0; - echo "toc_debug: " $@ + echo "toc_debug: " $@ 1>&2 return 0 } @@ -184,7 +184,7 @@ toc_dump_make_properties $tmpfile toc_atfilter_file $tmpfile $tmpl $target local err=$? - test -f $tmpfile && rm $tmpfile + rm $tmpfile return $err } @@ -391,8 +391,8 @@ } # end config manipulator function toc_find_test -{ # internal helper function. - # return value is in TOC_FIND_RESULT +{ # Sets TOC_FIND_RESULT to the absolute path of the toc test named $1 + # Returns 0 if it finds a file, else 1. toc_find_in_path ${TOC_TESTSDIR}/$1.sh || \ toc_find_in_path $1 ".:${PATH}" || \ toc_find_in_path $1.sh ".:${PATH}" @@ -414,31 +414,36 @@ function toc_run { TOC_RUN_DEPTH=$((TOC_RUN_DEPTH + 1)) + local depth=${TOC_RUN_DEPTH} toc_debug "toc_run " $@ local testname=$1 #${TOC_FIND_RESULT} #TOC_DIR=${TOC_TESTSDIR} local path= local desc= - toc_find_test $1 && { + toc_find_test $testname && { path=${TOC_FIND_RESULT} desc=$(sed -ne 's|\#.*toc_run_description.*= *\(.*\)|\1|p;q' ${TOC_FIND_RESULT}); } || { - toc_die 127 toc_run cannot find script for test $1. + toc_die 127 toc_run cannot find script for test $testname. } shift # if test ${TOC_LOUD} = 1; then -# i=1; -# while test $i -le ${TOC_RUN_DEPTH}; do -# echo -n "${TOC_BOLD_}===>${_TOC_BOLD_} " -# i=$((i + 1)) -# done + + local showname="$testname" + test "x${TOC_LOUD-0}" != "x0" -a "x$1" != "x" && showname="$showname $@" + toc_loudly -n "[$depth] " +# test "x${TOC_LOUD-0}" toc_boldecho -n "[$depth] ====" + i=1; + while test $i -le $depth; do + echo -n "${TOC_BOLD_}==${_TOC_BOLD_}" + i=$((i + 1)) + done # else - echo -n "==${TOC_RUN_DEPTH}==" + toc_boldecho -n " [$showname] " + test -n "$desc" && echo -n $desc +# echo -n "[$testname]====== " # fi - local args="" - test "x${TOC_LOUD-0}" != "x0" && args=" $@" - test "$args" = " " && args= - echo -e " ${TOC_BOLD_}test: [$testname$args]${_TOC_BOLD} $desc" + echo local err=0 toc_source_test $testname $@ err=$? @@ -451,17 +456,16 @@ { # runs toc_run and warns if there was an error. # It does not exit - it returns 1 on error, however. toc_debug toc_run_failok $@ - local testname - testname=$1 - depth=$((TOC_RUN_DEPTH + 1)) + local testname=$1 + local depth=$((TOC_RUN_DEPTH + 1)) toc_run $@ || { local ret=$? - local ret - echo -n "==${depth}== " - for i in 0 0 0; do - echo -en "!!!! ${TOC_EMOTICON_WARNING} ${TOC_BOLD}${testname}${_TOC_BOLD}"; - done - echo ${TOC_EMOTICON_WARNING} $ret + toc_loudly -n "[${depth}] " + toc_boldecho -n "^^^^^^^^^^ " + echo -n ${TOC_EMOTICON_WARNING} " " + toc_boldecho -n "$testname: $ret" + echo -n " " ${TOC_EMOTICON_WARNING} " " + toc_boldecho "^^^^^^^^^^ " return $ret } #&& echo ${TOC_EMOTICON_OKAY} @@ -473,22 +477,18 @@ function toc_run_fail { toc_debug toc_run_fail $@ - testname=$1 - depth=$((TOC_RUN_DEPTH + 1)) -# depth=${TOC_RUN_DEPTH} + local testname=$1 + local depth=$((TOC_RUN_DEPTH + 1)) toc_run $@ || { - local ret - ret=$? - echo -n "==${depth}== " - for i in 0 0 0; do - echo -en "!!!! ${TOC_EMOTICON_ERROR} ${TOC_BOLD}${testname}${_TOC_BOLD} "; - done - echo ${TOC_EMOTICON_ERROR} - # toc_run_showerr $ret ${TOC_CONFIG_LOG} $testname + local ret=$? + toc_loudly -n "[${depth}] " + toc_boldecho -n "^^^^^^^^^^ " + echo -n ${TOC_EMOTICON_ERROR} " " + toc_boldecho -n "$testname: $ret" + echo -n " " ${TOC_EMOTICON_ERROR} " " + toc_boldecho "^^^^^^^^^^ " exit $ret } - # && echo ${TOC_EMOTICON_OKAY} - #toc_show_posttest_feedback return 0 } @@ -572,6 +572,7 @@ # test -f $tgt && fstate=updated if test -f "$tgt"; then if cmp -s "$tgt" "$tmp"; then + toc_debug "toc_replace_file: $tgt is up to date. Deleting $tmp." #echo "toc_replace_file: $tgt fstate=up to date" rm -f $tmp return 1 @@ -596,7 +597,7 @@ pfile=$1 tmpl=$2 ofile=$3 - tmpfile=$ofile.tmp + local tmpfile=$ofile.toc_atfilter_file ${TOC_ATSIGN_PARSER} -f $pfile < $tmpl > $tmpfile || { err=$? echo "toc_atfilter_file(): @-parsing failed: error $err " @@ -606,7 +607,7 @@ echo -n "$ofile ... " fstate="created" - test -f $ofile && fstate="recreated" + test -f $ofile && fstate="updated" toc_replace_file $ofile $tmpfile || fstate="up to date" echo "$fstate" #echo " ${TOC_EMOTICON_OKAY}" @@ -630,7 +631,7 @@ } function toc_parseargs -{ # an experiment in cl args handling +{ # parses $@ for arguments toc can work with. toc_debug "toc_parseargs: Handling command-line arguments: $@" # mostly stolen from the qt 3.1.0 configure script :) while [ "$#" -gt 0 ]; do @@ -642,26 +643,27 @@ --help|-?) cat<<-EOF Usage: - configure [--prefix=/path] [--argument=value] [--arg2=val2] ... + $0 [--prefix=/path] [--argument=value] [--arg2=val2] ... See the README file for this package to find out which arguments are supported. Standard arguments include: - --help or -? Show this help. - --prefix=/path Top-most path for installation. Default: ${prefix} - --enable-FOO=... Sets the global variable configure_enable_FOO to the given value. - --enable-FOO Equivalent to --enable-FOO=1. - --disable-FOO Equivalent to --enable-FOO=0. - --with-FOO=... Sets the global variable configure_with_FOO to the given value. - --with-FOO Equivalent to --with-FOO=1. - --without-FOO Equivalent to --with-FOO=0. - --FOO=BAR Sets global variable FOO=BAR. - --FOO Equivalent to --FOO=1. - --toc-quiet Disables some text which may be of arguable utility. - --toc-loud Disables "quietness", and turns up the volume a bit. - Note that all generated variables are set in the shell environment, the shared makefile and config.h. - This means you can do things like override the PATH with --PATH=... - +EOF +# ^^^^ note usage of hard tabs in the cat command! +cat <<EOF | perl -ne 'm/\t*(.*)\s*\|\s*(.*)/; print " $1\n\t\t$2\n";' + --help or -? | Show this help. + --prefix=/path | Top-most path for installation. Default: ${prefix} + --enable-FEATURE=... | Exports config variable configure_enable_FEATURE. + --enable-FEATURE | Equivalent to --enable-FEATURE=1. + --disable-FEATURE | Equivalent to --enable-FEATURE=0. + --with-FEATURE=... | Sets the global variable configure_with_FEATURE. + --with-FEATURE | Equivalent to --with-FEATURE=1. + --without-FEATURE | Equivalent to --with-FEATURE=0. + --XXX=YYY | Exports config variable XXX=YYY. + --XXX | Equivalent to --XXX=1. + --toc-quiet,--quiet | Disables some text which may be of arguable utility. + --toc-loud, --verbose, --loud | Enables some otherwise superfluous information. + --toc-fail-fast | Causes configure to abort if toc_run_failok returns non-zero. EOF # ^^^^ note usage of hard tabs in the cat command! exit 0 @@ -671,13 +673,21 @@ VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;") VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,") ;; + --loud|--verbose|--toc-loud) + VAR=TOC_LOUD + VAL=1 + ;; + --quiet) + VAR=TOC_QUIET + VAL=1 + ;; --TOC-[-_]*|--toc[-_]*) # reserved. VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;s,-,_,g;s/^__//;" | tr '[a-z\-]' '[A-Z_]') VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,;/^--/d;") test -n "$VAL" || VAL=1 ;; - --enable-*=*|--with-*=*) + --enable-*=*|--with-*=*) # sets configure_with_XXX or configure_enable_XXX VAR=$(echo "$arg" | sed "s,^--\(.*\)=.*,\1,;s,-,_,g") VAL=$(echo "$arg" | sed "s,^--.*=\(.*\),\1,") @@ -790,7 +800,7 @@ EOF # source ${TOC_TOCDIR}/tests/toc_core_tests.sh || { -toc_run_fail toc_core_tests "Build environment sanity checks..." || { +toc_run_fail toc_core_tests || { # Don't do "toc_run toc_core" because then we don't see the output :/ err=$? echo "Core toc sanity test failed (err=$err). This tree is not toc-capable. ${TOC_EMOTICON_ERROR}" Index: toconfigure =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/sbin/toconfigure,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 |