Commit 2e08bbe6 authored by julien veyssier's avatar julien veyssier
Browse files

add ability to check from a simple list of package names (--checklistraw)

parent b1049c38
#!/bin/bash
DEFAULT_REPOSITORY="http://cran.irsn.fr/"
#DEFAULT_REPOSITORY="http://cran.irsn.fr/"
DEFAULT_REPOSITORY="http://cran.r-project.org/"
XVFBRUN_PATH=xvfb-run
if [ -z ${JAVA_HOME+x} ] || ! [ -d $JAVA_HOME ]; then
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
......@@ -208,10 +209,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 || -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]
-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)
--checklistraw RAW_CHECKLIST_FILE : file listing packages you want to check (simply one package name per line)
-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)
......@@ -230,7 +232,7 @@ Don't forget to set JAVA_HOME if some dependencies need java, which is quite pro
"
}
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" -- "$@");
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" -- "$@");
#Bad arguments
if [ $? -ne 0 ] || [ $# -eq 0 ];
......@@ -367,6 +369,44 @@ while true; do
fi
shift;
;;
--checklistraw)
shift;
if [ -n "$1" ]; then
CHECKLIST_RAW_FILE="$1"
MAIL_SUBJECT_BEGIN="List of packages \"$CHECKLIST_RAW_FILE\""
if ! [ -f $CHECKLIST_RAW_FILE ]; then
echo "List file $CHECKLIST_RAW_FILE not found...
"
exit
else
echo '
mytemp <- tempfile();
download.file("'$DEFAULT_REPOSITORY'web/packages/packages.rds", mytemp);
mydata <- as.data.frame(readRDS(mytemp), row.names=NA);
mydata$Published <- as.Date(mydata[["Published"]]);
#sort and get the fields you like:
a <- mydata[order(mydata$Package),c("Package", "Version", "Published")];
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
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
CHECKLIST_FILE="/tmp/list_with_versions.txt"
fi
else
echo "You have to set a non-empty CHECKLIST_RAW_FILE path
"
printUsage
exit
fi
shift;
;;
-t|--tarfolder)
shift;
if [ -n "$1" ]; then
......@@ -526,7 +566,7 @@ if [[ $MAILTOFLAG == 1 ]]; then
$RESULT_URL
Your test directory is named `basename $DESTINATION`
Your test directory is \"$DESTINATION\"
" | mail -s "$MAIL_SUBJECT_BEGIN R check started (`basename $DESTINATION`)" $MAILTO
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