]> git.donarmstrong.com Git - cran2deb.git/commitdiff
generate cran2deb status web pages
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 13 Sep 2009 16:30:04 +0000 (16:30 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 13 Sep 2009 16:30:04 +0000 (16:30 +0000)
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@276 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

trunk/R/db.R
trunk/exec/web [new file with mode: 0755]

index 9b60d5bb4bbe1de84dd7d04462eb8bcfa2326b3b..75c658cf1fcacac1c4d62e4ccfcf82812b04b26d 100644 (file)
@@ -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 (executable)
index 0000000..4c3b0a9
--- /dev/null
@@ -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')
+