From 5a546add30b4538d60d781bc2fa26cd33ccde092 Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Thu, 6 Aug 2020 12:33:39 -0400 Subject: [PATCH] Change default value of R_REMOTES_NO_ERRORS_FROM_WARNINGS This will now no longer cause installs to fail if there are warnings during installation. There are unfortunately too many warnings emitted from `install.packages()` that are _not_ due to install failures, so the previous default was too aggressive. Fixes #403 --- NEWS.md | 2 ++ R/install.R | 4 +--- README.md | 13 +++---------- inst/install-github.R | 4 +--- install-github.R | 4 +--- tests/testthat/test-install.R | 25 ++++++++----------------- 6 files changed, 16 insertions(+), 36 deletions(-) diff --git a/NEWS.md b/NEWS.md index b8291362..08a11267 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # remotes (development version) +* `install_*()` functions will no longer fail by default if there warnings from `install.packages()`. Concretely the default value of `R_REMOTES_NO_ERRORS_FROM_WARNINGS` has changed to `true` from the previous value of `false`. (#403) + # remotes 2.2.0 ## New functions and features diff --git a/R/install.R b/R/install.R index 7a41b68a..579641ee 100644 --- a/R/install.R +++ b/R/install.R @@ -215,9 +215,7 @@ install_deps <- function(pkgdir = ".", dependencies = NA, should_error_for_warnings <- function() { - force_suggests <- Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "true") - - no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", !config_val_to_logical(force_suggests)) + no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", "true") !config_val_to_logical(no_errors) } diff --git a/README.md b/README.md index 7ec512be..f32c3636 100644 --- a/README.md +++ b/README.md @@ -211,16 +211,9 @@ It also uses some remotes specific options: mode and avoid loading its optional dependencies (curl, git2 and pkgbuild currently. See "Standalone mode" above. -* Setting `R_REMOTES_NO_ERRORS_FROM_WARNINGS="true"` avoids stopping the - installation for warning messages. Warnings usually mean installation - errors, so by default remotes stops for a warning. However, sometimes - other warnings might happen, that could be ignored by setting this - environment variable. - -* Setting `_R_CHECK_FORCE_SUGGESTS_="false"` while - `R_REMOTES_NO_ERRORS_FROM_WARNINGS` is unset will also avoid stopping the - installation for error messages. This is done because a warning is generated - during installation when not all Suggested packages are not available. +* Setting `R_REMOTES_NO_ERRORS_FROM_WARNINGS="false"` will cause warning + messages during calls to `install.packages()` to become errors. Often warning + messages are caused by dependencies failing to install. ## License diff --git a/inst/install-github.R b/inst/install-github.R index b5ef8900..bf6aeef2 100644 --- a/inst/install-github.R +++ b/inst/install-github.R @@ -4420,9 +4420,7 @@ function(...) { should_error_for_warnings <- function() { - force_suggests <- Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "true") - - no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", !config_val_to_logical(force_suggests)) + no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", "true") !config_val_to_logical(no_errors) } diff --git a/install-github.R b/install-github.R index b5ef8900..bf6aeef2 100644 --- a/install-github.R +++ b/install-github.R @@ -4420,9 +4420,7 @@ function(...) { should_error_for_warnings <- function() { - force_suggests <- Sys.getenv("_R_CHECK_FORCE_SUGGESTS_", "true") - - no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", !config_val_to_logical(force_suggests)) + no_errors <- Sys.getenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS", "true") !config_val_to_logical(no_errors) } diff --git a/tests/testthat/test-install.R b/tests/testthat/test-install.R index a5350e40..81e9f6d7 100644 --- a/tests/testthat/test-install.R +++ b/tests/testthat/test-install.R @@ -104,35 +104,26 @@ test_that("safe_build_package calls pkgbuild with appropriate arguments", { test_that("should_error_for_warnings works", { - # If both unset, should error -> TRUE - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA, "_R_CHECK_FORCE_SUGGESTS_" = NA), - expect_true(should_error_for_warnings()) - ) - - # If no errors true, should error -> FALSE - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true", "_R_CHECK_FORCE_SUGGESTS_" = NA), - expect_false(should_error_for_warnings()) - ) - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "1", "_R_CHECK_FORCE_SUGGESTS_" = NA), + # If unset, should error -> false + withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA), expect_false(should_error_for_warnings()) ) - # If no errors unset, and force_suggests false, should error -> FALSE - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA, "_R_CHECK_FORCE_SUGGESTS_" = "false"), + # If set to true, should error -> false + withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true"), expect_false(should_error_for_warnings()) ) - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA, "_R_CHECK_FORCE_SUGGESTS_" = "0"), + withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "1"), expect_false(should_error_for_warnings()) ) - # If no errors unset, and force_suggests true, should error -> TRUE - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA, "_R_CHECK_FORCE_SUGGESTS_" = "true"), + # If set to true, should error -> true + withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "false"), expect_true(should_error_for_warnings()) ) - withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = NA, "_R_CHECK_FORCE_SUGGESTS_" = "1"), + withr::with_envvar(c("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "0"), expect_true(should_error_for_warnings()) ) - }) test_that("normalize_build_opts works", {