Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Apr 1, 2024
1 parent 2f64a95 commit 5aaa4c1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
13 changes: 6 additions & 7 deletions R/linux-binaries.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ preinstall_linux_binaries <- function(pkg, which = 'strong'){
cran <- sprintf("https://p3m.dev/cran/__linux__/%s/latest", distro)
repos <- c(cran, bioc)
db <- utils::available.packages(repos = repos)
revdeps <- c(pkg, tools::package_dependencies(pkg, db = db, reverse = TRUE, which = which)[[pkg]])
strongdeps <- tools::package_dependencies(revdeps, db = db, recursive = TRUE)
strongpkgs <- unlist(lapply(revdeps, function(x){
c(rev(strongdeps[[x]]), x)
tocheck <- c(pkg, tools::package_dependencies(pkg, db = db, reverse = TRUE, which = which)[[pkg]])
checkdeps <- unique(unlist(unname(tools::package_dependencies(tocheck, db = db, which = 'most'))))
alldeps <- tools::package_dependencies(checkdeps, db = db, recursive = TRUE)
packages <- unlist(lapply(checkdeps, function(x){
c(rev(alldeps[[x]]), x)
}))
softdeps <- tools::package_dependencies(revdeps, db = db, which = 'most')
packages <- unique(c(strongpkgs, unlist(unname(softdeps))))
packages <- intersect(packages, row.names(db))
packages <- intersect(unique(packages), row.names(db))
packages <- setdiff(packages, loadedNamespaces())
versions <- db[packages, 'Version']
mirrors <- db[packages, 'Repository']
Expand Down
28 changes: 19 additions & 9 deletions R/recheck.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#' @export
#' @rdname recheck
#' @param sourcepkg path to a source package tarball
#' @param which passed to `tools::check_packages_in_dir`
#' @param which passed to `tools::check_packages_in_dir`. Set "most" to
#' also check reverse suggests.
revdep_check <- function(sourcepkg, which = "strong"){
pkg <- sub("_.*", "", basename(sourcepkg))
if(grepl("Linux", Sys.info()[['sysname']])){
Expand All @@ -14,16 +15,25 @@ revdep_check <- function(sourcepkg, which = "strong"){
checkdir <- dirname(sourcepkg)
cran <- utils::available.packages(repos = 'https://cloud.r-project.org')
revdeps <- tools::package_dependencies(pkg, db = cran, reverse = TRUE)[[pkg]]
utils::setRepositories(ind = 1:4) #adds bioc
tools::check_packages_in_dir(checkdir, basename(sourcepkg), reverse = TRUE, which = which,
Ncpus = parallel::detectCores(), check_args = c('--no-manual'))
#set_source_repos()
tools::check_packages_in_dir(checkdir, basename(sourcepkg),
reverse = 'https://cloud.r-project.org',
which = which,
Ncpus = parallel::detectCores(),
check_args = c('--no-manual'))
tools::summarize_check_packages_in_dir_results(checkdir)
tools::check_packages_in_dir_details(checkdir)
}

test_revdep_check <- function(){
unlink('qpdf_recheck', recursive = TRUE)
dir.create('qpdf_recheck')
utils::download.packages('qpdf', 'qpdf_recheck')
revdep_check(list.files('revdep_check', pattern = 'qpdf.*gz', full.names = TRUE))
set_source_repos <- function(){
options(repos = c(CRAN = 'https://cloud.r-project.org'))
utils::setRepositories(ind = 1:4) #adds bioc
}

test_revdep_check <- function(pkg){
checkdir <- paste(pkg, 'recheck', sep = '_')
unlink(checkdir, recursive = TRUE)
dir.create(checkdir)
utils::download.packages(pkg, checkdir, repos = 'https://cloud.r-project.org')
revdep_check(list.files(checkdir, pattern = 'tar.gz$', full.names = TRUE))
}

0 comments on commit 5aaa4c1

Please sign in to comment.