Skip to content

Commit

Permalink
additional step to pull build-only deps for src packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Apr 9, 2024
1 parent 96a0617 commit 938d63b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ install_both <- function(pkgs, contriburl, method, dependencies, ...) {
db <- utils::available.packages(contriburl=contriburl, method=method, ...)
pkgs <- pkg_deps(pkgs, dependencies, db, ..., all=TRUE)
pkgs <- check_versions(pkgs, db)
later <- ask_user(pkgs$later, pkgs$bins, pkgs$binvers, pkgs$srcvers)
pkgs <- c(install_sys(pkgs$bins[!later]), pkgs$bins[later], pkgs$srcs)
mask <- ask_user(pkgs$later, pkgs$bins, pkgs$binvers, pkgs$srcvers)
hard <- hard_deps(pkgs, db, ..., mask)
pkgs <- c(install_sys(c(pkgs$bins[!mask], hard)), pkgs$bins[mask], pkgs$srcs)
pkgs
}

Expand Down
22 changes: 18 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ shadowed_packages <- function(lib.loc=NULL) {
shadow
}

installed_packages <- function(...) {
libs <- unique(c(.Library.site, .Library))
inst <- row.names(utils::installed.packages(libs, ...))
inst
}

# get package dependencies
pkg_deps <- function(pkgs, dependencies, db, ..., all=TRUE) {
pkgs <- unique(pkgs)
libs <- unique(c(.Library.site, .Library))
inst <- row.names(utils::installed.packages(libs, ...))
inst <- installed_packages(...)
deps <- tools::package_dependencies(pkgs, db, c("Depends", "Imports"), recursive=TRUE)
deps <- unlist(deps, use.names=FALSE)
if (!all) {
Expand All @@ -72,8 +77,17 @@ pkg_deps <- function(pkgs, dependencies, db, ..., all=TRUE) {
enha <- tools::package_dependencies(pkgs, db, "Enhances", recursive=FALSE)
deps <- c(deps, unlist(enha, use.names=FALSE))
}
pkgs <- unique(c(setdiff(deps, inst), if (all) pkgs))
pkgs
deps <- unique(c(setdiff(deps, inst), if (all) pkgs))
deps
}

# get LinkingTo-only dependencies for src packages
hard_deps <- function(pkgs, db, ..., mask) {
inst <- installed_packages(...)
srcs <- c(pkgs$bins[mask], pkgs$srcs)
deps <- tools::package_dependencies(srcs, db, "LinkingTo", recursive=FALSE)
deps <- setdiff(unlist(deps, use.names=FALSE), c(inst, pkgs$bins, pkgs$srcs))
deps
}

# adapted from install.packages
Expand Down

0 comments on commit 938d63b

Please sign in to comment.