@@ -196,6 +196,9 @@ get_raw_uni_df <- function(uni) {
196196# '
197197# ' @noRd
198198match_binaries <- function (binaries , r_xy , os , arch ) {
199+ if (nrow(binaries ) == 0 )
200+ return (binaries )
201+
199202 if (! " arch" %in% names(binaries ))
200203 binaries $ arch <- NA_character_
201204 binaries_os_ <- get_binary_os(binaries $ os )
@@ -210,24 +213,23 @@ match_binaries <- function(binaries, r_xy, os, arch) {
210213 arch_match , ]
211214}
212215
213- # ' Flatten raw universe data.frame by matching R, OS, and arch information from
214- # ' `_jobs` with `_binaries`
216+ # ' get_uni_df helper to expand `_jobs`
215217# '
216218# ' @description
217- # ' Adds additional columns to `_jobs_r_xy`, `_binaries_r_xy `,
218- # ' `_jobs_type`, `_jobs_arch`, ` _jobs_os_`, `_binaries_os_ `
219+ # ' Adds additional columns to `_jobs_r_xy`, `_jobs_type`, `_jobs_arch `,
220+ # ' `_jobs_os_`
219221# '
220- # ' @param raw_df raw data.frame from R Universe API
222+ # ' @param df data.frame unprocessed data from R Universe API
221223# '
222224# ' @returns data.frame
223225# '
224226# ' @examples
225227# ' raw_df <- get_raw_uni_df("bioc")
226- # ' get_uni_df (raw_df)
228+ # ' df <- .expand_jobs (raw_df)
227229# '
228230# ' @export
229- get_uni_df <- function (raw_df ) {
230- uni_df <- raw_df | >
231+ .expand_jobs <- function (df ) {
232+ df | >
231233 tidyr :: unnest(`_jobs` , names_sep = " _" , names_repair = " unique" ) | >
232234 dplyr :: mutate(
233235 `_jobs_r_xy` = r_xy_ver(`_jobs_r` ),
@@ -242,23 +244,63 @@ get_uni_df <- function(raw_df) {
242244 .default = NA ),
243245 `_jobs_os_` = dplyr :: if_else(`_jobs_type` == " binary" ,
244246 get_binary_os(stringr :: str_split_i(`_jobs_config` , " -" , 1 )),
245- " linux" )) | >
246- (\(df ) dplyr :: bind_rows(
247- df | >
248- dplyr :: filter(`_jobs_type` == " binary" ) | >
249- dplyr :: mutate(`_binaries` = purrr :: pmap(
250- list (`_binaries` , `_jobs_r_xy` , `_jobs_os_` , `_jobs_arch` ),
251- match_binaries )) | >
252- tidyr :: unnest(`_binaries` , names_sep = " _" , names_repair = " unique" ,
253- keep_empty = TRUE ) | >
254- dplyr :: mutate(`_binaries_os_` = get_binary_os(`_binaries_os` ),
255- `_binaries_r_xy` = dplyr :: if_else(is.na(`_binaries_r` ),
256- NA_character_ ,
257- r_xy_ver(`_binaries_r` ))),
258- df | >
259- dplyr :: filter(`_jobs_type` %in% c(" bioc-checks" , " source" )) | >
260- dplyr :: select(- `_binaries` ) | >
261- dplyr :: mutate(`_binaries_r_xy` = NA_character_ )))() | >
247+ " linux" ))
248+ }
249+
250+ # ' get_uni_df helper to expand `_binaries` and match with `_job`-related columns
251+ # '
252+ # ' @description
253+ # ' Adds additional columns to `_binaries_r_xy` and `_binaries_os_`
254+ # '
255+ # ' @param df data.frame data processed from R Universe API
256+ # '
257+ # ' @returns data.frame
258+ # '
259+ # ' @examples
260+ # ' raw_df <- get_raw_uni_df("bioc")
261+ # ' df <- .expand_jobs(df)
262+ # ' df <- .expand_binaries(df)
263+ # '
264+ # ' @noRd
265+ .expand_binaries <- function (df ) {
266+ dplyr :: bind_rows(
267+ df | >
268+ dplyr :: filter(`_jobs_type` == " binary" ) | >
269+ dplyr :: mutate(`_binaries` = purrr :: pmap(
270+ list (`_binaries` , `_jobs_r_xy` , `_jobs_os_` , `_jobs_arch` ),
271+ match_binaries )) | >
272+ tidyr :: unnest(`_binaries` , names_sep = " _" , names_repair = " unique" ,
273+ keep_empty = TRUE ) | >
274+ dplyr :: mutate(`_binaries_os_` = get_binary_os(`_binaries_os` ),
275+ `_binaries_r_xy` = dplyr :: if_else(is.na(`_binaries_r` ),
276+ NA_character_ ,
277+ r_xy_ver(`_binaries_r` ))),
278+ df | >
279+ dplyr :: filter(`_jobs_type` %in% c(" bioc-checks" , " source" )) | >
280+ dplyr :: select(- `_binaries` ) | >
281+ dplyr :: mutate(`_binaries_r_xy` = NA_character_ ))
282+ }
283+
284+ # ' Flatten raw universe data.frame by matching R, OS, and arch information from
285+ # ' `_jobs` with `_binaries`
286+ # '
287+ # ' @description
288+ # ' Adds additional columns to `_jobs_r_xy`, `_binaries_r_xy`,
289+ # ' `_jobs_type`, `_jobs_arch`, `_jobs_os_`, `_binaries_os_`
290+ # '
291+ # ' @param raw_df raw data.frame from R Universe API
292+ # '
293+ # ' @returns data.frame
294+ # '
295+ # ' @examples
296+ # ' raw_df <- get_raw_uni_df("bioc")
297+ # ' get_uni_df(raw_df)
298+ # '
299+ # ' @export
300+ get_uni_df <- function (raw_df ) {
301+ uni_df <- raw_df | >
302+ .expand_jobs() | >
303+ .expand_binaries() | >
262304 dplyr :: filter(
263305 (`_jobs_type` == " binary" & (`_jobs_r_xy` == `_binaries_r_xy` | is.na(`_binaries_r_xy` ))) |
264306 (`_jobs_type` %in% c(" bioc-checks" , " source" )))
@@ -278,7 +320,8 @@ get_uni_df <- function(raw_df) {
278320# ' @returns data.frame packages in a universe
279321# '
280322# ' @examples
281- # ' get_jobs("bioc", "devel", "4.6.0", "3.23")
323+ # ' bu <- get_uni_for_bioc_version("devel")
324+ # ' get_jobs(bu$ru_uni, bu$bioc_branch, bu$r_version, bu$bioc_version)
282325# '
283326# ' @export
284327get_jobs <- function (uni , uni_os_branch , r_version , bioc_version ) {
@@ -330,7 +373,8 @@ get_jobs <- function(uni, uni_os_branch, r_version, bioc_version) {
330373# ' @returns data.frame
331374# '
332375# ' @examples
333- # ' df <- get_jobs("bioc", "devel", "4.6.0", "3.23", "macosx", "arm64")
376+ # ' bu <- get_uni_for_bioc_version("devel")
377+ # ' df <- get_jobs(bu$ru_uni, bu$bioc_branch, bu$r_version, bu$bioc_version)
334378# ' filter_by_arch(df, "macosx", "arm64")
335379# '
336380# ' @export
@@ -371,7 +415,9 @@ filter_by_arch <- function(df, os, arch = NA) {
371415# ' @returns data.frame of filtered candidate packages
372416# '
373417# ' @examples
374- # ' candidates <- get_candidates("bioc", "devel", "4.6.0", "3.23", "windows",
418+ # ' bu <- get_uni_for_bioc_version("devel")
419+ # ' candidates <- get_candidates(bu$ru_uni, bu$bioc_branch, bu$r_version,
420+ # ' bu$bioc_version, "windows",
375421# ' commit = TRUE)
376422# '
377423# ' @export
@@ -423,22 +469,29 @@ get_candidates <- function(uni, uni_os_branch, r_version, bioc_version, os,
423469
424470# ' Get information about R Universe building a Bioconductor version
425471# '
426- # ' @param version character Bioconductor version
472+ # ' @param version character Bioconductor version, "devel", or "release"
427473# '
474+ # ' @examples
475+ # ' bu <- get_uni_for_bioc_version("devel")
476+ # '
428477# ' @export
429478get_uni_for_bioc_version <- function (version ) {
430479 bioc_yaml <- yaml :: read_yaml(" https://bioconductor.org/config.yaml" )
431-
432- stopifnot( version %in% bioc_yaml $ versions )
433- bioc_branch <- ifelse( bioc_yaml $ devel_version == version , " devel" ,
434- " release " )
435- ru_uni <- ifelse( bioc_branch == " devel" , " bioc " , " bioc-release " )
436- if ( bioc_branch == " devel " )
480+ stopifnot( version %in% c( bioc_yaml $ versions , " release " , " devel " ))
481+
482+ if ( version %in% c( " devel" , bioc_yaml $ devel_version )) {
483+ bioc_version <- bioc_yaml $ devel_version
484+ bioc_branch <- " devel"
485+ ru_uni <- " bioc "
437486 r_version <- bioc_yaml $ r_version_associated_with_devel
438- else
487+ } else {
488+ bioc_version <- bioc_yaml $ release_version
489+ bioc_branch <- " release"
490+ ru_uni <- " bioc-release"
439491 r_version <- bioc_yaml $ r_version_associated_with_release
440-
441- list (bioc_version = version ,
492+ }
493+
494+ list (bioc_version = bioc_version ,
442495 bioc_branch = bioc_branch ,
443496 ru_uni = ru_uni ,
444497 r_version = r_version )
@@ -458,7 +511,9 @@ get_uni_for_bioc_version <- function(version) {
458511# ' @returns vector of the full path of binaries removed
459512# '
460513# ' @examples
461- # ' remove_old_binaries("/home/biocpush/PACKAGES/3.22/bioc", "4.6.0", "windows")
514+ # ' bu <- get_uni_for_bioc_version("devel")
515+ # ' repo_root <- paste0("/home/biocpush/PACKAGES/", bu$bioc_version, "/bioc")
516+ # ' remove_old_binaries(repo_root, bu$bioc_version, "windows")
462517# '
463518# ' @export
464519remove_old_binaries <- function (repo_root , r_version , os , macosx_name = NA ,
0 commit comments