jonkeane commented on a change in pull request #11001: URL: https://github.com/apache/arrow/pull/11001#discussion_r699278771
########## File path: r/R/install-arrow.R ########## @@ -137,3 +136,66 @@ reload_arrow <- function() { message("Please restart R to use the 'arrow' package.") } } + + +#' Download all optional Arrow dependencies +#' +#' @param deps_dir Directory to save files into. Will be created if necessary. +#' Defaults to the value of `ARROW_THIRDPARTY_DEPENDENCY_DIR`, if that +#' environment variable is set. +#' @param download_dependencies_sh location of the dependency download script, +#' defaults to the one included with the arrow package. +#' +#' @return `deps_dir`, invisibly +#' +#' This function is used for setting up an offline build. If it's possible to +#' download at build time, don't use this function. Instead, let `cmake` +#' download them for you. +#' If the files already exist in `deps_dir`, they will be re-downloaded and +#' overwritten. Do not put other files in this directory. +#' These saved files are only used in the build if `ARROW_DEPENDENCY_SOURCE` +#' is unset, `BUNDLED`, or `AUTO`. +#' https://arrow.apache.org/docs/developers/cpp/building.html#offline-builds +#' +#' ## Steps for an offline install with optional dependencies: +#' +#' ### Using a computer with internet access, pre-download the dependencies: +#' * Install the `arrow` package +#' * Run `download_optional_dependencies(my_dependencies)` +#' * Copy the directory `my-arrow-dependencies` to the computer without internet access +#' +#' ### On the computer without internet access, use the pre-downloaded dependencies: +#' * Create a environment variable called `ARROW_THIRDPARTY_DEPENDENCY_DIR` that +#' points to the newly copied `my_dependencies`. +#' * Install the `arrow` package +#' * This installation will build from source, so `cmake` must be available +#' * Run [arrow_info()] to check installed capabilities +#' +#' @examples +#' \dontrun{ +#' download_optional_dependencies("arrow-thirdparty") +#' list.files("arrow-thirdparty", "thrift-*") # "thrift-0.13.0.tar.gz" or similar +#' } +#' @export +download_optional_dependencies <- function( + deps_dir = Sys.getenv("ARROW_THIRDPARTY_DEPENDENCY_DIR"), + # This script is copied over from arrow/cpp/... to arrow/r/inst/... + download_dependencies_sh = system.file( + "thirdparty/download_dependencies.sh", + package = "arrow", + mustWork = TRUE Review comment: To start, I've made this an argument to the function so that we can call it without installing in CI. We could also do this as an environment variable like we do for `deps_dir` (either internally or as an argument here). I don't have strong feelings one way or the other, though since this is pretty internal-use / CI-use only we might be best off not exposing this as an argument at all. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org