Commit 420f7796 authored by julien veyssier's avatar julien veyssier
Browse files

add option to choose R binary path

parent 2e08bbe6
......@@ -209,7 +209,7 @@ function printUsage(){
echo "`basename $0` is a tool to test that a R package (PACKAGE_TO_TEST) does not break packages that depend on it by running 'R CMD check' for each of them.
usage :
$0 [-p|--package NAME_OF_PACKAGE_TO_TEST || -c|--checklist CHECKLIST_FILE || --checklistraw -t|--tarfolder TAR_FOLDER_PATH] [-l|--libuser R_USER_LIB_VALUE] [-d|--dest DESTINATION_DIRECTORY] [-m|--mail MAIL_TO] [-u|--urlresult URL] [-r|--repo PACKAGE_TO_TEST_REPO] [-x|--xvfb XVFB-RUN PATH] [-n|--nbcores NBCORES] [-s|--skipinstall] [-h|--html]
$0 [-p|--package NAME_OF_PACKAGE_TO_TEST || -c|--checklist CHECKLIST_FILE || --checklistraw -t|--tarfolder TAR_FOLDER_PATH] [-l|--libuser R_USER_LIB_VALUE] [-d|--dest DESTINATION_DIRECTORY] [-m|--mail MAIL_TO] [-u|--urlresult URL] [-r|--repo PACKAGE_TO_TEST_REPO] [-x|--xvfb XVFB-RUN PATH] [-n|--nbcores NBCORES] [-s|--skipinstall] [-h|--html] [--rpath PATH_TO_R_BINARY]
-p | --package NAME_OF_PACKAGE_TO_TEST : name of package to test (case sensible), all packages depending on this package are going to be checked by their R CMD CHECK
-c | --checklist CHECKLIST_FILE : file listing packages you want to check (each line should look like : PKG_NAME,PKG_VERSION,anything)
......@@ -226,13 +226,14 @@ $0 [-p|--package NAME_OF_PACKAGE_TO_TEST || -c|--checklist CHECKLIST_FILE || --c
-n | --nbcores NBCORES : Number of cores for parallel executions of installations (Ncpu parameter) and number of simultaneous checks (DEFAULT : 1)
-s | --skipinstall : flag to skip the packages update/installation
-h | --html : generate html report in DESTINATION_DIRECTORY/index.html . Will download jquery in destination directory
--rpath PATH_TO_R_BINARY : will use PATH_TO_R_BINARY to call R (default=R)
Don't forget to set JAVA_HOME if some dependencies need java, which is quite probable.
"
}
ARGS=$(getopt -o t:c:p:r:d:m:l:x:n:shu: --long tarfolder:,checklist:,checklistraw:,package:,repo:,mail:,libuser:,dest:,xvfb:,nbcores:,skipinstall,html,urlresult: -n "$0" -- "$@");
ARGS=$(getopt -o t:c:p:r:d:m:l:x:n:shu: --long rpath:,tarfolder:,checklist:,checklistraw:,package:,repo:,mail:,libuser:,dest:,xvfb:,nbcores:,skipinstall,html,urlresult: -n "$0" -- "$@");
#Bad arguments
if [ $? -ne 0 ] || [ $# -eq 0 ];
......@@ -250,6 +251,8 @@ NBCORES=1
SKIPINSTALLFLAG=0
HTMLFLAG=0
RESULTURLFLAG=0
R_LIBS_USER_FLAG=0
RPATH=R
eval set -- "$ARGS";
while true; do
......@@ -276,6 +279,19 @@ while true; do
fi
shift;
;;
--rpath)
shift;
if [ -n "$1" ]; then
RPATH=$1
else
echo "You have to set a non-empty R PATH
"
printUsage
exit
fi
shift;
;;
-l|--libuser)
shift;
if [ -n "$1" ]; then
......@@ -284,6 +300,7 @@ while true; do
echo "CREATING '$1' personnal R library"
fi
export R_LIBS_USER=$(readlink -f "$1")
R_LIBS_USER_FLAG=1
else
echo "You have to set a non-empty R LIB USER directory
......@@ -392,7 +409,7 @@ ff <- file("/tmp/Rversions.txt", open = "w")
cat( paste(sep=",",a[,1],sub("\n","",a[,2]),sub("\n"," ",a[,3]), collapse = "\n"), "\n", file=ff)
close(ff)
' > /tmp/getVersions.R
R CMD BATCH /tmp/getVersions.R > /dev/null 2>&1
$RPATH CMD BATCH /tmp/getVersions.R > /dev/null 2>&1
cat /tmp/Rversions.txt | sort -t , -k 1,1 > /tmp/join1
cat $CHECKLIST_RAW_FILE | sort -t , -k 1,1 > /tmp/join2
join /tmp/join1 /tmp/join2 -j 1 -t ',' > /tmp/list_with_versions.txt
......@@ -485,6 +502,12 @@ done
# shift
#done
if [ $DESTINATIONFLAG == 1 ]; then
RVERSION=`$RPATH --version | head -n 1 | awk '{print $3}'`
mkdir "$R_LIBS_USER/$RVERSION"
export R_LIBS_USER=$R_LIBS_USER/$RVERSION
fi
if ! [ -n "$PACKAGE_TO_TEST" ]; then
if ! [ -n "$CHECKLIST_FILE" ]; then
if ! [ -n "$TAR_FOLDER_PATH" ]; then
......@@ -657,7 +680,7 @@ if [ -n "$PACKAGE_TO_TEST" ]; then
cat( paste(sep=",",packageVersion("'$PACKAGE_TO_TEST'")), file=ff)
close(ff)
' > $DESTINATION/install_pkg.R
R CMD BATCH install_pkg.R
$RPATH CMD BATCH install_pkg.R
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
......@@ -674,7 +697,7 @@ if [ -n "$PACKAGE_TO_TEST" ]; then
############### GENERATION OF DEPENDENCY LIST ###################
printLeftPurple "Generating dependency list (should take less than a minute)... started at `date '+%H:%M:%S'` ... "
R CMD BATCH --no-timing depends.R
$RPATH CMD BATCH --no-timing depends.R
#cat depends.txt | grep -v structSSI | grep -v SigTree | grep -v SeqFeatR | grep -v gWidgetsRGtk2 | grep -v GrammR | grep -v RADami > list_dependencies.txt
cat depends.txt > list_dependencies.txt
printRightGreen "`date '+%H:%M:%S'` : OK"
......@@ -705,7 +728,7 @@ if [[ "$SKIPINSTALLFLAG" == "0" ]]; then
biocLite("supraHex", ask=FALSE, lib.loc=Sys.getenv("R_LIBS_USER"), suppressUpdates=TRUE)
install.packages("mpoly",lib=Sys.getenv("R_LIBS_USER"),repos="http://cran.irsn.fr/")
' > $DESTINATION/update.R
$XVFBRUN_PATH -n 222 R CMD BATCH --slave --vanilla --quiet update.R
$XVFBRUN_PATH -n 222 $RPATH CMD BATCH --slave --vanilla --quiet update.R
ret_upd=$?
non_zero=`grep -i "non-zero exit status" update.Rout | wc -l`
......@@ -750,9 +773,9 @@ Installing `wc -l $PACKAGES_TO_CHECK_LIST_FILE` packages in R_LIBS_USER (may be
}
' > ${pname}_install.R
$XVFBRUN_PATH -n 222 R CMD BATCH --slave --vanilla --quiet ${pname}_install.R
$XVFBRUN_PATH -n 222 $RPATH CMD BATCH --slave --vanilla --quiet ${pname}_install.R
# we do it twice to be sure...
$XVFBRUN_PATH -n 222 R CMD BATCH --slave --vanilla --quiet ${pname}_install.R
$XVFBRUN_PATH -n 222 $RPATH CMD BATCH --slave --vanilla --quiet ${pname}_install.R
ret=`grep -i "non-zero exit status|statut de sortie non nul" ${pname}_install.Rout | wc -l`
if [[ $ret == '0' ]]; then
touch ${pname}_install_ok
......@@ -784,9 +807,9 @@ Installing `ls $TAR_FOLDER_PATH | wc -l` packages in R_LIBS_USER (may be long if
}
' > ${pname}_install.R
$XVFBRUN_PATH -n 222 R CMD INSTALL -l "$R_LIBS_USER" $file > ${pname}_install.Rout 2>&1
$XVFBRUN_PATH -n 222 $RPATH CMD INSTALL -l "$R_LIBS_USER" $file > ${pname}_install.Rout 2>&1
# we do it twice to be sure...
$XVFBRUN_PATH -n 222 R CMD INSTALL -l "$R_LIBS_USER" $file > ${pname}_install.Rout 2>&1
$XVFBRUN_PATH -n 222 $RPATH CMD INSTALL -l "$R_LIBS_USER" $file > ${pname}_install.Rout 2>&1
ret=`grep -i "non-zero exit status|statut de sortie non nul" ${pname}_install.Rout | wc -l`
if [[ $ret == '0' ]]; then
touch ${pname}_install_ok
......@@ -821,7 +844,7 @@ if [[ $NBCORES == 1 ]]; then
printLeftPurple "R CMD check ${pname}_${pversion}.tar.gz ... started at `date '+%H:%M:%S'` ... "
wget $DEFAULT_REPOSITORY/src/contrib/${pname}_${pversion}.tar.gz > ${pname}_${pversion}_download.log 2>&1
$XVFBRUN_PATH -n $RANDOM R CMD check --no-manual --no-vignettes --no-build-vignettes -l "$R_LIBS_USER" ${pname}_${pversion}.tar.gz > /dev/null 2>&1
$XVFBRUN_PATH -n $RANDOM $RPATH CMD check --no-manual --no-vignettes --no-build-vignettes -l "$R_LIBS_USER" ${pname}_${pversion}.tar.gz > /dev/null 2>&1
if [[ $? == 0 ]]; then
touch ${pname}.CHECKOK
printRightGreen "`date '+%H:%M:%S'` : OK"
......@@ -842,7 +865,7 @@ if [[ $NBCORES == 1 ]]; then
pversion=`echo $file | cut -d '_' -f 2`
printLeftPurple "R CMD check ${pname}_${pversion} ... started at `date '+%H:%M:%S'` ... "
$XVFBRUN_PATH -n $RANDOM R CMD check --no-manual --no-vignettes --no-build-vignettes -l "$R_LIBS_USER" $file > /dev/null 2>&1
$XVFBRUN_PATH -n $RANDOM $RPATH CMD check --no-manual --no-vignettes --no-build-vignettes -l "$R_LIBS_USER" $file > /dev/null 2>&1
if [[ $? == 0 ]]; then
touch ${pname}.CHECKOK
printRightGreen "`date '+%H:%M:%S'` : OK"
......@@ -1000,13 +1023,13 @@ else
echo "R CMD check ${pname}_${pversion}.tar.gz ... STARTED on slot $j at `date '+%H:%M:%S'` ... "
wget $DEFAULT_REPOSITORY/src/contrib/${pname}_${pversion}.tar.gz > ${pname}_${pversion}_download.log 2>&1
$XVFBRUN_PATH -n $RANDOM R CMD check --no-manual --no-vignettes --no-build-vignettes -l "$DESTINATION/${pname}.rlib" ${pname}_${pversion}.tar.gz > /dev/null 2>&1 &
$XVFBRUN_PATH -n $RANDOM $RPATH CMD check --no-manual --no-vignettes --no-build-vignettes -l "$DESTINATION/${pname}.rlib" ${pname}_${pversion}.tar.gz > /dev/null 2>&1 &
p_pid[$j]=$!
else
pfile=${files[$ftc]}
echo "R CMD check $pfile ... STARTED on slot $j at `date '+%H:%M:%S'` ... "
echo "$XVFBRUN_PATH -n $RANDOM R CMD check --no-manual --no-vignettes --no-build-vignettes -l \"$DESTINATION/${pname}.rlib\" $pfile > /dev/null 2>&1 &"
$XVFBRUN_PATH -n $RANDOM R CMD check --no-manual --no-vignettes --no-build-vignettes -l "$DESTINATION/${pname}.rlib" $pfile > /dev/null 2>&1 &
echo "$XVFBRUN_PATH -n $RANDOM $RPATH CMD check --no-manual --no-vignettes --no-build-vignettes -l \"$DESTINATION/${pname}.rlib\" $pfile > /dev/null 2>&1 &"
$XVFBRUN_PATH -n $RANDOM $RPATH CMD check --no-manual --no-vignettes --no-build-vignettes -l "$DESTINATION/${pname}.rlib" $pfile > /dev/null 2>&1 &
p_pid[$j]=$!
p_pkgfile[$j]=$pfile
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment