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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 19 00:38:34 CET 2016


Author: lckarssen
Date: 2016-01-19 00:38:34 +0100 (Tue, 19 Jan 2016)
New Revision: 2044

Modified:
   pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.sh
Log:
Bring the makedistrib_GenABEL.sh script in line with the other makedistrib scripts.


Modified: pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.sh
===================================================================
--- pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.sh	2016-01-18 23:36:48 UTC (rev 2043)
+++ pkg/GenABEL-general/distrib_scripts/makedistrib_GenABEL.sh	2016-01-18 23:38:34 UTC (rev 2044)
@@ -1,159 +1,147 @@
 #!/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.
+# -t|--notutorial: don't build the tutorial
 
-# Exit this script on errors and undefined variables
+PKG=GenABEL
+
+# Exit this script on error
 set -e
 set -u
 
-installation_dir="GenABEL_version_for_submission"
+# 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
+SVNUSER=""
+TUTORIAL=true
+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"
+            ;;
+        -t | --notutorial )
+            TUTORIAL=false
+            ;;
+        -* )
+            echo "$0: invalid option $1" >&2
+            exit 1
+            ;;
+        *)
+            break
+            ;;
+    esac
+    shift
+done
 
-echo Remove GenABEL_version_for_submission...
-rm -rf $installation_dir
-echo
-echo Create GenABEL_version_for_submission...
-mkdir $installation_dir
-cd $installation_dir
+echo "--------------------------------------------------"
+echo "Removing old files and directories (if present)"
+echo "--------------------------------------------------"
+if [ ${NOCHECKOUT} == false ]; then
+    rm -rf $PKG
+fi
+rm -rf ${PKG}.Rcheck
+rm -f ${PKG}_*.tar.gz
+rm -rf DatABEL
+rm -rf filevector
 
-echo
-echo "Extract packages from r-forge..."
-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/MetABEL
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/MixABEL
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/GenABEL.data
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/pkg/GenABEL
-svn export svn://svn.r-forge.r-project.org/svnroot/genabel/tutorials/GenABEL_general
 
-echo "Downloading packages from Github..."
-GITBASE=https://github.com/GenABEL-Project
-git clone $GITBASE/filevector.git
-git clone $GITBASE/ProbABEL.git
+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
 
+    GITBASE=https://github.com/GenABEL-Project
+    git clone ${GITBASE}/filevector.git
+    ${SVNCMD} ${SVNBASE}/pkg/DatABEL
+    ${SVNCMD} ${SVNBASE}/pkg/${PKG}
 
-echo
-echo Install the freshest R packages from CRAN and Bioconductor repositories...
+    echo
+    echo "--------------------------------------------------"
+    echo "Cleaning up and putting files in the correct"
+    echo "location before starting checks"
+    echo "--------------------------------------------------"
+    # clean up the dev-version for distrib
+    cd ${PKG}
+    rm -f cleanup* configure* *.R
+    rm -f src/*.o
 
-CRAN_repo="\"http://cran.xl-mirror.nl\""
+    cd src
+    cp DAlib/*.c* .
+    cp DAlib/*.h* .
+    cp ITERlib/*.c* .
+    cp ITERlib/*.h* .
+    cp fvlib/*.c* .
+    cp fvlib/*.h* .
+    cp GAlib/*.c* .
+    cp GAlib/*.h* .
+    rm -rf DAlib
+    rm -rf fvlib
+    rm -rf ITERlib
+    rm -rf GAlib
+    rm -f ${PKG}/src/*.so
+    rm -f ${PKG}/src/*.o
+    mv Makevars_distrib Makevars
+    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_USER=/tmp/Rlibs-GenABEL-build
-mkdir -p ${R_LIBS_USER}
+if [ ${TUTORIAL} == true ]; then
+    TUTDIR=GenABEL_general
+    TUTFILE=${TUTDIR}/GenABEL-tutorial.pdf
+    TUTDEST=${PKG}/inst/doc
+    echo
+    echo "--------------------------------------------------"
+    echo "Building the GenABEL tutorial for inclusion in the package dir..."
+    echo "--------------------------------------------------"
+    ${scriptdir}/makedistrib_GenABEL-tutorial.sh --noremove
 
-R --vanilla --no-save <<EOF
-install.packages("roxygen2", repos=$CRAN_repo)
-install.packages("mvtnorm", repos=$CRAN_repo)
-install.packages("methods", repos=$CRAN_repo)
-install.packages("MASS", repos=$CRAN_repo)
-install.packages("utils", repos=$CRAN_repo)
+    echo
+    echo "Tutorial built, integrating it in the ${TUTDEST} directory..."
 
-source("http://bioconductor.org/biocLite.R")
-biocLite("qvalue")
-
-install.packages("genetics", repos=$CRAN_repo)
-install.packages("haplo.stats", repos=$CRAN_repo)
-install.packages("hglm", repos=$CRAN_repo)
-install.packages("PredictABEL", repos=$CRAN_repo)
-install.packages("VariABEL", repos=$CRAN_repo)
-install.packages("bigRR", repos=$CRAN_repo)
-EOF
-
-
-
-echo
-echo Build and install packages...
-
-R CMD build DatABEL
-R CMD INSTALL DatABEL_*tar.gz
-
-R CMD build MetABEL
-R CMD INSTALL MetABEL_*tar.gz
-
-
-cd ProbABEL
-autoreconf -i
-./configure --without-eigen
-make
-cd ..
-
-probabel_src_location="$(pwd)/ProbABEL/src"
-PATH="$PATH:$probabel_src_location"
-echo Search ProbABEL executive files in $probabel_src_location
-
-
-cd GenABEL.data
-rm -rf inst R
-cd ../
-R CMD check --as-cran GenABEL.data
-R CMD build GenABEL.data
-R CMD INSTALL GenABEL.data_*tar.gz
-
-
-
-echo
-echo Build, check and install GenABEL...
-# clean up the dev-version for distrib
-cd GenABEL
-rm -rf cleanup* configure* *.R
-cd src
-cp DAlib/*.c* .
-cp DAlib/*.h* .
-cp ITERlib/*.c* .
-cp ITERlib/*.h* .
-cp fvlib/*.c* .
-cp fvlib/*.h* .
-cp GAlib/*.c* .
-cp GAlib/*.h* .
-rm -rf DAlib
-rm -rf fvlib
-rm -rf ITERlib
-rm -rf GAlib
-mv Makevars_distrib Makevars
-cd ..
-rm tests/doRUnit.R
-cd ..
-# end cleanup
-
-#R CMD check --as-cran GenABEL
-R CMD build GenABEL
-R CMD INSTALL GenABEL_*tar.gz
-
-
-
-
-R CMD build MixABEL
-R CMD INSTALL MixABEL_*tar.gz
-
-
-echo
-echo Build the tutorial...
-# build the tutorial
-cd GenABEL_general
-make
-cd ..
-
-if [ -f GenABEL_general/GenABEL-tutorial.pdf ];
-then
-#echo Compressing GenABEL_general/GenABEL-tutorial.pdf...
-#gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=GenABEL_general/GenABEL-tutorial.pdf_compressed GenABEL_general/GenABEL-tutorial.pdf
-#echo Copying GenABEL_general/GenABEL-tutorial.pdf in GenABEL/inst/doc/...
-cp GenABEL_general/GenABEL-tutorial.pdf GenABEL/inst/doc/
-echo Building the GenABEL...
-R CMD check --as-cran GenABEL
-R CMD build GenABEL
-mkdir GenABEL_DISTRIBUTIVE_IS_HERE
-cp GenABEL_*tar.gz GenABEL_DISTRIBUTIVE_IS_HERE
-echo "The distributive of GenABEL is in $installation_dir/GenABEL_DISTRIBUTIVE_IS_HERE directory. Check out that there were no errors/warnings during running this script."
-echo "GenABEL building DONE!"
-else
-  echo "ERROR: File GenABEL_general/GenABEL-tutorial.pdf does not exist. It should have been generated after runing a make command in the GenABEL_general directory. Something did not work out."
-  echo "Making GenABEL_general/GenABEL-tutorial.pdf was the last step in building GenABEL. Figure out what has happned, create GenABEL_general/GenABEL-tutorial.pdf by running the command make in the GenABEL_general dir, copy it in GenABEL/inst/doc/ and run R CMD build GenABEL."
+    if [ -f ${TUTFILE} ]; then
+        #echo Compressing GenABEL_general/GenABEL-tutorial.pdf...
+        #gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=GenABEL_general/GenABEL-tutorial.pdf_compressed GenABEL_general/GenABEL-tutorial.pdf
+        #echo Copying GenABEL_general/GenABEL-tutorial.pdf in GenABEL/inst/doc/...
+        cp ${TUTFILE} ${TUTDEST}
+    else
+        echo "ERROR: File ${TUTFILE} does not exist. It should have been generated in the ${TUTDIR} directory." 1>&2
+    fi
 fi
 
-
-
-# end build the tutorial
-
-
-# and do not forget to run R CMD check --as-cran!
+install_deps
+run_checks_build



More information about the Genabel-commits mailing list