assignUser commented on code in PR #38236:
URL: https://github.com/apache/arrow/pull/38236#discussion_r1363095267
##########
r/tools/nixlibs.R:
##########
@@ -811,22 +802,90 @@ cmake_find_package <- function(pkg, version = NULL,
env_var_list) {
system(cmake_cmd, ignore.stdout = TRUE, ignore.stderr = TRUE) == 0
}
-#####
+############### Main logic #############
+args <- commandArgs(TRUE)
+VERSION <- args[1]
+
+# TESTING is set in test-nixlibs.R; it won't be set when called from configure
+test_mode <- exists("TESTING")
+
+# Prevent error with binary selection during testing.
+if (test_mode && is.na(VERSION)) {
+ VERSION <- "8.0.0.9000"
+}
+
+VERSION <- package_version(VERSION)
+dev_version <- VERSION[1, 4]
+# Small dev versions are added for R-only changes during CRAN submission
+is_release <- is.na(dev_version) || dev_version < "100"
+
+on_macos <- tolower(Sys.info()[["sysname"]]) == "darwin"
+on_windows <- tolower(Sys.info()[["sysname"]]) == "windows"
+
+# For local debugging, set ARROW_R_DEV=TRUE to make this script print more
+quietly <- !env_is("ARROW_R_DEV", "true")
+
+not_cran <- env_is("NOT_CRAN", "true")
+
+if (is_release) {
+ VERSION <- VERSION[1, 1:3]
+ arrow_repo <- paste0(getOption("arrow.repo",
sprintf("https://apache.jfrog.io/artifactory/arrow/r/%s", VERSION)),
"/libarrow/")
+} else {
+ not_cran <- TRUE
+ arrow_repo <- paste0(getOption("arrow.dev_repo",
"https://nightlies.apache.org/arrow/r"), "/libarrow/")
+ VERSION <- find_latest_nightly(VERSION)
+}
+
+options(.arrow.cleanup = character()) # To collect dirs to rm on exit
Review Comment:
I only moved this, and as far as I can see it's not actually being used in
the script (a relic from the past?). I would prefer the more direct
`on.exit(unlink(` approach in the few cases where we need it, unless there are
functional reasons that would make that fail?
##########
r/tools/nixlibs.R:
##########
@@ -811,22 +802,90 @@ cmake_find_package <- function(pkg, version = NULL,
env_var_list) {
system(cmake_cmd, ignore.stdout = TRUE, ignore.stderr = TRUE) == 0
}
-#####
+############### Main logic #############
+args <- commandArgs(TRUE)
+VERSION <- args[1]
+
+# TESTING is set in test-nixlibs.R; it won't be set when called from configure
+test_mode <- exists("TESTING")
+
+# Prevent error with binary selection during testing.
+if (test_mode && is.na(VERSION)) {
+ VERSION <- "8.0.0.9000"
+}
+
+VERSION <- package_version(VERSION)
+dev_version <- VERSION[1, 4]
+# Small dev versions are added for R-only changes during CRAN submission
+is_release <- is.na(dev_version) || dev_version < "100"
+
+on_macos <- tolower(Sys.info()[["sysname"]]) == "darwin"
+on_windows <- tolower(Sys.info()[["sysname"]]) == "windows"
+
+# For local debugging, set ARROW_R_DEV=TRUE to make this script print more
+quietly <- !env_is("ARROW_R_DEV", "true")
+
+not_cran <- env_is("NOT_CRAN", "true")
+
+if (is_release) {
+ VERSION <- VERSION[1, 1:3]
+ arrow_repo <- paste0(getOption("arrow.repo",
sprintf("https://apache.jfrog.io/artifactory/arrow/r/%s", VERSION)),
"/libarrow/")
+} else {
+ not_cran <- TRUE
+ arrow_repo <- paste0(getOption("arrow.dev_repo",
"https://nightlies.apache.org/arrow/r"), "/libarrow/")
+ VERSION <- find_latest_nightly(VERSION)
+}
+
+options(.arrow.cleanup = character()) # To collect dirs to rm on exit
+on.exit(unlink(getOption(".arrow.cleanup")))
+
+# enable full featured builds for macOS in case of CRAN source builds.
+if (not_cran || on_macos) {
+ # Set more eager defaults
+ if (env_is("LIBARROW_BINARY", "")) {
+ Sys.setenv(LIBARROW_BINARY = "true")
+ }
+ if (env_is("LIBARROW_MINIMAL", "")) {
+ Sys.setenv(LIBARROW_MINIMAL = "false")
+ }
+}
+
+# The default will build from source as a fallback if a binary is not found or
shouldn't be used
+# Set LIBARROW_BUILD=FALSE to ensure that we use a previously built libarrow
+# and don't fall back to a full source build
+build_ok <- !env_is("LIBARROW_BUILD", "false")
+
+# Check if we're authorized to download (not asked an offline build).
+# (Note that cmake will still be downloaded if necessary
+# https://arrow.apache.org/docs/developers/cpp/building.html#offline-builds)
+download_ok <- !test_mode && !env_is("TEST_OFFLINE_BUILD", "true")
+
+# This "tools/thirdparty_dependencies" path, within the tar file, might exist
if
+# create_package_with_all_dependencies() was run, or if someone has created it
+# manually before running make build.
+# If you change this path, you also need to edit
+# `create_package_with_all_dependencies()` in install-arrow.R
+thirdparty_dependency_dir <- Sys.getenv("ARROW_THIRDPARTY_DEPENDENCY_DIR",
"tools/thirdparty_dependencies")
+
+# configure.win uses a different libarrow dir and and the zip is already nested
+dst_dir <- ifelse(on_windows, "windows", paste0("libarrow/arrow-", VERSION))
if (!test_mode && !file.exists(paste0(dst_dir, "/include/arrow/api.h"))) {
Review Comment:
:exploding_head:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]