From 7dec95f8f83406e25d27ec6a5cacfb1d84a6807a Mon Sep 17 00:00:00 2001 From: rickhelmus Date: Thu, 19 Oct 2023 16:58:13 +0200 Subject: [PATCH] better handle adding packages from regular repos --- utils/make_repos.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/make_repos.R b/utils/make_repos.R index 38d4c467..554ad28d 100644 --- a/utils/make_repos.R +++ b/utils/make_repos.R @@ -54,18 +54,20 @@ packageOrigRepos <- c(BiocManager::repositories()) packageDB <- pkgAvail(repos = packageOrigRepos, type = "win.binary") packageDB <- addPkgListingGH(packageDB, dependencies) -getPkgDeps <- function(pkgs) +getPkgDeps <- function(pkgs, onlyGH) { ret <- names(pkgs) + if (onlyGH) + ret <- ret[sapply(pkgs, "[[", "type") == "gh"] for (md in pkgs) { if (!is.null(md[["deps"]])) - ret <- c(ret, getPkgDeps(md$deps)) + ret <- c(ret, getPkgDeps(md$deps, onlyGH)) } return(ret) } -allDependencyNames <- getPkgDeps(dependencies) +allDependencyNames <- getPkgDeps(dependencies, onlyGH = FALSE) packagesForRepos <- pkgDep(allDependencyNames, availPkgs = packageDB, repos = packageOrigRepos, type = "win.binary", suggests = FALSE) @@ -81,7 +83,7 @@ if (file.exists(packagesFile)) removedPackages <- setdiff(packages, packagesForRepos) newPackages <- setdiff(packagesForRepos, packages) - newPackages <- setdiff(newPackages, allDependencyNames) + newPackages <- setdiff(newPackages, getPkgDeps(dependencies, onlyGH = TRUE)) # will be re-added # removedPackages <- union(removedPackages, localPackages)