nealrichardson commented on a change in pull request #11001:
URL: https://github.com/apache/arrow/pull/11001#discussion_r696709923



##########
File path: r/tools/nixlibs.R
##########
@@ -209,75 +222,21 @@ find_available_binary <- function(os) {
   os
 }
 
-download_source <- function() {
-  tf1 <- tempfile()
-  src_dir <- tempfile()
-
-  # Given VERSION as x.y.z.p
-  p <- package_version(VERSION)[1, 4]
-  if (is.na(p) || p < 1000) {
-    # This is either just x.y.z or it has a small (R-only) patch version
-    # Download from the official Apache release, dropping the p
-    VERSION <- as.character(package_version(VERSION)[1, -4])
-    if (apache_download(VERSION, tf1)) {
-      untar(tf1, exdir = src_dir)
-      unlink(tf1)
-      src_dir <- paste0(src_dir, "/apache-arrow-", VERSION, "/cpp")
-    }
-  } else if (p != 9000) {
-    # This is a custom dev version (x.y.z.9999) or a nightly (x.y.z.20210505)
-    # (Don't try to download on the default dev .9000 version)
-    if (nightly_download(VERSION, tf1)) {
-      unzip(tf1, exdir = src_dir)
-      unlink(tf1)
-      src_dir <- paste0(src_dir, "/cpp")
-    }
-  }
-
-  if (dir.exists(src_dir)) {
-    cat("*** Successfully retrieved C++ source\n")
-    options(.arrow.cleanup = c(getOption(".arrow.cleanup"), src_dir))
-    # These scripts need to be executable
-    system(
-      sprintf("chmod 755 %s/build-support/*.sh", src_dir),
-      ignore.stdout = quietly, ignore.stderr = quietly
-    )
-    return(src_dir)
-  } else {
-    return(NULL)
-  }
-}
-
-nightly_download <- function(version, destfile) {
-  source_url <- paste0(arrow_repo, "src/arrow-", version, ".zip")
-  try_download(source_url, destfile)
-}
-
-apache_download <- function(version, destfile, n_mirrors = 3) {
-  apache_path <- paste0("arrow/arrow-", version, "/apache-arrow-", version, 
".tar.gz")
-  apache_urls <- c(
-    # This returns a different mirror each time
-    rep("https://www.apache.org/dyn/closer.lua?action=download&filename=";, 
n_mirrors),
-    "https://downloads.apache.org/"; # The backup
+find_local_source <- function() {
+  # We'll take the first of these that exists
+  # The first case probably occurs if we're in the arrow git repo
+  # The second probably occurs if we're installing the arrow R package
+  cpp_dir_options <- c(
+    Sys.getenv("ARROW_SOURCE_HOME", ".."),
+    "tools/cpp"

Review comment:
       Since the other one doesn't have `cpp` in the path, this one shouldn't 
either. We could change it so that we expect the env var to point directly to 
the cpp dir instead of the apache/arrow top level; that's probably safe to do 
because I can't imagine anyone is using it, but technically it would be a 
breaking change.
   
   ```suggestion
       "tools"
   ```




-- 
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]


Reply via email to