-
Notifications
You must be signed in to change notification settings - Fork 35
Report rcheck envvars #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,9 @@ rcmdcheck <- function( | |
} | ||
|
||
# Add pandoc to the PATH, for R CMD build and R CMD check | ||
if (should_use_rs_pandoc()) local_path(Sys.getenv("RSTUDIO_PANDOC")) | ||
if (should_use_rs_pandoc()) { | ||
local_path(Sys.getenv("RSTUDIO_PANDOC")) | ||
} | ||
|
||
pkgbuild::without_cache(pkgbuild::local_build_tools()) | ||
|
||
|
@@ -175,7 +177,9 @@ rcmdcheck <- function( | |
|
||
on.exit(unlink(out$session_info, recursive = TRUE), add = TRUE) | ||
|
||
if (isTRUE(out$timeout)) message("R CMD check timed out") | ||
if (isTRUE(out$timeout)) { | ||
message("R CMD check timed out") | ||
} | ||
|
||
res <- new_rcmdcheck( | ||
stdout = out$result$stdout, | ||
|
@@ -188,7 +192,9 @@ rcmdcheck <- function( | |
) | ||
|
||
# Automatically delete temporary files when this object disappears | ||
if (cleanup) res$cleaner <- auto_clean(check_dir) | ||
if (cleanup) { | ||
res$cleaner <- auto_clean(check_dir) | ||
} | ||
|
||
handle_error_on(res, error_on) | ||
|
||
|
@@ -227,9 +233,34 @@ do_check <- function( | |
} | ||
|
||
# user supplied env vars take precedence | ||
if (length(env)) chkenv[names(env)] <- env | ||
if (length(env)) { | ||
chkenv[names(env)] <- env | ||
} | ||
|
||
if (!quiet) { | ||
cat_head("R CMD check") | ||
cat_line() | ||
all_vars <- Sys.getenv() | ||
rchk_vars <- all_vars[ | ||
grep("_R_CHECK|NOT_CRAN|RCMDCHECK|R_TESTS", names(all_vars)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you could just print There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that it looked a little duplicative when called from
My initial instinct was to make printing the envvars that relate to checking all get printed by rcmdcheck (even if set by devtools or otherwise), so also made a corresponding PR to remove the printing by devtools r-lib/devtools#2621 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as for the RCMDCHECK / R_TESTS grep patterns, I did a search through the rcmdcheck codebase for Sys.getenv https://github.com/search?q=repo%3Ar-lib%2Frcmdcheck%20Sys.getenv&type=code and saw those two patterns being referred to in a handful of places, figured they might as well get printed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I'm happy to change to "just" the _R_CHECK ones if we have a stronger preference to have devtools print the vars set by devtools, just explaining the original rationale) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we had this, we'd drop the rcmdcheck is used in other places apart from devtools, so the goals are a little different — here I'm worried more about env vars that are set elsewhere (i.e. not by devtools). We can also wait for Gabor to take a look. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's what I tried to implement here (maybe worth eyeballing to confirm?) https://github.com/r-lib/devtools/pull/2621/files |
||
] | ||
rchk_vars[names(env)] <- env | ||
tanho63 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (length(rchk_vars) > 0) { | ||
tanho63 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cli::cat_bullet( | ||
"With:", | ||
col = "darkgrey", | ||
bullet = "line", | ||
bullet_col = "darkgrey" | ||
) | ||
cli::cat_bullet( | ||
paste0(format(names(rchk_vars)), " = ", unname(rchk_vars)), | ||
col = "darkgrey" | ||
) | ||
cat_line() | ||
} | ||
} | ||
|
||
if (!quiet) cat_head("R CMD check") | ||
callback <- if (!quiet) detect_callback(as_cran = "--as-cran" %in% args) | ||
res <- rcmd_safe( | ||
"check", | ||
|
@@ -246,7 +277,9 @@ do_check <- function( | |
) | ||
|
||
# To print an incomplete line on timeout or crash | ||
if (!is.null(callback) && (res$timeout || res$status != 0)) callback("\n") | ||
if (!is.null(callback) && (res$timeout || res$status != 0)) { | ||
callback("\n") | ||
} | ||
|
||
# Non-zero status is an error, the check process failed | ||
# R CMD check returns 1 for installation errors, we don't want to error | ||
|
Uh oh!
There was an error while loading. Please reload this page.