Copilot commented on code in PR #55492:
URL: https://github.com/apache/arrow/pull/55492#discussion_r4532945868


##########
r/tools/nixlibs.R:
##########
@@ -625,30 +625,35 @@ build_libarrow <- function(src_dir, dst_dir) {
   env_var_list <- with_cloud_support(env_var_list)
   env_var_list <- with_wasm_support(env_var_list)
 
-  # turn_off_all_optional_features() needs to happen after
-  # with_cloud_support(), since it might turn features ON.
+  # turn_off_all_optional_features() and turn_off_unvendored_features() need to
+  # happen after with_cloud_support(), since it might turn features ON.
   thirdparty_deps_unavailable <- !download_ok &&
     !dir.exists(thirdparty_dependency_dir) &&
     !env_is("ARROW_DEPENDENCY_SOURCE", "system")
   do_minimal_build <- env_is("LIBARROW_MINIMAL", "true")
+  # Thirdparty source tarballs shipped in the package
+  vendored <- usable_vendored_dependencies(src_dir)
 
   if (do_minimal_build) {
     env_var_list <- turn_off_all_optional_features(env_var_list)
   } else if (thirdparty_deps_unavailable) {
     cat(paste0(
       "*** Building C++ library from source, but downloading thirdparty 
dependencies\n",
-      "    is not possible, so this build will turn off all thirdparty 
features.\n",
+      "    is not possible, so this build will turn off the thirdparty 
features\n",
+      "    whose sources are not included in the package.\n",
       "    See installation guide for details:\n",
       "    https://arrow.apache.org/docs/r/articles/install.html\n";
     ))
-    env_var_list <- turn_off_all_optional_features(env_var_list)
+    env_var_list <- turn_off_unvendored_features(env_var_list, names(vendored))
   } else if (dir.exists(thirdparty_dependency_dir)) {
     # Add the *_SOURCE_URL env vars
     env_var_list <- set_thirdparty_urls(env_var_list)
   }
-  # Some thirdparty dependencies are required even for a minimal build, so they
-  # can't be turned off like the ones above.
-  env_var_list <- with_vendored_dependencies(env_var_list)
+  # Point the build at the vendored sources of the thirdparty dependencies.
+  # Some of them are required even for a minimal build, so they can't be turned
+  # off like the ones above.
+  env_var_list <- with_vendored_dependencies(env_var_list, vendored)

Review Comment:
   The trimmed Boost/Thrift archives are selected even when 
`ARROW_ENABLE_THREADING=OFF`, including webR builds configured by 
`with_wasm_support()`. This disables `ARROW_BOOST_FOR_THRIFT_ONLY`, so CMake 
takes the upstream build paths, but both archives lack their CMake projects and 
configuration fails even with network access. Gate these archives on a 
compatible build configuration before offline feature selection, disabling 
Parquet offline when necessary, or extend the minimal CMake path to support 
these builds.



##########
r/tools/nixlibs.R:
##########
@@ -625,30 +625,35 @@ build_libarrow <- function(src_dir, dst_dir) {
   env_var_list <- with_cloud_support(env_var_list)
   env_var_list <- with_wasm_support(env_var_list)
 
-  # turn_off_all_optional_features() needs to happen after
-  # with_cloud_support(), since it might turn features ON.
+  # turn_off_all_optional_features() and turn_off_unvendored_features() need to
+  # happen after with_cloud_support(), since it might turn features ON.
   thirdparty_deps_unavailable <- !download_ok &&
     !dir.exists(thirdparty_dependency_dir) &&
     !env_is("ARROW_DEPENDENCY_SOURCE", "system")
   do_minimal_build <- env_is("LIBARROW_MINIMAL", "true")
+  # Thirdparty source tarballs shipped in the package
+  vendored <- usable_vendored_dependencies(src_dir)
 
   if (do_minimal_build) {
     env_var_list <- turn_off_all_optional_features(env_var_list)
   } else if (thirdparty_deps_unavailable) {
     cat(paste0(
       "*** Building C++ library from source, but downloading thirdparty 
dependencies\n",
-      "    is not possible, so this build will turn off all thirdparty 
features.\n",
+      "    is not possible, so this build will turn off the thirdparty 
features\n",
+      "    whose sources are not included in the package.\n",
       "    See installation guide for details:\n",
       "    https://arrow.apache.org/docs/r/articles/install.html\n";
     ))
-    env_var_list <- turn_off_all_optional_features(env_var_list)
+    env_var_list <- turn_off_unvendored_features(env_var_list, names(vendored))
   } else if (dir.exists(thirdparty_dependency_dir)) {
     # Add the *_SOURCE_URL env vars
     env_var_list <- set_thirdparty_urls(env_var_list)
   }
-  # Some thirdparty dependencies are required even for a minimal build, so they
-  # can't be turned off like the ones above.
-  env_var_list <- with_vendored_dependencies(env_var_list)
+  # Point the build at the vendored sources of the thirdparty dependencies.
+  # Some of them are required even for a minimal build, so they can't be turned
+  # off like the ones above.
+  env_var_list <- with_vendored_dependencies(env_var_list, vendored)
+  use_vendored_checksums(src_dir, env_var_list, vendored)

Review Comment:
   This permanently replaces the checksums in the package's source tree. If 
installation is retried from that directory with 
`ARROW_THIRDPARTY_DEPENDENCY_DIR` or an explicit dependency URL pointing to an 
upstream archive, `use_vendored_checksums()` leaves that dependency untouched, 
so CMake checks the upstream archive against the previous trimmed checksum and 
rejects it. Preserve and restore versions.txt around the build, including when 
the build fails.



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