Commit b1049c38 authored by julien veyssier's avatar julien veyssier
Browse files

to be tested again : add -t option to give a folder containing tarballs to check

parent 4ee08501
......@@ -92,6 +92,7 @@ function generate_html_report(){
# CHECK, for all the downloaded archives
if [[ "`ls $dir | grep ".tar.gz" | wc -l`" != "0" ]]; then
for elem in `ls $dir/*.tar.gz`; do
local baselem=`basename $elem`
local baselem=${baselem/.tar.gz/}
# split string into array
......@@ -100,26 +101,28 @@ function generate_html_report(){
local package_name=${package[0]}
local package_version=${package[1]}
# si CHECKOK
if [ -f $dir"/"$package_name".CHECKOK" ]; then
local status="ok"
local color="#4EE877"
# si CHECKPROBLEM
else
if [ -f $dir"/"$package_name".CHECKPROBLEM" ]; then
local status="problem"
local color="red"
else
local status="running"
local color="yellow"
if [ -d $dir"/"$package_name".Rcheck/" ]; then
# si CHECKOK
if [ -f $dir"/"$package_name".CHECKOK" ]; then
local status="ok"
local color="#4EE877"
# si CHECKPROBLEM
else
if [ -f $dir"/"$package_name".CHECKPROBLEM" ]; then
local status="problem"
local color="red"
else
local status="running"
local color="yellow"
fi
fi
fi
local log=`cat $dir"/"$package_name".Rcheck/00check.log"`
local nlines=`cat $dir"/"$package_name".Rcheck/00check.log" | wc -l`
echo "<tr style='background-color:$color' class='title'><td>CHECK $package_name V $package_version</td>" >> $dest_html
echo "<td>$status ($nlines lines)</td></tr>" >> $dest_html
echo "<tr class='retractable' id='$package_name'><td colspan=3><textarea cols='200' rows='30'>$log</textarea></td></tr>" >> $dest_html
local log=`cat $dir"/"$package_name".Rcheck/00check.log"`
local nlines=`cat $dir"/"$package_name".Rcheck/00check.log" | wc -l`
echo "<tr style='background-color:$color' class='title'><td>CHECK $package_name V $package_version</td>" >> $dest_html
echo "<td>$status ($nlines lines)</td></tr>" >> $dest_html
echo "<tr class='retractable' id='$package_name'><td colspan=3><textarea cols='200' rows='30'>$log</textarea></td></tr>" >> $dest_html
fi
done
fi
......@@ -205,10 +208,11 @@ 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] [-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 || -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]
-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)
-t | --tarfolder TAR_FOLDER_PATH : path to folder where tarballs of packages can be found. All of these packages are going to be \"R CMD CHECKED\"
-r | --repo PACKAGE_TO_TEST_REPO : repository of package you want to test (DEFAULT : R-CRAN)
-l | --libuser R_LIBS_USER : directory where packages depending on PACKAGE_TO_TEST are going to be installed (DEFAULT : R will choose it)
This directory can be used several times for several tests. Using same directory several times will save time.
......@@ -226,7 +230,7 @@ Don't forget to set JAVA_HOME if some dependencies need java, which is quite pro
"
}
ARGS=$(getopt -o c:p:r:d:m:l:x:n:shu: -l "checklist: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: -l "tarfolder:checklist:package:repo:mail:libuser:dest:xvfb:nbcores:skipinstall,html,urlresult:" -n "$0" -- "$@");
#Bad arguments
if [ $? -ne 0 ] || [ $# -eq 0 ];
......@@ -239,6 +243,7 @@ MAILTOFLAG=0
DESTINATIONFLAG=0
PACKAGE_TO_TEST=""
CHECKLIST_FILE=""
TAR_FOLDER_PATH=""
NBCORES=1
SKIPINSTALLFLAG=0
HTMLFLAG=0
......@@ -362,6 +367,26 @@ while true; do
fi
shift;
;;
-t|--tarfolder)
shift;
if [ -n "$1" ]; then
TAR_FOLDER_PATH="$1"
MAIL_SUBJECT_BEGIN="Folder of packages \"$TAR_FOLDER_PATH\""
if ! [ -d $TAR_FOLDER_PATH ]; then
echo "Folder $TAR_FOLDER_PATH not found...
"
exit
fi
else
echo "You have to set a non-empty TAR_FOLDER_PATH path
"
printUsage
exit
fi
shift;
;;
-x|--xvfb)
shift;
if [ -n "$1" ]; then
......@@ -422,21 +447,27 @@ done
if ! [ -n "$PACKAGE_TO_TEST" ]; then
if ! [ -n "$CHECKLIST_FILE" ]; then
echo "
There must be a package to test OR a CHECKLIST_FILE.
if ! [ -n "$TAR_FOLDER_PATH" ]; then
echo "
There must be a package to test OR a CHECKLIST_FILE OR a TAR_FOLDER_PATH.
"
exit
At least -p or -c or -t option must be set.
"
exit
fi
fi
else
if [ -n "$CHECKLIST_FILE" ]; then
echo "
fi
if ([ -n "$CHECKLIST_FILE" ] && [ -n "$TAR_FOLDER_PATH" ]) ||
([ -n "$CHECKLIST_FILE" ] && [ -n "$PACKAGE_TO_TEST" ]) ||
([ -n "$PACKAGE_TO_TEST" ] && [ -n "$TAR_FOLDER_PATH" ]); then
echo "
There must choose between testing a specific package (R CMD CHECK on all packages depending on it) OR checking a given list of packages.
In other words : choose between -p and -c option
In other words : choose between -p and -c and -t option.
"
exit
fi
exit
fi
#### DEFAULT VALUES management
......@@ -453,7 +484,11 @@ fi
if [ -n "$PACKAGE_TO_TEST" ]; then
echo "PACKAGE TO TEST : $PACKAGE_TO_TEST . Last version of $PACKAGE_TO_TEST and all packages depending on $PACKAGE_TO_TEST will be installed and checked"
else
echo "LIST OF PACKAGES TO INSTALL AND CHECK : $CHECKLIST_FILE"
if [ -n "$CHECKLIST_FILE" ]; then
echo "LIST OF PACKAGES TO INSTALL AND CHECK : $CHECKLIST_FILE"
else
echo "FOLDER OF PACKAGES TO INSTALL AND CHECK : $TAR_FOLDER_PATH"
fi
fi
if [ -n "$R_LIBS_USER" ]; then
echo "R_LIBS_USER : $R_LIBS_USER"
......@@ -501,6 +536,11 @@ fi
# Destination directory creation
mkdir $DESTINATION
cd $DESTINATION
if [ -n "$TAR_FOLDER_PATH" ]; then
for i in $TAR_FOLDER_PATH/*; do
cp $i ./
done
fi
if [[ $HTMLFLAG == 1 ]]; then
echo "Downloading jquery inside result folder..."
......@@ -647,42 +687,80 @@ fi
if [ -n "$PACKAGE_TO_TEST" ]; then
PACKAGES_TO_CHECK_LIST_FILE="list_dependencies.txt"
else
cp $CHECKLIST_FILE ./list_packages_to_check.txt
PACKAGES_TO_CHECK_LIST_FILE=$CHECKLIST_FILE
if [ -n "$CHECKLIST_FILE" ]; then
cp $CHECKLIST_FILE ./list_packages_to_check.txt
PACKAGES_TO_CHECK_LIST_FILE=$CHECKLIST_FILE
fi
fi
if [[ "$SKIPINSTALLFLAG" == "0" ]]; then
echo "
Installing `wc -l $PACKAGES_TO_CHECK_LIST_FILE` packages in R_LIBS_USER (may be long if launched for the first time in this R_LIBS_USER)
"
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
printLeftPurple "Installing $pname v $pversion ... started at `date '+%H:%M:%S'` ... "
# local install
echo 'chooseBioCmirror(ind=3)
setRepositories(ind=c(1, 2, 5, 6))
if (!"'$pname'" %in% installed.packages(lib.loc=Sys.getenv("R_LIBS_USER"))) {
install.packages("'$pname'",repos=c("'$DEFAULT_REPOSITORY'"), lib=Sys.getenv("R_LIBS_USER"), dependencies=c("Depends", "Imports", "LinkingTo", "Suggests"), Ncpus='$NBCORES')
}
' > ${pname}_install.R
$XVFBRUN_PATH -n 222 R 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
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
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}_install_problem
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [ -n "$PACKAGE_TO_TEST" ] || [ -n "$CHECKLIST_FILE" ]; then
echo "
Installing `wc -l $PACKAGES_TO_CHECK_LIST_FILE` packages in R_LIBS_USER (may be long if launched for the first time in this R_LIBS_USER)
"
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
printLeftPurple "Installing $pname v $pversion ... started at `date '+%H:%M:%S'` ... "
# local install
echo 'chooseBioCmirror(ind=3)
setRepositories(ind=c(1, 2, 5, 6))
if (!"'$pname'" %in% installed.packages(lib.loc=Sys.getenv("R_LIBS_USER"))) {
install.packages("'$pname'",repos=c("'$DEFAULT_REPOSITORY'"), lib=Sys.getenv("R_LIBS_USER"), dependencies=c("Depends", "Imports", "LinkingTo", "Suggests"), Ncpus='$NBCORES')
}
' > ${pname}_install.R
$XVFBRUN_PATH -n 222 R 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
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
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}_install_problem
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done < $PACKAGES_TO_CHECK_LIST_FILE
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done < $PACKAGES_TO_CHECK_LIST_FILE
else
######## we have a TAR_FOLDER_PATH ###########
echo "
Installing `ls $TAR_FOLDER_PATH | wc -l` packages in R_LIBS_USER (may be long if launched for the first time in this R_LIBS_USER)
"
for i in $TAR_FOLDER_PATH/*; do
file=`basename $i`
pname=`echo $file | cut -d '_' -f 1`
pversion=`echo $file | cut -d '_' -f 2`
printLeftPurple "Installing $pname v $pversion ... started at `date '+%H:%M:%S'` ... "
# local install
echo 'chooseBioCmirror(ind=3)
setRepositories(ind=c(1, 2, 5, 6))
if (!"'$pname'" %in% installed.packages(lib.loc=Sys.getenv("R_LIBS_USER"))) {
install.packages("'$pname'",repos=c("'$DEFAULT_REPOSITORY'"), lib=Sys.getenv("R_LIBS_USER"), dependencies=c("Depends", "Imports", "LinkingTo", "Suggests"), Ncpus='$NBCORES')
}
' > ${pname}_install.R
$XVFBRUN_PATH -n 222 R 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
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
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}_install_problem
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done
fi
fi
###################### R CMD check #############################
......@@ -696,25 +774,48 @@ export _R_CHECK_FORCE_SUGGESTS_=FALSE
# SIMPLE CORE PROCESSING
if [[ $NBCORES == 1 ]]; then
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
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
if [[ $? == 0 ]]; then
touch ${pname}.CHECKOK
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}.CHECKPROBLEM
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [ -n "$PACKAGE_TO_TEST" ] || [ -n "$CHECKLIST_FILE" ]; then
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
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
if [[ $? == 0 ]]; then
touch ${pname}.CHECKOK
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}.CHECKPROBLEM
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done < $PACKAGES_TO_CHECK_LIST_FILE
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done < $PACKAGES_TO_CHECK_LIST_FILE
else
# TAR_FOLDER_PATH
for i in $TAR_FOLDER_PATH/*; do
file=`basename $i`
pname=`echo $file | cut -d '_' -f 1`
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
if [[ $? == 0 ]]; then
touch ${pname}.CHECKOK
printRightGreen "`date '+%H:%M:%S'` : OK"
else
touch ${pname}.CHECKPROBLEM
printRightRed "`date '+%H:%M:%S'` : FAILED"
fi
if [[ $HTMLFLAG == 1 ]]; then
generate_html_report $DESTINATION
fi
done
fi
else
# MULTICORE PROCESSING
......@@ -780,14 +881,28 @@ else
# INITIALISATION of variables
i=0
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
names[$i]=$pname
versions[$i]=$pversion
status[$i]="tocheck"
let "i = $i + 1"
done < $PACKAGES_TO_CHECK_LIST_FILE
if [ -n "$PACKAGE_TO_TEST" ] || [ -n "$CHECKLIST_FILE" ]; then
while read line; do
pname=`echo $line | cut -d ',' -f 1`
pversion=`echo $line | cut -d ',' -f 2`
names[$i]=$pname
versions[$i]=$pversion
status[$i]="tocheck"
let "i = $i + 1"
done < $PACKAGES_TO_CHECK_LIST_FILE
else
# TAR_FOLDER_PATH
for j in $TAR_FOLDER_PATH/*; do
file=`basename $j`
pname=`echo $file | cut -d '_' -f 1`
pversion=`echo $file | cut -d '_' -f 2`
names[$i]=$pname
versions[$i]=$pversion
files[$i]=$file
status[$i]="tocheck"
let "i = $i + 1"
done
fi
NB_PKG=$i
echo "Number of packages : $NB_PKG"
echo
......@@ -796,6 +911,7 @@ else
p_pid[$i]=0
p_pkgname[$i]=0
p_pkgversion[$i]=0
p_pkgfile[$i]=0
done
## CHECK LOOP
......@@ -838,12 +954,22 @@ else
status[$ftc]="running"
pname=${names[$ftc]}
pversion=${versions[$ftc]}
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
mkdir $DESTINATION/${pname}.rlib
$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 &
p_pid[$j]=$!
if [ -n "$PACKAGE_TO_TEST" ] || [ -n "$CHECKLIST_FILE" ]; then
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 &
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 &
p_pid[$j]=$!
p_pkgfile[$j]=$pfile
fi
p_num[$j]=$ftc
p_pkgname[$j]=$pname
p_pkgversion[$j]=$pversion
......
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