This is an automated email from the ASF dual-hosted git repository.

assignuser 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 490cd83482 GH-38756: [R] More debug output for r/configure and 
nixlibs.R (#38819)
490cd83482 is described below

commit 490cd83482594792de7e4d32ce83e8d4d56e1b96
Author: Jacob Wujciak-Jens <[email protected]>
AuthorDate: Tue Nov 21 21:19:20 2023 +0100

    GH-38756: [R] More debug output for r/configure and nixlibs.R (#38819)
    
    ### Rationale for this change
    
    It  hinders debug-ability for users if the failing log doesn't include all 
info by default.
    
    ### What changes are included in this PR?
    
    Add debug output to test compile command in r/configure and always display 
output with regards to the binary download.
    
    ### Are these changes tested?
    crossbow, locally
    * Closes: #38756
    
    Lead-authored-by: Jacob Wujciak-Jens <[email protected]>
    Co-authored-by: Dewey Dunnington <[email protected]>
    Signed-off-by: Jacob Wujciak-Jens <[email protected]>
---
 r/configure       |  9 +++++++--
 r/tools/nixlibs.R | 12 ++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/r/configure b/r/configure
index 4f09cfdc44..e48bd2f010 100755
--- a/r/configure
+++ b/r/configure
@@ -413,7 +413,7 @@ CXX17FLAGS=`"${R_HOME}"/bin/R CMD config CXX17FLAGS`
 CXX17STD=`"${R_HOME}"/bin/R CMD config CXX17STD`
 CPPFLAGS=`"${R_HOME}"/bin/R CMD config CPPFLAGS`
 TEST_CMD="${CXX17} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX17FLAGS} ${CXX17STD} -xc++ -"
-echo "#include $PKG_TEST_HEADER" | ${TEST_CMD} >/dev/null 2>&1
+TEST_ERROR=$(echo "#include $PKG_TEST_HEADER" | ${TEST_CMD} -o /dev/null 2>&1)
 
 if [ $? -eq 0 ]; then
   # Prepend PKG_DIRS to PKG_LIBS and write to Makevars
@@ -428,7 +428,12 @@ else
   echo "------------------------- NOTE ---------------------------"
   echo "There was an issue preparing the Arrow C++ libraries."
   echo "See https://arrow.apache.org/docs/r/articles/install.html";
-  echo "---------------------------------------------------------"
+  echo "----------------------------------------------------------"
+  echo ""
+  echo "Test compile error: ${TEST_ERROR}"
+  echo "Failing compile command: ${TEST_CMD}"
+  echo "PKG_CFLAGS=$PKG_CFLAGS"
+  echo "PKG_LIBS=$PKG_LIBS"
   PKG_LIBS=""
   PKG_CFLAGS=""
   exit 1
diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index 03cbfbc5e9..b003e7cea8 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -99,16 +99,12 @@ download_binary <- function(lib) {
   libfile <- paste0("arrow-", VERSION, ".zip")
   binary_url <- paste0(arrow_repo, "bin/", lib, "/arrow-", VERSION, ".zip")
   if (try_download(binary_url, libfile)) {
-    if (!quietly) {
-      lg("Successfully retrieved C++ binaries (%s)", lib)
-    }
+      lg("Successfully retrieved libarrow (%s)", lib)
   } else {
-    if (!quietly) {
       lg(
-        "Downloading libarrow binary failed for version %s (%s)\n    at %s",
+        "Downloading libarrow failed for version %s (%s)\n    at %s",
         VERSION, lib, binary_url
       )
-    }
     libfile <- NULL
   }
   # Explicitly setting the env var to "false" will skip checksum validation
@@ -140,11 +136,11 @@ download_binary <- function(lib) {
     checksum_ok <- system2(checksum_cmd, args = checksum_args)
 
     if (checksum_ok != 0) {
-      cat("*** Checksum validation failed for libarrow binary: ", libfile, 
"\n")
+      lg("Checksum validation failed for libarrow: %s/%s", lib, libfile)
       unlink(libfile)
       libfile <- NULL
     } else {
-      cat("*** Checksum validated successfully for libarrow binary: ", 
libfile, "\n")
+      lg("Checksum validated successfully for libarrow: %s/%s", lib, libfile)
     }
   }
 

Reply via email to