Rev 8118 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/sh# ${R_HOME}/bin/check for checking installed add-on packagesrevision='$Revision: 1.14 $'version=`set - ${revision}; echo ${2}`version="R package checker ${version}Copyright (C) 2000 R Development Core Team.There is NO warranty. You may redistribute this software under theterms of the GNU General Public License.For more information about these matters, see the files named COPYING."usage="Usage: R CMD check [options] pkgsCheck installed R packages specified by pkgs.Currently, the only check performed is whether the examples provided bythe packages' documentation can be run successfully.Other means for regression testing will be added in the future.If an element of pkgs is a relative or absolute path to the sources of apackage, it is attempted to re-build the examples from the Rd sources(unless \`--no-rebuild' is given).If necessary for passing the checks, use the \`--vsize' and \`--nsize'options to increase R's memory (\`--vanilla' is used by default).Options:-c, --clean remove created files-d, --debug turn on shell debugging (set -x)-h, --help print short help message and exit-l, --library=LIB use packages in library tree LIB--vsize=N set R's vector heap size to N bytes--nsize=N set R's number of cons cells to N--no-rebuild do not rebuild examples-v, --version print version info and exitEmail bug reports to <r-bugs@lists.r-project.org>."opts=pkgs=clean=falsedebug=falserebuild=truelib=${R_HOME}/librarywhile test -n "${1}"; docase ${1} in-h|--help)echo "${usage}"; exit 0 ;;-v|--version)echo "${version}"; exit 0 ;;-c|--clean)clean=true ;;-d|--debug)debug=trueopts="${opts} --debug";;--no-rebuild)rebuild=false ;;-l)lib=${2}; shift ;;--library=*)lib=`echo "${1}" | sed -e 's/[^=]*=//'` ;;--nsize=*)R_opts="{R_opts} ${1}" ;;--vsize=*)R_opts="{R_opts} ${1}" ;;*)pkgs="${pkgs} ${1}" ;;esacshiftdoneif test -z "${pkgs}"; thenecho "ERROR: no packages specified"exit 1fiif test -d ${lib}; thenlib=`cd ${lib}; pwd`elseecho "ERROR: library directory \`${lib}' does not exist"exit 2fiR_LIBS="${lib}:${R_LIBS:-${RLIBS}}"start_dir=`pwd`## The work horsecheckpkg () {echo "Checking package \`${1}' ..."pkg=${1}cd ${start_dir}use_man=falseif ${rebuild}; thenif test -d ${pkg}/man -a -w ${lib}/`basename ${pkg}`; thenuse_man=truecd ${pkg}pkg=`basename ${pkg}`rm -rf ${lib}/${pkg}/R-exfifiif test \! -d ${lib}/${pkg}; thenecho "WARNING: package \`${pkg}' not installed ... skipping"breakfiif ${use_man}; then${R_HOME}/bin/build-help ${opts} --example ../${pkg} ${lib}check_dir=checkelsecheck_dir=check-${pkg}fitest -d ${check_dir} || mkdir ${check_dir}cd ${check_dir}echo " Massaging examples into \`${pkg}-Ex.R' ..."${R_HOME}/bin/massage-Examples ${pkg} ${lib}/${pkg}/R-ex/*.R \> ${pkg}-Ex.Recho " Running examples in package \`${pkg}' ..."R_LIBS=${R_LIBS} ${R_HOME}/bin/R --vanilla ${R_opts} < ${pkg}-Ex.R \> ${pkg}-Ex.Routif test ${?} -eq 0; thenecho " OK"elseecho " ERROR" && exit 1fiif ${clean}; thencd .. && rm -rf ${check_dir}elseecho " Results of \`check' are available in directory ${check_dir}"fi}## The main loopif ${debug}; then set -x; fifor p in ${pkgs}; docheckpkg ${p}echodone### Local Variables: ***### mode: sh ***### sh-indentation: 2 ***### End: ***