Rev 2685 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/sh# ${RHOME}/bin/check for checking installed add-on packagesUSAGE_MSG="Usage: R CMD check [options] [-l lib] pkg_1 ... pkg_n"VERSION="0.1-0"OPTS=PKGS=DEBUG=falselib=${RHOME}/librarywhile test -n "${1}"; docase ${1} in-h|--help|-\?)echo "${USAGE_MSG}"; exit 0 ;;-V|--version)echo "${VERSION}"; exit 0 ;;--debug)DEBUG=true; OPTS="${OPTS} --debug" ;;-l)lib=${2}; shift ;;*)PKGS="${PKGS} ${1}" ;;esacshiftdoneif ${DEBUG}; then set -x; fiif test -z "${PKGS}"; thenecho "${USAGE_MSG}"exit 1fiif test -d ${lib} -a -w ${lib}; thenlib=`cd ${lib}; pwd`elseecho "ERROR: cannot write to or create directory \`${lib}'"exit 2fifor pkg in ${PKGS}; doif test -d $pkg; thencd ${pkg}elseecho "WARNING: No subdirectory ${pkg} in "`pwd`' ... skipping'breakfipkg=`basename ${pkg}`echo "Checking package \`${pkg}' ..."if test -d ${lib}/${pkg}; thenrm -rf ${lib}/${pkg}/R-exelseecho "WARNING: package \`${pkg} not installed ... skipping"breakfiif test -d man; then${RHOME}/bin/build-help ${OPTS} --example ../${pkg} ${lib}elseecho "WARNING: package \`${pkg} contains no examples ... skipping"fitest -d check || mkdir checkcd checkecho " Massaging examples into \`${pkg}-Ex.R' ..."${RHOME}/bin/massage-Examples ${pkg} ${lib}/${pkg}/R-ex/*.R \> ${pkg}-Ex.Recho " Running examples in package \`${pkg}' ..."${RHOME}/bin/R --vanilla --vsize 6 < ${pkg}-Ex.R > ${pkg}-Ex.Routif test ${?} -eq 0; thenecho " OK"elseecho " ERROR"fidone