Skip to content

Commit

Permalink
Merge pull request #3366 from infotroph/dirty-confirmdeps-patch
Browse files Browse the repository at this point in the history
[build] avoid recursive installation of a zillion indirect Suggests
  • Loading branch information
mdietze authored Sep 2, 2024
2 parents 257f71e + 10d94b3 commit b18fbac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/confirm_deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@ confirm_deps <- function(pkg,
install = TRUE,
dependencies = NA,
...) {

# Q: "Why a separate variable instead of overwriting `dependencies`?"
# A: As a quick workaround for https://github.com/r-lib/remotes/issues/809:
# remotes::install_deps(pkgdir, `dependencies = TRUE`) correctly installs
# optional deps of `pkgdir` but only hard deps of its dependencies,
# whereas `dependencies = c(..., "Suggests")` installs the whole
# recursive chain of Suggests of Suggests of Suggests.
if (all(is.na(dependencies)) || all(dependencies == "hard")) {
dependencies <- c("Depends", "Imports", "LinkingTo")
dependency_types <- c("Depends", "Imports", "LinkingTo")
} else if (isTRUE(dependencies) || all(dependencies == "soft")) {
dependencies <- c("Depends", "Imports", "LinkingTo", "Suggests")
dependency_types <- c("Depends", "Imports", "LinkingTo", "Suggests")
} else if (isFALSE(dependencies)) {
return() # for compatibility with remotes::install_deps
}

deps <- desc::desc_get_deps(pkg)
deps <- deps[deps$type %in% dependencies, ]
deps <- deps[deps$type %in% dependency_types, ]

pkgs <- as.data.frame(installed.packages(), stringsAsFactors = FALSE)[, c("Package", "Version")]
colnames(pkgs) <- c("package", "installed_version")
Expand Down

0 comments on commit b18fbac

Please sign in to comment.