diff --git a/NEWS.md b/NEWS.md index 161b97c0..c934e713 100644 --- a/NEWS.md +++ b/NEWS.md @@ -155,6 +155,12 @@ access top the lists of translated strings. These have replaced the `tr_()` strings at the point of generation. +## BUG FIX + +* `manage_deps()` can now provision a GitHub package from the lockfile if it was + not previously installed on the system (reported: @pratikunterwegs, + carpentries/actions#32; fixed: @zkamvar, #533) + # sandpaper 0.16.1 (2023-12-14) ## BUG FIX diff --git a/R/utils-renv.R b/R/utils-renv.R index 627fbf67..649d12f8 100644 --- a/R/utils-renv.R +++ b/R/utils-renv.R @@ -250,6 +250,12 @@ callr_manage_deps <- function(path, repos, snapshot, lockfile_exists) { deps <- unique(renv::dependencies(path = path, root = path, dev = TRUE)$Package) pkgs <- setdiff(deps, installed) needs_hydration <- length(pkgs) > 0 + if (packageVersion("renv") >= "1.0.0") { + # We only need to hydrate the packages that do not exist in the lockfile + # and that are not installed + lock <- renv::lockfile_read(renv_lock) + pkgs <- setdiff(pkgs, names(lock$Packages)) + } } else { # If there is not a lockfile, we need to run a fully hydration pkgs <- NULL