Skip to content

Commit

Permalink
implement 'transactional' for install (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Mar 5, 2025
1 parent 2d0b9fc commit 78c8620
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# renv (development version)

* `renv::install()` gains the `transactional` argument, for parity with
`renv::restore()`. (#1109)


# renv 1.1.2

* `renv` gains the `sysreqs()` function, which can be used to query the system
Expand Down
32 changes: 21 additions & 11 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ the$install_step_width <- 48L
#' will be used. When `FALSE`, installation output will be emitted only if
#' a package fails to install.
#'
#' @param transactional Whether or not to use a 'transactional' package
#' installation. See **Transactional Restore** in [renv::restore()] for
#' more details. When `NULL` (the default), the value of the
#' `install.transactional` [`config`] option will be used.
#'
#' @param lock Boolean; update the `renv.lock` lockfile after the successful
#' installation of the requested packages?
#'
Expand Down Expand Up @@ -92,17 +97,18 @@ the$install_step_width <- 48L
#' }
install <- function(packages = NULL,
...,
include = NULL,
exclude = NULL,
library = NULL,
type = NULL,
rebuild = FALSE,
repos = NULL,
prompt = interactive(),
dependencies = NULL,
verbose = NULL,
lock = FALSE,
project = NULL)
include = NULL,
exclude = NULL,
library = NULL,
type = NULL,
rebuild = FALSE,
repos = NULL,
prompt = interactive(),
dependencies = NULL,
verbose = NULL,
transactional = NULL,
lock = FALSE,
project = NULL)
{
renv_consent_check()
renv_scope_error_handler()
Expand All @@ -128,6 +134,10 @@ install <- function(packages = NULL,
verbose <- verbose %||% config$install.verbose()
renv_scope_options(renv.config.install.verbose = verbose)

# handle 'transactional'
transactional <- transactional %||% config$install.transactional()
renv_scope_options(renv.config.install.transactional = transactional)

# set up library paths
libpaths <- renv_libpaths_resolve(library)
renv_scope_libpaths(libpaths)
Expand Down
6 changes: 6 additions & 0 deletions man/install.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/helper-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ renv_tests_setup_repos <- function(scope = parent.frame()) {

# update the local packrat package version to match what's available
version <- tryCatch(
renv_package_version("packrat"),
renv_package_version("packrat") %||% "0.9.2",
error = function(cnd) "0.9.2"
)

Expand Down

0 comments on commit 78c8620

Please sign in to comment.