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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 23 22:35:25 CET 2014


Author: lckarssen
Date: 2014-02-23 22:35:24 +0100 (Sun, 23 Feb 2014)
New Revision: 1619

Modified:
   pkg/GenABEL-general/scripts/makedistrib_DatABEL.sh
Log:
Merged many of the changes in the makedistrib_MetABEL.sh script into makedistrib_DatABEL. So this script is now more verbose and has two options that make the life of the person uploading the package to CRAN easier:
 -n|--nocheckout: the previously checked out source code will not be
   deleted and no SVN checkout will be done. This is handy when trying
   out some of your local changes.
 -c|--nocrancheck: don't run R CMD check --as-cran (can save some
   time if you're expecting trouble)


Modified: pkg/GenABEL-general/scripts/makedistrib_DatABEL.sh
===================================================================
--- pkg/GenABEL-general/scripts/makedistrib_DatABEL.sh	2014-02-18 17:33:21 UTC (rev 1618)
+++ pkg/GenABEL-general/scripts/makedistrib_DatABEL.sh	2014-02-23 21:35:24 UTC (rev 1619)
@@ -4,17 +4,93 @@
 # without errors or warnings
 #
 # Run this script in a separate directory.
+#
+# Command line options:
+# -n|--nocheckout: the previously checked out source code will not be
+#   deleted and no SVN checkout will be done. This is handy when trying
+#   out some of your local changes.
+# -c|--nocrancheck: don't run R CMD check --as-cran (can save some
+#   time if you're expecting trouble)
 
-echo "Cleaning up..."
-rm -rf DatABEL*
-rm -rf filevector*
+PKG=DatABEL
+CRAN_repo='"http://cran-mirror.cs.uu.nl"'
 
-echo "Getting files..."
-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/filevector
+# Exit on errors
+set -e
 
+# Find the directory where this script (and others it depends on) are
+# located
+scriptdir=$(dirname $0)
+
+# Parse command line options
+NOCHECKOUT=false
+CRANCHECK=true
+while [ $# -gt 0 ]; do
+    case $1 in
+        -n | --nocheckout )
+            NOCHECKOUT=true
+            ;;
+        -c | --nocrancheck )
+            CRANCHECK=false
+            ;;
+        -* )
+            echo "$0: invalid option $1" >&2
+            exit 1
+            ;;
+        *)
+            break
+            ;;
+    esac
+    shift
+done
+
+echo "--------------------------------------------------"
+echo "Removing old files and directories (if present)"
+echo "--------------------------------------------------"
+if [ $NOCHECKOUT == false ]; then
+    rm -rf $PKG
+    rm -rf filevector
+fi
+rm -rf $PKG.Rcheck
+rm -rf $PKG_*.tar.gz
+
+if [ $NOCHECKOUT == false ]; then
+    echo
+    echo "--------------------------------------------------"
+    echo "Checking out source code from SVN..."
+    echo "--------------------------------------------------"
+    SVNBASE=svn://svn.r-forge.r-project.org/svnroot/genabel/
+    svn export $SVNBASE/pkg/$PKG
+    svn export $SVNBASE/pkg/filevector
+fi
+
+# 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
+
+
 cd DatABEL
-rm cleanup* configure* *.R
+rm -f cleanup* configure* *.R
 VERSION=`grep Version DESCRIPTION | cut -d" " -f2`
 cd src
 cp DAlib/*.c* .
@@ -31,7 +107,39 @@
 rm -rf tests
 cd ..
 
-echo "Building the DatABEL_${VERSION}.tar.gz package..."
-R CMD build DatABEL
-echo "Checking DatABEL_${VERSION}.tar.gz"
-R CMD check --as-cran DatABEL_${VERSION}.tar.gz
+
+errwarn=0
+echo
+echo "--------------------------------------------------"
+echo "Running normal R checks..."
+echo "--------------------------------------------------"
+R --vanilla CMD check $PKG
+if grep -qE "NOTE|WARNING|ERROR" $PKG.Rcheck/00check.log; then
+    errwarn=1
+fi
+
+if [ $CRANCHECK == true ]; then
+    echo
+    echo "--------------------------------------------------"
+    echo "Check with --as-cran..."
+    echo "--------------------------------------------------"
+    R --vanilla CMD check --as-cran $PKG
+    if sed -e 's/feasibility ... WARNING/feasibility ... WRNNG/' \
+        -e 's/^WARNING/WRNNG/' $PKG.Rcheck/00check.log | \
+        grep -qE "NOTE|WARNING|ERROR"; then
+        errwarn=1
+    fi
+fi
+
+echo
+echo "--------------------------------------------------"
+echo "Building the package for distribution..."
+echo "--------------------------------------------------"
+R --vanilla 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