From 054cd0c84099f25378ee5f96648f5f0f84148d30 Mon Sep 17 00:00:00 2001 From: blundellc Date: Sun, 13 Sep 2009 16:30:04 +0000 Subject: [PATCH] generate cran2deb status web pages git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@276 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- trunk/R/db.R | 45 +++++++++++++++++++++++++++++++++++++++++++++ trunk/exec/web | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100755 trunk/exec/web diff --git a/trunk/R/db.R b/trunk/R/db.R index 9b60d5b..75c658c 100644 --- a/trunk/R/db.R +++ b/trunk/R/db.R @@ -420,3 +420,48 @@ db_blacklist_packages <- function() { db_stop(con) return(packages) } + +db_blacklist_reasons <- function () { + con <- db_start() + packages <- dbGetQuery(con,'SELECT package,explanation from blacklist_packages') + db_stop(con) + return(packages) +} + +db_todays_builds <- function() { + today <- db_quote(format(Sys.time(), db_date_format)) + con <- db_start() + builds <- dbGetQuery(con,paste('select id,success,system,package, + r_version as version,deb_epoch as epo, + deb_revision as rev, scm_revision as svnrev, + db_version as db,date_stamp,time_stamp + from builds where date_stamp = ',today)) + db_stop(con) + return(builds) +} + +db_successful_builds <- function() { + con <- db_start() + builds <- dbGetQuery(con,'select system,package,r_version,date_stamp,time_stamp + from builds natural join (select system,package,max(id) as id + from builds + where package not in + (select package from blacklist_packages) + group by package,system) + where success = 1') + db_stop(con) + return(builds) +} + +db_failed_builds <- function() { + con <- db_start() + builds <- dbGetQuery(con,'select system,package,r_version,date_stamp,time_stamp + from builds natural join (select system,package,max(id) as id + from builds + where package not in + (select package from blacklist_packages) + group by package,system) + where success = 0') + db_stop(con) + return(builds) +} diff --git a/trunk/exec/web b/trunk/exec/web new file mode 100755 index 0000000..4c3b0a9 --- /dev/null +++ b/trunk/exec/web @@ -0,0 +1,38 @@ +#!/usr/bin/env r +## DOC: cran2deb web +## DOC: generate cran2deb status web pages +## DOC: + +suppressPackageStartupMessages(library(cran2deb)) +library(hwriter) + +banned_builds_path='/var/www/banned_packages.html' +todays_builds_path='/var/www/todays_packages.html' +latest_builds_path='/var/www/latest_packages.html' +failed_builds_path='/var/www/failed_packages.html' + +links <- function(p) { + hwrite(c( + hwrite('Packages built today',link='/todays_packages.html') + ,hwrite('Successful packages',link='/latest_packages.html') + ,hwrite('Failed packages',link='/failed_packages.html') + ,hwrite('Banned packages',link='/banned_packages.html') + ),p,center=TRUE,border=0,style='padding: 6px 6px 6px 12px') +} + +page <- function(content,path,title) { + p <- openPage(path,title=title) + hwrite(title,p,heading=1) + hwrite('Install instructions',p,center=TRUE,link='/') + links(p) + hwrite(content,p,center=TRUE,border=1,table.style='border-collapse: collapse; padding: 0px 0px 0px 0px; margin: 0' + ,row.names=FALSE,row.bgcolor='#ffaaaa') + links(p) + closePage(p) +} + +page(db_blacklist_reasons(),banned_builds_path,'Banned packages') +page(db_todays_builds(),todays_builds_path,'Packages built today') +page(db_successful_builds(),latest_builds_path,'Latest successfully built packages') +page(db_failed_builds(),failed_builds_path,'Recent failed packages') + -- 2.39.2