Rev 6994 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh# ${R_HOME}/bin/check for checking installed add-on packagesUSAGE_MSG="Usage: R CMD check [options] [-l lib] pkg_1 ... pkg_n"VERSION="0.2-1"OPTS=PKGS=CLEAN=falseDEBUG=falseREBUILD=trueSTART_DIR=`pwd`lib=${R_HOME}/librarywhile test -n "${1}"; docase ${1} in-h|--help|-\?)echo "${USAGE_MSG}"; exit 0 ;;-V|--version)echo "${VERSION}"; exit 0 ;;-c|--clean)CLEAN=true ;;--debug)DEBUG=true; OPTS="${OPTS} --debug" ;;--no-rebuild)REBUILD=false ;;-l)lib=${2}; shift;R_LIBS="${lib}:${R_LIBS:-${RLIBS}}";;;*)PKGS="${PKGS} ${1}" ;;esacshiftdoneif ${DEBUG}; then set -x; fiif test -z "${PKGS}"; thenecho "${USAGE_MSG}"exit 1fiif test -d ${lib}; thenlib=`cd ${lib}; pwd`elseecho "ERROR: library directory \`${lib}' does not exist"exit 2fifor pkg in ${PKGS}; docd ${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-exfifiecho "Checking package \`${pkg}' ..."if 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 < ${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}"fidone