|
From: <sg...@us...> - 2003-12-10 19:43:28
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv14171/toc/tests
Added Files:
ssh_tools.sh toc_config_h.sh toc_make.sh
Log Message:
egg
--- NEW FILE: ssh_tools.sh ---
#!/do/not/bash
# toc_run_description = looking for ssh and scp
# toc_begin_help =
# Looks for ssh and scp in ${PATH}. Optionally accepts:
# --with-ssh=/path/to/ssh
# --with-scp=/path/to/scp
#
# Returns non-zero if either of them is not found, and zero
# if both are found.
# = toc_end_help
err=0
toc_find_failok ${configure_with_ssh-ssh} && toc_add_config SSH_BIN=${TOC_FIND_RESULT} || {
err=$?
toc_add_config SSH_BIN=
echo "ssh not found. Try using --with-ssh=/path/to/ssh"
}
toc_find_failok ${configure_with_scp-scp} && toc_add_config SCP_BIN=${TOC_FIND_RESULT} || {
err=$?
toc_add_config SCP_BIN=
echo "scp not found. Try using --with-scp=/path/to/scp"
}
return $err
--- NEW FILE: toc_config_h.sh ---
#!/do/not/bash
# toc_run_description = creating config.h
# toc_begin_help =
# Creates a config.h from config.h.at.
# Accepts optional $1 naming a target config.h-like
# file. The file $1.at must exist for this to work.
# = toc_end_help
function toc_config_h
{ # $1 = target file. $1.at must exist.
# todo: add support for multiple input files.
# i use a function so i can use local vars
local propsfile=.config.h.properties
local configh=$1
configh=${configh##${TOP_SRCDIR}/}
local tmpl=$configh.at
test -f $tmpl || {
echo "Note: no $tmpl found, so $configh will not be created."
return 0
}
i=0
test -f "$propsfile" && rm "$propsfile"
toc_dump_config_h_properties > $propsfile
toc_atfilter_file $propsfile $tmpl $configh
rm $propsfile
return 0
}
files="$@"
test -z "$files" && files=${TOC_INCLUDESDIR}/config.h
toc_config_h "$files"
return $?
--- NEW FILE: toc_make.sh ---
#!/do/not/bash
# toc_run_description = creating toc.make
# Do not run this test manually: it is run by the toc core.
TOC_MAKE=toc.make
toc_add_make TOC_MAKE=${TOC_MAKE}
function toc_make_toc_make
{
# use a function because bash doesn't allow local vars outside of functions.
local makeprops=${TOP_SRCDIR}/.toc.make.tmp
toc_dump_make_properties > $makeprops
local thedir
local tocmake
local relpath
local shortform
local tocmakeprops
for d in $(find ${TOP_SRCDIR} -name Makefile -o -name GNUMakefile -o -name Makefile.toc | xargs grep -l "^include ${TOC_MAKE}" | sort); do
thedir=$(dirname $d)
tocmake=${thedir}/${TOC_MAKE}
toc_makerelative $thedir
relpath=${TOC_MAKERELATIVE}
tocmake=${tocmake##$TOP_SRCDIR/} # make it short, for asthetic reasons :/
shortform=${thedir##${PWD}/}
test "$shortform" = "$PWD" && shortform= # top-most dir
# echo "tocmake=$tocmake relpath=$relpath shortform=$shortform"
tocmakeprops=${cmake}.props
cp $makeprops $tocmakeprops
cat <<EOF >> $tocmakeprops
TOP_SRCDIR=${relpath##./}
TOC_RELATIVE_DIR=${shortform##./}
EOF
toc_atfilter_file $tocmakeprops ${TOC_HOME}/make/toc.make.at $tocmake \
|| toc_die $? "Error creating toc.make!"
rm $tocmakeprops
touch $tocmake # required for proper auto-reconfigure :/
done
}
toc_make_toc_make
|