Skip to content

Commit 6f260d0

Browse files
committed
Cleanups
1 parent ae1b3af commit 6f260d0

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

rechecktools/R/ci.R

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@
55
#' @export
66
#' @param path path to source package
77
#' @param which either be strong or most
8-
install_recheck_deps <- function(path = '.', which = 'strong'){
9-
oldrepos <- enable_all_repos()
10-
oldtimeout <- options(timeout = 600)
11-
on.exit(options(c(oldrepos, oldtimeout)), add = TRUE)
8+
install_recheck_deps <- function(path = '.', which = 'strong', check_bioc = FALSE){
129
desc <- as.data.frame(read.dcf(file.path(path, 'DESCRIPTION')))
1310
pkg <- desc$Package
14-
cranrepo <- getOption('repos')['CRAN']
15-
cran <- utils::available.packages(repos = cranrepo)
16-
crandeps <- tools::package_dependencies(pkg, db = cran, which = which, reverse = TRUE)[[pkg]]
17-
packages <- setdiff(unique(c(desc_deps(desc), crandeps)), basepkgs())
18-
if(grepl("Linux", Sys.info()[['sysname']])){
19-
preinstall_linux_binaries(packages)
20-
} else {
21-
utils::install.packages(packages, dependencies = TRUE)
22-
deps <- unique(unlist(unname(tools::package_dependencies(packages, recursive = TRUE))))
23-
update.packages(oldPkgs = deps, ask = FALSE)
24-
}
11+
repos <- c(
12+
CRAN = 'https://cloud.r-project.org',
13+
BIOC = if(isTRUE(check_bioc)) 'https://bioconductor.posit.co/packages/devel/bioc'
14+
)
15+
db <- utils::available.packages(repos = repos)
16+
revdeps <- tools::package_dependencies(pkg, db = db, which = which, reverse = TRUE)[[pkg]]
17+
packages <- setdiff(unique(c(desc_deps(desc), revdeps)), basepkgs())
18+
utils::install.packages(packages, dependencies = TRUE)
19+
#deps <- unique(unlist(unname(tools::package_dependencies(packages, recursive = TRUE))))
20+
#update.packages(oldPkgs = deps, ask = FALSE)
2521
}
2622

2723
desc_deps <- function(desc){

rechecktools/R/recheck.R

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
#' also check reverse suggests.
1010
#' @param preinstall_dependencies start by installing dependencies for all
1111
#' packages to be checked.
12-
recheck <- function(sourcepkg, which = "strong", preinstall_dependencies = TRUE){
13-
# Some temporary settings
14-
oldrepos <- enable_all_repos()
15-
oldtimeout <- options(timeout = 600)
16-
on.exit(options(c(oldrepos, oldtimeout)), add = TRUE)
17-
12+
recheck <- function(sourcepkg, which = "strong", check_bioc = FALSE, preinstall_dependencies = TRUE){
1813
# Get the tarball
1914
if(grepl('^https:', sourcepkg)){
2015
curl::curl_download(sourcepkg, basename(sourcepkg))
@@ -26,18 +21,17 @@ recheck <- function(sourcepkg, which = "strong", preinstall_dependencies = TRUE)
2621
}
2722
pkg <- sub("_.*", "", basename(sourcepkg))
2823
checkdir <- dirname(sourcepkg)
29-
cranrepo <- getOption('repos')['CRAN'] #
30-
cran <- utils::available.packages(repos = cranrepo)
31-
packages <- c(pkg, tools::package_dependencies(pkg, db = cran, which = which, reverse = TRUE)[[pkg]])
24+
repos <- c(
25+
CRAN = 'https://cloud.r-project.org',
26+
BIOC = if(isTRUE(check_bioc)) 'https://bioconductor.posit.co/packages/devel/bioc'
27+
)
28+
db <- utils::available.packages(repos = repos)
29+
packages <- c(pkg, tools::package_dependencies(pkg, db = db, which = which, reverse = TRUE)[[pkg]])
3230
if(preinstall_dependencies){
3331
group_output("Preparing dependencies", {
34-
if(grepl("Linux", Sys.info()[['sysname']])){
35-
preinstall_linux_binaries(packages)
36-
} else {
37-
utils::install.packages(packages, dependencies = TRUE)
38-
deps <- unique(unlist(unname(tools::package_dependencies(packages, recursive = TRUE))))
39-
update.packages(oldPkgs = deps, ask = FALSE)
40-
}
32+
utils::install.packages(packages, dependencies = TRUE)
33+
deps <- unique(unlist(unname(tools::package_dependencies(packages, recursive = TRUE))))
34+
update.packages(oldPkgs = deps, ask = FALSE)
4135
})
4236
}
4337
check_args <- character()

rechecktools/recheck.Rproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version: 1.0
2+
ProjectId: fdd81c5f-5782-426c-977c-1f8314dacc77
23

34
RestoreWorkspace: Default
45
SaveWorkspace: Default

0 commit comments

Comments
 (0)