[Genabel-commits] r1567 - pkg/GenABEL-general/scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 27 00:21:37 CET 2014


Author: lckarssen
Date: 2014-01-27 00:21:32 +0100 (Mon, 27 Jan 2014)
New Revision: 1567

Modified:
   pkg/GenABEL-general/scripts/makedistrib_VariABEL.sh
Log:
Rewrite of the makedistrib_VariABEL.sh script along the lines of the makedistrib_MetABEL.sh script.


Modified: pkg/GenABEL-general/scripts/makedistrib_VariABEL.sh
===================================================================
--- pkg/GenABEL-general/scripts/makedistrib_VariABEL.sh	2014-01-26 22:36:13 UTC (rev 1566)
+++ pkg/GenABEL-general/scripts/makedistrib_VariABEL.sh	2014-01-26 23:21:32 UTC (rev 1567)
@@ -1,11 +1,37 @@
 #!/bin/bash
-rm -rf VariABEL*
+#
+# This script tries to package an R package by downloading it from the
+# SVN server. It includes the required R CMD checks before building
+# the package.
+
+PKG=VariABEL
+CRAN_repo='"http://cran-mirror.cs.uu.nl"'
+
+# Exit on errors
+set -e
+
+# Find the directory where this script (and others it depends on) are
+# located
+scriptdir=$(dirname $0)
+
+echo "--------------------------------------------------"
+echo "Removing old files and directories (if present)"
+echo "--------------------------------------------------"
+rm -rf $PKG
+rm -rf $PKG.Rcheck
+rm -rf $PKG_*.tar.gz
 rm -rf DatABEL DatABEL.*
 rm -rf filevector*
+
+
+echo
+echo "--------------------------------------------------"
+echo "Checking out source code from SVN..."
+echo "--------------------------------------------------"
 svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/filevector
 svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/DatABEL
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/VariABEL
-cd VariABEL
+svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/$PKG
+cd $PKG
 rm -f cleanup* configure* *.R
 cd src
 cp DAlib/*.c* .
@@ -22,6 +48,60 @@
 rm -rf VARlib
 mv Makevars_distrib Makevars
 cd ../..
-R CMD check VariABEL
-R CMD build VariABEL
-# and do not forget to run R CMD check --as-cran!
+
+# In order not to mess with the current user's R library directory we
+# set one in /tmp. Most Linux distributions will remove the
+# directories in /tmp on reboot or after several days.
+export R_LIBS=/tmp/Rlibs-$PKG-build
+mkdir -p $R_LIBS
+
+echo
+echo "--------------------------------------------------"
+echo "Installing missing R packages from CRAN and Bioconductor" \
+     "into the directory $R_LIBS"
+echo "--------------------------------------------------"
+
+deps=$($scriptdir/getdeps.awk $PKG/DESCRIPTION)
+
+R --vanilla --no-save --slave <<EOF
+deplist=c($deps)
+
+new.packages <- deplist[!(deplist %in% installed.packages()[,"Package"])]
+
+if (length(new.packages)) {
+    install.packages(new.packages, repos=$CRAN_repo)
+}
+EOF
+
+
+errwarn=0
+echo
+echo "--------------------------------------------------"
+echo "Running normal R checks..."
+echo "--------------------------------------------------"
+R CMD check $PKG
+if grep -qE "NOTE|WARNING|ERROR" $PKG.Rcheck/00check.log; then
+    errwarn=1
+fi
+
+echo
+echo "--------------------------------------------------"
+echo "Check with --as-cran..."
+echo "--------------------------------------------------"
+R CMD check --as-cran $PKG
+if grep -qE "NOTE|WARNING|ERROR" $PKG.Rcheck/00check.log; then
+    errwarn=1
+fi
+
+echo
+echo "--------------------------------------------------"
+echo "Building the package for distribution..."
+echo "--------------------------------------------------"
+R CMD build $PKG
+
+if [ $errwarn -eq 1 ]; then
+    echo
+    echo "NOTEs, WARNINGs or ERRORs found!" 1>&2
+    echo "Please fix before uploading to CRAN" 1>&2
+    exit 1
+fi



More information about the Genabel-commits mailing list