[Genabel-commits] r1754 - pkg/GenABEL-general/distrib_scripts
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 20 15:46:30 CEST 2014
Author: lckarssen
Date: 2014-06-20 15:46:30 +0200 (Fri, 20 Jun 2014)
New Revision: 1754
Added:
pkg/GenABEL-general/distrib_scripts/distrib_support_functions.sh
Modified:
pkg/GenABEL-general/distrib_scripts/makedistrib_MetABEL.sh
pkg/GenABEL-general/distrib_scripts/makedistrib_VariABEL.sh
Log:
Moved several pieces of code used in both the MetABEL and Variable distrib scripts to functions in a separate file for easier maintenance and fewer bugs.
Added: pkg/GenABEL-general/distrib_scripts/distrib_support_functions.sh
===================================================================
--- pkg/GenABEL-general/distrib_scripts/distrib_support_functions.sh (rev 0)
+++ pkg/GenABEL-general/distrib_scripts/distrib_support_functions.sh 2014-06-20 13:46:30 UTC (rev 1754)
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# This file contains several functions used by the make_distrib_*.sh
+# scripts in this directory.
+
+#######################################################################
+# This function sets several environment variables and takes care of
+# other initialisations of the build environment
+#######################################################################
+init_buildenv () {
+ CRAN_repo='"http://cran-mirror.cs.uu.nl"'
+ RCMD="R --vanilla CMD"
+
+ # Exit on errors
+ set -e
+
+}
+
+
+#######################################################################
+Install any missing dependencies
+#######################################################################
+install_deps () {
+ # 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
+}
+
+#######################################################################
+# Run the various checks and builds
+#######################################################################
+run_checks_build () {
+ errwarn=0
+ echo
+ echo "--------------------------------------------------"
+ echo "Running normal R checks..."
+ echo "--------------------------------------------------"
+ $RCMD 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 "--------------------------------------------------"
+ # Remove (shared) object files that were left over from
+ # running `R CMD check`
+ rm -rf $PKG/src/*.o
+ rm -rf $PKG/src/*.so
+
+ R 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 "--------------------------------------------------"
+ $RCMD 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
+ else
+ echo
+ echo "Successfully checked and built the $PKG package."
+ echo "Don't forget to increase the package version number if
+ you haven't already done so."
+ fi
+}
Modified: pkg/GenABEL-general/distrib_scripts/makedistrib_MetABEL.sh
===================================================================
--- pkg/GenABEL-general/distrib_scripts/makedistrib_MetABEL.sh 2014-06-20 12:51:42 UTC (rev 1753)
+++ pkg/GenABEL-general/distrib_scripts/makedistrib_MetABEL.sh 2014-06-20 13:46:30 UTC (rev 1754)
@@ -12,16 +12,14 @@
# time if you're expecting trouble)
PKG=MetABEL
-CRAN_repo='"http://cran-mirror.cs.uu.nl"'
-RCMD="R --vanilla CMD"
-# Exit on errors
-set -e
-
# Find the directory where this script (and others it depends on) are
# located
scriptdir=$(dirname $0)
+source $scriptdir/distrib_support_functions.sh
+init_buildenv
+
# Parse command line options
NOCHECKOUT=false
CRANCHECK=true
@@ -61,63 +59,5 @@
svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/$PKG
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
-
-
-errwarn=0
-echo
-echo "--------------------------------------------------"
-echo "Running normal R checks..."
-echo "--------------------------------------------------"
-$RCMD 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 "--------------------------------------------------"
- $RCMD 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 "--------------------------------------------------"
-$RCMD 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
+install_deps
+run_checks_build
Modified: pkg/GenABEL-general/distrib_scripts/makedistrib_VariABEL.sh
===================================================================
--- pkg/GenABEL-general/distrib_scripts/makedistrib_VariABEL.sh 2014-06-20 12:51:42 UTC (rev 1753)
+++ pkg/GenABEL-general/distrib_scripts/makedistrib_VariABEL.sh 2014-06-20 13:46:30 UTC (rev 1754)
@@ -12,16 +12,14 @@
# time if you're expecting trouble)
PKG=VariABEL
-CRAN_repo='"http://cran-mirror.cs.uu.nl"'
-RCMD="R --vanilla CMD"
-# Exit on errors
-set -e
-
# Find the directory where this script (and others it depends on) are
# located
scriptdir=$(dirname $0)
+source $scriptdir/distrib_support_functions.sh
+init_buildenv
+
# Parse command line options
NOCHECKOUT=false
CRANCHECK=true
@@ -84,63 +82,5 @@
cd ../..
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
-
-
-errwarn=0
-echo
-echo "--------------------------------------------------"
-echo "Running normal R checks..."
-echo "--------------------------------------------------"
-$RCMD 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 "--------------------------------------------------"
- $RCMD 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 "--------------------------------------------------"
-$RCMD 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
+install_deps
+run_checks_build
More information about the Genabel-commits
mailing list