[Genabel-commits] r2039 - pkg/GenABEL-general/distrib_scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 11 22:46:51 CET 2016


Author: lckarssen
Date: 2016-01-11 22:46:50 +0100 (Mon, 11 Jan 2016)
New Revision: 2039

Modified:
   pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.data.sh
Log:
Summary: Bring makedistrib_GenABEL.data.sh up to par with the other makedistrib.*.sh scripts
Now this script also uses the 'general framework' that I developed and already implemented for DatABEL, VariABEL and MetABEL.
This script accepts the following options to make package creation 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)
 -u|--user <username>: Use <username> when checking out from SVN.

So my normal workflow is to run:
- run ./makedistrib_GenABEL.data.sh -u <username> -c
- check if the regular checks work, make any necessary changes
- to test the changes run ./makedistrib_GenABEL.data.sh -u <username> -n 
- if all is ok, commit to SVN and
- run ./makedistrib_GenABEL.data.sh
- Submit the generated .tar.gz package to CRAN


Modified: pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.data.sh
===================================================================
--- pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.data.sh	2016-01-11 21:39:59 UTC (rev 2038)
+++ pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.data.sh	2016-01-11 21:46:50 UTC (rev 2039)
@@ -1,25 +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.
+#
+# Run this script in a separate directory. For final submission, run
+# do a clean run, without any options.
+#
+# 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)
+# -u|--user <username>: Use <username> when checking out from SVN.
 
-installation_dir="GenABEL.data_version_for_submission"
+PKG=GenABEL.data
 
+# Exit on errors and when encountering uninitialised variables
+set -e
+set -u
 
+# Find the directory where this script (and others it depends on) are
+# located
+scriptdir=$(dirname $0)
 
-echo Remove $installation_dir ...
-rm -rf $installation_dir
-echo
-echo Create $installation_dir...
-mkdir $installation_dir
-cd $installation_dir
+source $scriptdir/distrib_support_functions.sh
+init_buildenv
 
-echo
-echo Extract a package from r-forge...
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/GenABEL.data
+# Parse command line options
+NOCHECKOUT=false
+CRANCHECK=true
+SVNUSER=""
+while [ $# -gt 0 ]; do
+    case $1 in
+        -n | --nocheckout )
+            NOCHECKOUT=true
+            ;;
+        -c | --nocrancheck )
+            CRANCHECK=false
+            ;;
+        -u | --user )
+            shift
+            SVNUSER=${1:?Error: please specify SVN user name after the -u option}
+            echo "Using SVN user name $SVNUSER"
+            ;;
+        -* )
+            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}
+fi
+rm -rf ${PKG}.Rcheck
+rm -rf ${PKG}_*.tar.gz
 
-cd GenABEL.data
-rm -rf R
-rm -rf inst
-cd ..
+if [ $NOCHECKOUT == false ]; then
+    echo
+    echo "--------------------------------------------------"
+    echo "Checking out source code from SVN..."
+    echo "--------------------------------------------------"
+    if [ -z $SVNUSER ]; then
+        SVNCMD="svn export"
+        SVNBASE=svn://svn.r-forge.r-project.org/svnroot/genabel/
+    else
+        SVNCMD="svn checkout"
+        SVNBASE=svn+ssh://${SVNUSER}@svn.r-forge.r-project.org/svnroot/genabel/
+    fi
 
-R CMD check --as-cran GenABEL.data
-R CMD build GenABEL.data
+    $SVNCMD $SVNBASE/pkg/${PKG}
+fi
+
+install_deps
+run_checks_build



More information about the Genabel-commits mailing list