Commit 9f60b35d authored by Julien Veyssier's avatar Julien Veyssier
Browse files

first add

parents
<?php
// base URL that prefixes start.php, view.php
$base_url = "http://my.server.org/r-package-checker/";
//$email_addr = "Emmanuel.Paradis@univ-montp2.fr";
$email_addr = "your@email.address";
// path to rtest bash script
$rtest_location = "/home/user/rcheck/rtest.sh";
// where you want to install packages
$rlib_location = "/home/user/Rlib_test";
// path to xvfb-run
$xvfbrun_location = "/home/user/xvfb-run";
// directory containing all results directories
$all_results_dir = "/home/user/rcheck_results/";
// name of the package to test
$package_to_test = "mypkg";
// repository to use to get last version of the package to test
$package_to_test_repo = "http://my.pkg.repo.org/";
// number of threads used for parallel checking
$nb_threads = 4;
?>
old <- getOption("defaultPackages"); r <- getOption("repos")
r["CRAN"] <- "http://cran.irsn.fr/"
options(defaultPackages = c(old, "MASS"), repos = r)
require("tools")
reverse_dependencies_with_maintainers <-
function(packages, which = c("Depends", "Imports", "LinkingTo"),
recursive = FALSE)
{
contrib.url(getOption("repos")["CRAN"], "source") # trigger chooseCRANmirror() if required
description <- sprintf("%s/web/packages/packages.rds",
getOption("repos")["CRAN"])
con <- if(substring(description, 1L, 7L) == "file://")
file(description, "rb")
else
url(description, "rb")
on.exit(close(con))
db <- readRDS(gzcon(con))
rownames(db) <- NULL
rdepends <- package_dependencies(packages, db, which,
recursive = recursive,
reverse = TRUE)
rdepends <- sort(unique(unlist(rdepends)))
pos <- match(rdepends, db[, "Package"], nomatch = 0L)
db[pos, c("Package", "Version", "Maintainer")]
}
Sys.setenv(http_proxy = "")
a <- reverse_dependencies_with_maintainers("ape", which = c("Depends", "Imports", "Suggests", "LinkingTo"))
a <- a[order(a[,1]),]
ff <- file("depends.txt", open = "w")
cat( paste(sep=",",a[,1],sub("\n","",a[,2]),sub("\n"," ",a[,3]), collapse = "\n"), "\n\n", file=ff)
close(ff)
This diff is collapsed.
<?php
include("config.php");
// si check en cours, proposer de l'arrêter, refuser d'en démarrer
// check en cours : ps aux | grep rtest.sh | grep -v grep | wc -l != 0
if ($_GET["action"] == "stop"){
$pid = exec("ps aux | grep rtest.sh | grep -v grep | grep -v 'vi rtest.sh' | awk '{print $2}'");
if ($pid != ""){
exec("kill -9 `ps aux | grep rtest.sh | grep -v grep | grep -v 'vi rtest.sh' | awk '{print $2}'`");
echo "I killed process $pid";
}
else{
echo "Nothing to kill.";
}
echo "<br/><br/>Would you like to <a href='".$base_url."start.php'>START A PROCESS</a> ?";
}
else{
$date_now = date('dmY\.his');
$nbli = exec("ps aux | grep rtest.sh | grep -v grep | grep -v 'vi rtest.sh' | wc -l");
if ($nbli === "0"){
echo shell_exec("nohup bash $rtest_location $package_to_test -r \"$package_to_test_repo\" -l $rlib_location -m $email_addr -u \"".$base_url."view.php?check=check_".$package_to_test."_".$date_now."\" -x $xvfbrun_location -n $nb_threads -d ".$all_results_dir."/check_".$package_to_test."_".$date_now." > ".$all_results_dir.$date_now.".log 2>&1 & echo $!");
echo "Process started<br/><br/>";
echo "nohup bash $rtest_location $package_to_test -r \"$package_to_test_repo\" -l $rlib_location -m $email_addr -u \"".$base_url."view.php?check=check_".$package_to_test."_".$date_now."\" -x $xvfbrun_location -n $nb_threads -d ".$all_results_dir."check_".$package_to_test."_".$date_now." > ".$all_results_dir.$date_now.".log 2>&1 & echo $! <br/><br/>";
echo " <a href='".$base_url."view.php?check=check_".$package_to_test."_$date_now'>VIEW REAL TIME RESULTS</a><br/><br/>";
echo " <a href='".$base_url."start.php?action=stop'>KILL THE PROCESS</a>";
}
else{
echo "PROCESS ALREADY RUNNING. <br/><br/><a href='".$base_url."start.php?action=stop'>KILL THE PROCESS</a><br/>";
}
}
?>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<style type="text/css">
tr { cursor: pointer; }
</style>
</head>
<body>
<?php
// param en get ID
// montrer dependencies, update.Rout
// faire un tableau jquery comme dans dnabushmeat avec les 00check.log
// colorier en rouge ceux qui ont échoué
include("config.php");
if (isset($_GET["check"])){
echo "<table width='100%'>";
$dir = $_GET["check"];
$nbli = exec("ps aux | grep rtest.sh | grep -v grep | grep -v 'vi rtest.sh' | grep \"$dir\" | wc -l");
//$nbli = exec("ps aux | grep rtest.sh | grep $dir | wc -l");
if ($nbli === "0"){
echo "Process is NOT RUNNING<br/>";
}
else{
echo "Process is RUNNING<br/>";
}
// Afficher l'isntall du package
//echo $all_results_dir.$dir."/install_pkg.Rout";
if (file_exists($all_results_dir.$dir."/install_pkg.Rout")){
if (file_exists($all_results_dir.$dir."/install_pkg_ok")){
$version = file_get_contents($all_results_dir.$dir."/pkg.version");
$status = "ok, version $version";
$color = "#4EE877";
}
else if(file_exists($all_results_dir.$dir."/install_pkg_problem")){
$status = "problem";
$color = "red";
}
else{
$status = "running";
$color = "yellow";
}
echo "<tr style='background-color:$color' class='title'><td>$package_to_test INSTALL PROCESS</td>";
echo "<td>$status</td></tr>";
echo "<tr class='retractable' id='update'><td colspan=3><textarea cols='240' rows='30'>".file_get_contents($all_results_dir.$dir."/install_pkg.Rout")."</textarea></td></tr>";
}
// Afficher l'update
//echo $all_results_dir.$dir."/update.Rout";
if (file_exists($all_results_dir.$dir."/update.Rout")){
if (file_exists($all_results_dir.$dir."/update_ok")){
$status = "ok";
$color = "#4EE877";
}
else if(file_exists($all_results_dir.$dir."/update_problem")){
$status = "problem";
$color = "red";
}
else{
$status = "running";
$color = "yellow";
}
echo "<tr style='background-color:$color' class='title'><td>UPDATE PROCESS</td>";
echo "<td>$status</td></tr>";
echo "<tr class='retractable' id='update'><td colspan=3><textarea cols='200' rows='30'>".file_get_contents($all_results_dir.$dir."/update.Rout")."</textarea></td></tr>";
}
// INSTALL
foreach(scandir($all_results_dir.$dir) as $elem){
// si c'est un package tar
if (strpos($elem,"_install.Rout") != False){
$package = explode("_",$elem);
$package_name = $package[0];
// si CHECKOK
if (file_exists($all_results_dir.$dir."/".$package_name."_install_ok")){
$status = "ok";
$color = "#4EE877";
}
// si CHECKPROBLEM
else if(file_exists($all_results_dir.$dir."/".$package_name."_install_problem")){
$status = "problem";
$color = "red";
}
else{
$status = "running";
$color = "yellow";
}
$log = file_get_contents($all_results_dir.$dir."/".$package_name."_install.Rout");
echo "<tr style='background-color:$color' class='title'><td>INSTALL $package_name</td>";
echo "<td>$status</td></tr>";
echo "<tr class='retractable' id='$package_name'><td colspan=3><textarea cols='200' rows='30'>$log</textarea></td></tr>";
}
}
// CHECK
foreach(scandir($all_results_dir.$dir) as $elem){
// si c'est un package tar
if (strpos($elem,".tar.gz") != False){
$package = explode("_",str_replace(".tar.gz","",$elem));
$package_name = $package[0];
$package_version = $package[1];
// si CHECKOK
if (file_exists($all_results_dir.$dir."/".$package_name.".CHECKOK")){
$status = "ok";
$color = "#4EE877";
}
// si CHECKPROBLEM
else if(file_exists($all_results_dir.$dir."/".$package_name.".CHECKPROBLEM")){
$status = "problem";
$color = "red";
}
else{
$status = "running";
$color = "yellow";
}
$log = file_get_contents($all_results_dir.$dir."/".$package_name.".Rcheck/00check.log");
echo "<tr style='background-color:$color' class='title'><td>CHECK $package_name V $package_version</td>";
echo "<td>$status</td></tr>";
echo "<tr class='retractable' id='$package_name'><td colspan=3><textarea cols='200' rows='30'>$log</textarea></td></tr>";
}
}
echo "</table>";
}
else{
# on montre les tests dispos
foreach(scandir($all_results_dir) as $elem){
// si c'est un dossier de check
if (strpos("a".$elem,"check_") != False){
echo "<a href='?check=$elem'>$elem</a><br/>";
}
}
}
?>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script>
$( document ).ready(function() {
jQuery.fn.putCursorAtEnd = function() {
return this.each(function() {
$(this).focus()
// If this function exists...
if (this.setSelectionRange) {
// ... then use it (Doesn't work in IE)
// Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh.
var len = $(this).val().length * 2;
this.setSelectionRange(len, len);
} else {
// ... otherwise replace the contents with itself
// (Doesn't work in Google Chrome)
$(this).val($(this).val());
}
// Scroll to the bottom, in case we're in a tall textarea
// (Necessary for Firefox and Google Chrome)
this.scrollTop = 999999;
});
};
$('.retractable').each(function(){
$(this).hide();
});
$('.title').each(function(){
$(this).click(function(){
if (! $(this).next().is(":visible")){
$(this).next().show();
$(this).next().find('textarea').putCursorAtEnd();
}
else{
$(this).next().hide();
}
});
});
$("html, body").animate({ scrollTop: $(document).height() }, "slow");
});
</script>
</body>
</html>
#!/bin/sh
# This script starts an instance of Xvfb, the "fake" X server, runs a command
# with that server available, and kills the X server when done. The return
# value of the command becomes the return value of this script, except in cases
# where this script encounters an error.
#
# If anyone is using this to build a Debian package, make sure the package
# Build-Depends on xvfb and xauth.
set -e
PROGNAME=xvfb-run
SERVERNUM=99
AUTHFILE=
ERRORFILE=/dev/null
XVFBARGS="-screen 0 640x480x24 -extension RANDR"
LISTENTCP="-nolisten tcp"
XAUTHPROTO=.
# Query the terminal to establish a default number of columns to use for
# displaying messages to the user. This is used only as a fallback in the event
# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the
# script is running, and this cannot, only being calculated once.)
DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
DEFCOLUMNS=80
fi
# Display a message, wrapping lines at the terminal width.
message () {
echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
}
# Display an error message.
error () {
message "error: $*" >&2
}
# Display a usage message.
usage () {
if [ -n "$*" ]; then
message "usage error: $*"
fi
cat <<EOF
Usage: $PROGNAME [OPTION ...] COMMAND
Run COMMAND (usually an X client) in a virtual X server environment.
Options:
-a --auto-servernum try to get a free server number, starting at
--server-num
-e FILE --error-file=FILE file used to store xauth errors and Xvfb
output (default: $ERRORFILE)
-f FILE --auth-file=FILE file used to store auth cookie
(default: ./.Xauthority)
-h --help display this usage message and exit
-n NUM --server-num=NUM server number to use (default: $SERVERNUM)
-l --listen-tcp enable TCP port listening in the X server
-p PROTO --xauth-protocol=PROTO X authority protocol name to use
(default: xauth command's default)
-s ARGS --server-args=ARGS arguments (other than server number and
"-nolisten tcp") to pass to the Xvfb server
(default: "$XVFBARGS")
EOF
}
# Find a free server number by looking at .X*-lock files in /tmp.
find_free_servernum() {
# Sadly, the "local" keyword is not POSIX. Leave the next line commented in
# the hope Debian Policy eventually changes to allow it in /bin/sh scripts
# anyway.
#local i
i=$SERVERNUM
while [ -f /tmp/.X$i-lock ]; do
i=$(($i + 1))
done
echo $i
}
# Clean up files
clean_up() {
if [ -e "$AUTHFILE" ]; then
XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >>"$ERRORFILE" 2>&1
fi
if [ -n "$XVFB_RUN_TMPDIR" ]; then
if ! rm -r "$XVFB_RUN_TMPDIR"; then
error "problem while cleaning up temporary directory"
exit 5
fi
fi
if [ -n "$XVFBPID" ]; then
kill "$XVFBPID" >>"$ERRORFILE" 2>&1
fi
}
# Parse the command line.
ARGS=$(getopt --options +ae:f:hn:lp:s:w: \
--long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
--name "$PROGNAME" -- "$@")
GETOPT_STATUS=$?
if [ $GETOPT_STATUS -ne 0 ]; then
error "internal error; getopt exited with status $GETOPT_STATUS"
exit 6
fi
eval set -- "$ARGS"
while :; do
case "$1" in
-a|--auto-servernum) SERVERNUM=$(find_free_servernum); AUTONUM="yes" ;;
-e|--error-file) ERRORFILE="$2"; shift ;;
-f|--auth-file) AUTHFILE="$2"; shift ;;
-h|--help) SHOWHELP="yes" ;;
-n|--server-num) SERVERNUM="$2"; shift ;;
-l|--listen-tcp) LISTENTCP="" ;;
-p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
-s|--server-args) XVFBARGS="$2"; shift ;;
-w|--wait) shift ;;
--) shift; break ;;
*) error "internal error; getopt permitted \"$1\" unexpectedly"
exit 6
;;
esac
shift
done
if [ "$SHOWHELP" ]; then
usage
exit 0
fi
if [ -z "$*" ]; then
usage "need a command to run" >&2
exit 2
fi
if ! which xauth >/dev/null; then
error "xauth command not found"
exit 3
fi
# tidy up after ourselves
trap clean_up EXIT
# If the user did not specify an X authorization file to use, set up a temporary
# directory to house one.
if [ -z "$AUTHFILE" ]; then
XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
# Create empty file to avoid xauth warning
AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
fi
# Start Xvfb.
MCOOKIE=$(mcookie)
tries=10
while [ $tries -gt 0 ]; do
tries=$(( $tries - 1 ))
XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
add :$SERVERNUM $XAUTHPROTO $MCOOKIE
EOF
# handle SIGUSR1 so Xvfb knows to send a signal when it's ready to accept
# connections
trap : USR1
(trap '' USR1; exec Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP -auth $AUTHFILE >>"$ERRORFILE" 2>&1) &
XVFBPID=$!
wait || :
if kill -0 $XVFBPID 2>/dev/null; then
break
elif [ -n "$AUTONUM" ]; then
# The display is in use so try another one (if '-a' was specified).
SERVERNUM=$((SERVERNUM + 1))
SERVERNUM=$(find_free_servernum)
continue
fi
error "Xvfb failed to start" >&2
XVFBPID=
exit 1
done
# Start the command and save its exit status.
set +e
DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
RETVAL=$?
set -e
# Return the executed command's exit status.
exit $RETVAL
# vim:set ai et sts=4 sw=4 tw=80:
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