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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 26 22:49:47 CET 2014


Author: lckarssen
Date: 2014-01-26 22:49:46 +0100 (Sun, 26 Jan 2014)
New Revision: 1562

Modified:
   pkg/GenABEL-general/scripts/makedistrib_MetABEL.sh
Log:
Major rewrite/expansion of the makedistrib_MetABEL.sh script.
It now includes automatic install of the R dependencies, gives a final error message if NOTEs/WARNINGs/ERRORs are found and clearer progress messages.


Modified: pkg/GenABEL-general/scripts/makedistrib_MetABEL.sh
===================================================================
--- pkg/GenABEL-general/scripts/makedistrib_MetABEL.sh	2014-01-26 16:06:16 UTC (rev 1561)
+++ pkg/GenABEL-general/scripts/makedistrib_MetABEL.sh	2014-01-26 21:49:46 UTC (rev 1562)
@@ -1,14 +1,85 @@
 #!/bin/bash
+#
+# 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=MetABEL
+CRAN_repo='"http://cran-mirror.cs.uu.nl"'
 
-echo "Removing old files (if present)"
-rm -rf $PKG*
+# 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
+
+echo
+echo "--------------------------------------------------"
 echo "Checking out source code from SVN..."
+echo "--------------------------------------------------"
 svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/$PKG
+
+# 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