jonkeane opened a new issue, #55696:
URL: https://github.com/apache/arrow/issues/55696

   ### Describe the enhancement requested
   
   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `make build` in `r/` fails if `tools/vendored/` is left over from an earlier 
`make sync-cpp`:
   
   ```
   *** Found local C++ source: '../cpp'
   *** Building libarrow from source
   **** cmake 3.31.6: /opt/homebrew/bin/cmake
   tools/download_dependencies_R.sh: line 59: 
.../r/tools/cpp/thirdparty/versions.txt: No such file or directory
   Error in get_component_names() : Failed to run download_dependencies_R.sh
   Calls: build_libarrow ... usable_vendored_dependencies -> get_component_names
   Execution halted
   ```
   
   What happens:
   
   1. `make build` runs `make clean`, which deletes `tools/cpp/` but not 
`tools/vendored/`.
   2. `make doc` runs `devtools::load_all()`, which builds libarrow from 
`../cpp`.
   3. `usable_vendored_dependencies()` finds `tools/vendored/checksums.txt`, so 
it calls `get_component_names()`. That runs `tools/download_dependencies_R.sh`, 
which reads `tools/cpp/thirdparty/versions.txt`. `make clean` just deleted that 
file, so the build fails.
   
   `tools/vendored/` is generated by `make sync-cpp` (via 
`tools/vendor_dependencies.sh`), just like `tools/cpp/`, so `make clean` should 
remove it too. `make build` runs `sync-cpp` after `doc`, so the folder is 
recreated before `R CMD build`. Downloads are cached in 
`tools/vendored-downloads/`, so recreating it should be cheap.
   
   Workaround: `rm -rf tools/vendored` before `make build`.
   
   ### Proposed fix
   
   Add `tools/vendored/` to the `rm -rf` line of the `clean` target in 
`r/Makefile`:
   
   ```make
   -rm -rf tools/cpp/ tools/vendored/ tools/dotenv tools/NOTICE.txt 
tools/LICENSE.txt
   ```
   
   This was introduced in GH-55478.
   
   A more robust fix might be to have `get_component_names()` take a 
versions.txt path and have `download_dependencies_R.sh` accept an override, for 
example through an env var, defaulting to `tools/cpp/...`. Then 
`usable_vendored_dependencies()` could pass `file.path(src_dir, "thirdparty", 
"versions.txt")`. This fixes it for anyone building from a git checkout who has 
a leftover `tools/vendored` but no `tools/cpp`. The mock in 
[test-nixlibs.R:266](vscode-webview://18aaetoqa5jaa2rsv509qmh3s1rko4j9hrldarj4g1evgbht3je3/tools/test-nixlibs.R#L266)
 would need to accept the new argument.
   
   ### Component(s)
   
   R
   
   
   ### Component(s)
   
   R


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