@@ -3,16 +3,20 @@ format.deps <- function(file, which) {
33 if (all(is.na(deps.raw ))) return (character ())
44 deps.raw = gsub(" \n " , " " , deps.raw , fixed = TRUE )
55 deps.full = trimws(strsplit(deps.raw , " , " , fixed = TRUE )[[1L ]])
6- deps = trimws(sapply(strsplit(deps.full , " (" , fixed = TRUE ), `[[` , 1L ))
7- deps.full = gsub(" >=" , " ≥" , deps.full , fixed = TRUE )
8- deps.full = gsub(" <=" , " ≤" , deps.full , fixed = TRUE )
9- if (any(grepl(" >" , deps.full , fixed = TRUE ), grepl(" <" , deps.full , fixed = TRUE ), grepl(" =" , deps.full , fixed = TRUE )))
6+ deps.full.split = strsplit(deps.full , " (" , fixed = TRUE )
7+ deps = trimws(sapply(deps.full.split , `[[` , 1L ))
8+ vers = trimws(sapply(deps.full.split , function (x ) if (length(x )> 1L ) paste0(" (" ,x [[2L ]]) else " " ))
9+ vers = gsub(" >=" , " ≥" , vers , fixed = TRUE )
10+ vers = gsub(" <=" , " ≤" , vers , fixed = TRUE )
11+ if (any(grepl(" >" , vers , fixed = TRUE ), grepl(" <" , vers , fixed = TRUE ), grepl(" =" , vers , fixed = TRUE )))
1012 stop(" formatting dependencies version for CRAN-line package website failed because some dependencies have version defined using operators other than >= and <=" )
11- names(deps.full ) <- deps
13+ names(vers ) <- deps
1214 base.deps = c(" R" , unlist(tools ::: .get_standard_package_names(), use.names = FALSE ))
1315 ans = sapply(deps , function (x ) {
14- if (x %in% base.deps ) deps.full [[x ]] # # base R packages are not linked
15- else sprintf(" <a href=\" ../%s/index.html\" >%s</a>" , x , deps.full [[x ]])
16+ if (x %in% base.deps ) {
17+ if (nchar(vers [[x ]])) paste(x , vers [[x ]]) else x # # base R packages are not linked
18+ }
19+ else sprintf(" <a href=\" https://cloud.r-project.org/package=%s\" >%s</a>%s" , x , x , if (nchar(vers [[x ]])) paste0(" " ,vers [[x ]]) else " " )
1620 })
1721 sprintf(" <tr><td>%s:</td><td>%s</td></tr>" , which , paste(ans , collapse = " , " ))
1822}
@@ -207,24 +211,11 @@ check.copy <- function(job, repodir="bus/integration/cran"){
207211 dir.create(job.checks <- file.path(repodir , " web" , " checks" , pkg <- " data.table" , job ), recursive = TRUE );
208212 os = plat(job )
209213 from = file.path(" bus" , sprintf(" %s/%s.Rcheck" , job , pkg ))
210- current.rout = c(" main.Rout" ," main.Rout.fail" ," knitr.Rout" ," knitr.Rout.fail" ," memtest.csv" ," memtest.png" )
211- if (os == " Windows" ) {
212- dir.create(file.path(job.checks , " tests_i386" ), showWarnings = FALSE )
213- dir.create(file.path(job.checks , " tests_x64" ), showWarnings = FALSE )
214- rout32 = file.path(" tests_i386" , current.rout )
215- rout64 = file.path(" tests_x64" , current.rout )
216- file.copy(file.path(from , rout32 )[file.exists(file.path(from , rout32 ))], file.path(job.checks , " tests_i386" ))
217- file.copy(file.path(from , rout64 )[file.exists(file.path(from , rout64 ))], file.path(job.checks , " tests_x64" ))
218- routs = c(rout32 , rout64 )
219- } else if (os == " Mac OS X" ) {
220- dir.create(file.path(job.checks , " tests" ), showWarnings = FALSE )
221- routs = file.path(" tests" , current.rout )
222- file.copy(file.path(from , routs )[file.exists(file.path(from , routs ))], file.path(job.checks , " tests" ))
223- } else {
224- dir.create(file.path(job.checks , " tests" ), showWarnings = FALSE )
225- routs = file.path(" tests" , current.rout )
226- file.copy(file.path(from , routs )[file.exists(file.path(from , routs ))], file.path(job.checks , " tests" ))
227- }
214+ tests = list.files(" tests" , pattern = " \\ .R$" )
215+ current.rout = c(paste0(tests , " out" ), paste0(tests , " out.fail" ))
216+ dir.create(file.path(job.checks , " tests" ), showWarnings = FALSE )
217+ routs = file.path(" tests" , current.rout )
218+ file.copy(file.path(from , routs )[file.exists(file.path(from , routs ))], file.path(job.checks , " tests" ))
228219 inst.check.files = file.path(from , inst.check <- c(" 00install.out" ," 00check.log" ))
229220 file.copy(inst.check.files [file.exists(inst.check.files )], job.checks )
230221 setNames(file.exists(file.path(job.checks , c(inst.check , routs ))), c(inst.check , routs ))
@@ -274,75 +265,46 @@ log.copy <- function(job, repodir="bus/integration/cran") {
274265 Sys.sleep(0.1 ) # # to not get ban from gitlab.com
275266 setNames(file.exists(to ), " log" )
276267}
277-
278268ci.status <- function (job ) {
279269 if (! file.exists(status_file <- file.path(" bus" , job , " status" )))
280270 return (NA_character_ )
281271 readLines(status_file , warn = FALSE )[1L ]
282272}
283-
284273ci.log <- function (jobs , repodir = " bus/integration/cran" ) {
285274 pkg = " data.table"
286275 ans = vector(" character" , length(jobs ))
287276 logs = sapply(jobs , log.copy , repodir = repodir )
288277 statuses = sapply(jobs , ci.status )
278+ statuses [statuses == " success" ] = paste0(" <span class=\" check_ok\" >" ,statuses [statuses == " success" ]," </span>" )
279+ statuses [statuses == " failed" ] = paste0(" <span class=\" check_ko\" >" ,statuses [statuses == " failed" ]," </span>" )
289280 ans [! logs ] = statuses [! logs ]
290281 ans [logs ] = sprintf(' <a href=\" %s/%s/log\" >%s</a>' , pkg [any(logs )], jobs [logs ], statuses [logs ])
291282 ans
292283}
293284
294285check.index <- function (pkg , jobs , repodir = " bus/integration/cran" ) {
295- status = function (x ) if (grepl(" ^.*ERROR" , x )) " ERROR" else if (grepl(" ^.*WARNING" , x )) " WARNING" else if (grepl(" ^.*NOTE" , x )) " NOTE" else if (grepl(" ^.*OK" , x )) " OK " else NA_character_
296- test.files = function (job , files , trim.name = FALSE , trim.exts = 0L , pkg = " data.table" ) {
297- stopifnot( trim.name + as.logical( trim.exts ) < 2L ) # cannot use both
286+ status = function (x ) if (grepl(" ^.*ERROR" , x )) " <span class= \" check_ko \" > ERROR</span> " else if (grepl(" ^.*WARNING" , x )) " <span class= \" check_ko \" > WARNING</span> " else if (grepl(" ^.*NOTE" , x )) " <span class= \" CRAN \" > NOTE</span> " else if (grepl(" ^.*OK" , x )) " <span class= \" check_ok \" >OK</span> " else NA_character_
287+ test.files = function (job , trim = TRUE , pkg = " data.table" ) {
288+ files = paste0( " tests/ " , list.files( " tests " , pattern = " \\ .R$ " ), " out.fail " )
298289 links = sapply(files , function (file ) {
299290 if (! file.exists(file.path(repodir , " web/checks" , pkg , job , file ))) return (NA_character_ )
300291 dir = if (! identical(d <- dirname(file ), " ." )) d
301292 sprintf(" <a href=\" %s/%s/%s\" >%s</a>" , pkg , job , file ,
302- if (trim.name ) paste(c( dir , tools :: file_ext( file )), collapse = " / " ) else if ( trim.exts ) { for ( i in 1 : trim.exts ) { file <- tools :: file_path_sans_ext( file ) }; file } else file )
293+ if (trim ) sub( " .Rout.fail " , " " , basename( file ), fixed = TRUE ) else file )
303294 })
304295 paste(na.omit(links ), collapse = " , " )
305296 }
306- routs = lapply(jobs , function (job ) {
307- current.rout = c(" main.Rout.fail" ," knitr.Rout.fail" )
308- os = plat(job )
309- if (os == " Windows" ) {
310- rout32 = file.path(" tests_i386" , current.rout )
311- rout64 = file.path(" tests_x64" , current.rout )
312- routs = c(rout32 , rout64 )
313- } else if (os == " Mac OS X" ) {
314- routs = file.path(" tests" , current.rout )
315- } else {
316- routs = file.path(" tests" , current.rout )
317- }
318- routs
319- })
320- memouts = lapply(jobs , function (job ) {
321- current.memout = c(" memtest.csv" ," memtest.png" )
322- os = plat(job )
323- if (os == " Windows" ) {
324- mem32 = file.path(" tests_i386" , current.memout )
325- mem64 = file.path(" tests_x64" , current.memout )
326- memouts = c(mem32 , mem64 )
327- } else if (os == " Mac OS X" ) {
328- memouts = file.path(" tests" , current.memout )
329- } else {
330- memouts = file.path(" tests" , current.memout )
331- }
332- memouts
333- })
334- th = " <th>Flavor</th><th>Version</th><th>Revision</th><th>Install</th><th>Status</th><th>Flags</th><th>Rout.fail</th><th>Log</th><th>Memtest</th>"
297+ th = " <th>Flavor</th><th>Version</th><th>Revision</th><th>Install</th><th>Check</th><th>Flags</th><th>Rout.fail</th><th>Log</th>"
335298 tbl = sprintf(
336- " <tr><td><a href=\" check_flavors.html\" >%s</a></td><td>%s</td><td>%s</td><td><a href=\" %s/%s/00install.out\" >out</a></td><td><a href=\" %s/%s/00check.log\" >%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>< /tr>" ,
299+ " <tr><td><a href=\" check_flavors.html\" >%s</a></td><td>%s</td><td>%s</td><td><a href=\" %s/%s/00install.out\" >out</a></td><td><a href=\" %s/%s/00check.log\" >%s</a></td><td>%s</td><td>%s</td><td>%s</td></tr>" ,
337300 sub(" test-" , " " , jobs , fixed = TRUE ), # # Flavor
338301 sapply(jobs , pkg.version , pkg ), # # Version
339302 sapply(jobs , pkg.revision , pkg ), # # Revision
340303 pkg , jobs , # # Install
341- pkg , jobs , sapply(sapply(jobs , check.test , pkg = " data.table" ), status ), # # Status
304+ pkg , jobs , sapply(sapply(jobs , check.test , pkg = " data.table" ), status ), # # Check
342305 sapply(jobs , pkg.flags , pkg ), # # Flags
343- mapply(test.files , jobs , routs , trim.exts = 2L ), # # Rout.fail: 1st fail, 2nd Rout, keep just: tests_x64/main
344- ci.log(jobs ), # # CI job logs
345- mapply(test.files , jobs , memouts , trim.name = TRUE ) # # Memtest // currently not used
306+ sapply(jobs , test.files ), # # Rout.fail
307+ ci.log(jobs ) # # CI job logs
346308 )
347309 file = file.path(repodir , " web/checks" , sprintf(" check_results_%s.html" , pkg ))
348310 writeLines(c(
@@ -378,29 +340,3 @@ check.test <- function(job, pkg) {
378340 check [length(check )]
379341}
380342
381- move.bin <- function (job , bin.version , os.type , file = " DESCRIPTION" , silent = TRUE ) {
382- # # currently not used, if not used for macos in future then can be removed
383- if (os.type == " unix" ) {
384- stop(" publish of linux binaries not supported" )
385- } else if (os.type == " windows" ) {
386- plat.path = " windows"
387- extension = " zip"
388- } else if (os.type == " macosx" ) {
389- plat.path = " macosx/el-capitan"
390- extension = " tgz"
391- }
392- dcf = read.dcf(file )
393- pkg = dcf [," Package" ][[1L ]]
394- version = dcf [," Version" ][[1L ]]
395- src.path = file.path(" bus" ,job ," cran/bin" ,plat.path ," contrib" ,bin.version )
396- if (! silent && ! dir.exists(src.path )) stop(sprintf(" expected directory does not exists %s" , src.path ))
397- bin.file = sprintf(" %s_%s.%s" , pkg , version , extension )
398- tgt.path = file.path(" bus/integration/cran/bin" ,plat.path ," contrib" ,bin.version )
399- if (! file.exists(file.path(src.path , bin.file ))) {
400- if (! silent ) stop(sprintf(" expected binaries does not exists %s" , file.path(src.path , bin.file )))
401- } else {
402- if (! dir.exists(tgt.path )) dir.create(tgt.path , recursive = TRUE )
403- file.rename(file.path(src.path ,bin.file ), file.path(tgt.path ,bin.file ))
404- }
405- setNames(file.exists(file.path(tgt.path ,bin.file )), file.path(tgt.path ,bin.file ))
406- }
0 commit comments