This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new ac7e9a4c41 GH-34105: [R] Provide extra output for failed builds
(#37727)
ac7e9a4c41 is described below
commit ac7e9a4c41b73242b2f7a15f13f3c8fde843416d
Author: Bryce Mecum <[email protected]>
AuthorDate: Fri Sep 15 00:50:20 2023 -0800
GH-34105: [R] Provide extra output for failed builds (#37727)
### Rationale for this change
This is a replacement for the previous PR
https://github.com/apache/arrow/pull/37698. The rationale for this PR is
providing extra output for R package builds where the C++ build fails
### What changes are included in this PR?
Update the system call to save output when building Arrow C++ from the R
package and output it if it's failed
### Are these changes tested?
No automated tests but the changes have been tested manually.
### Are there any user-facing changes?
Yes, but only for users building the R package from source which is
hopefully not common.
* Closes: #34105
Lead-authored-by: Bryce Mecum <[email protected]>
Co-authored-by: Nic Crane <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
r/tools/nixlibs.R | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index dca277c809..3d908c05ca 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -473,17 +473,25 @@ build_libarrow <- function(src_dir, dst_dir) {
env_vars <- env_vars_as_string(env_var_list)
cat("**** arrow", ifelse(quietly, "", paste("with", env_vars)), "\n")
- status <- suppressWarnings(system(
- paste(env_vars, "inst/build_arrow_static.sh"),
- ignore.stdout = quietly, ignore.stderr = quietly
+
+ build_log_path <- tempfile(fileext = ".log")
+ status <- suppressWarnings(system2(
+ "bash",
+ "inst/build_arrow_static.sh",
+ env = env_vars,
+ stdout = ifelse(quietly, build_log_path, ""),
+ stderr = ifelse(quietly, build_log_path, "")
))
+
if (status != 0) {
# It failed :(
- cat(
- "**** Error building Arrow C++.",
- ifelse(env_is("ARROW_R_DEV", "true"), "", "Re-run with ARROW_R_DEV=true
for debug information."),
- "\n"
- )
+ cat("**** Error building Arrow C++.", "\n")
+ if (quietly) {
+ cat("**** Printing contents of build log because the build failed",
+ "while ARROW_R_DEV was set to FALSE\n")
+ cat(readLines(build_log_path), sep = "\n")
+ cat("**** Complete build log may still be present at", build_log_path,
"\n")
+ }
}
invisible(status)
}