Repository navigation
GH-35140: [R] Rewrite configure script and ensure we don't use mismatched libarrow #35147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
fdcc1e4
GH-35140: [R] configure script needs LIB_DIR to find ArrowOptions.cmake
nealrichardson a3070a0
Test that features are enabled in r-arrow conda packages
nealrichardson 226785e
Add quoting around LIB_DIR setting, for good measure
nealrichardson 4c9b525
Move conda recipe test to the right place
nealrichardson 3871b4b
Revert "GH-35140: [R] configure script needs LIB_DIR to find ArrowOpt…
nealrichardson 4531e0d
Apply @kou's homebrew patch
nealrichardson 8379505
Comments and cleanup
nealrichardson 50617af
Start refactoring configure into functions
nealrichardson 274e9d0
Add version check function
nealrichardson 57985e4
Progress commit but need to rework dev version check
nealrichardson a4114a0
Move version check to R script and add tests
nealrichardson 8223673
Factor out set_pkg_vars
nealrichardson 580608e
More reorg
nealrichardson c374797
Documentation, simplification, and only auto-autobrew on release version
nealrichardson 3a938c9
Pull libarrow version from arrow.pc even if pkg-config not found
nealrichardson 5496802
A few (final?) cleanups and reorgs
nealrichardson 77f3e53
More robust prefix
nealrichardson b6f8b85
Fix conda validation
nealrichardson b6d196e
Fix LIB_DIR setting by pkg-config
nealrichardson f218790
FORCE_AUTOBREW in binary packaging job
nealrichardson d88f71a
Directly set LIB_DIR
nealrichardson fe349e2
Apply suggestions from @kou
nealrichardson a4f56d7
Update r/configure
nealrichardson 345f9fc
final final changes
nealrichardson ada985b
Apply suggestions from code review
nealrichardson cb50393
Factor out find_or_build_libarrow and move up for readability
nealrichardson a769f6a
Tweak version check messages
nealrichardson 5942f69
Update installation vignettes to match
nealrichardson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| args <- commandArgs(TRUE) | ||
|
|
||
| # TESTING is set in test-check-version.R; it won't be set when called from configure | ||
| test_mode <- exists("TESTING") | ||
|
|
||
| check_versions <- function(r_version, cpp_version) { | ||
| r_parsed <- package_version(r_version) | ||
| r_dev_version <- r_parsed[1, 4] | ||
| r_is_dev <- !is.na(r_dev_version) && r_dev_version > 100 | ||
| cpp_is_dev <- grepl("SNAPSHOT$", cpp_version) | ||
| cpp_parsed <- package_version(sub("-SNAPSHOT$", "", cpp_version)) | ||
|
|
||
| major <- function(x) as.numeric(x[1, 1]) | ||
| # R and C++ denote dev versions differently | ||
| # R is current.release.9000, C++ is next.release-SNAPSHOT | ||
| # So a "match" is if the R major version + 1 = C++ major version | ||
| if (r_is_dev && cpp_is_dev && major(r_parsed) + 1 == major(cpp_parsed)) { | ||
| msg <- c( | ||
| sprintf("*** > Packages are both on development versions (%s, %s)", cpp_version, r_version), | ||
| "*** > If installation fails, rebuild the C++ library to match the R version", | ||
| "*** > or retry with FORCE_BUNDLED_BUILD=true" | ||
| ) | ||
| cat(paste0(msg, "\n", collapse = "")) | ||
| } else if (r_version != cpp_version) { | ||
| cat( | ||
| sprintf( | ||
| "**** Not using: C++ library version (%s) does not match R package (%s)\n", | ||
| cpp_version, | ||
| r_version | ||
| ) | ||
| ) | ||
| stop("version mismatch") | ||
| # Add ALLOW_VERSION_MISMATCH env var to override stop()? (Could be useful for debugging) | ||
| } else { | ||
| # OK | ||
| cat(sprintf("**** C++ and R library versions match: %s\n", cpp_version)) | ||
| } | ||
| } | ||
|
|
||
| if (!test_mode) { | ||
| check_versions(args[1], args[2]) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| # Usage: run testthat::test_dir(".") inside of this directory | ||
|
|
||
| # Flag so that we just load the functions and don't evaluate them like we do | ||
| # when called from configure.R | ||
| TESTING <- TRUE | ||
|
|
||
| source("check-versions.R", local = TRUE) | ||
|
|
||
| test_that("check_versions", { | ||
| expect_output( | ||
| check_versions("10.0.0", "10.0.0"), | ||
| "**** C++ and R library versions match: 10.0.0", | ||
| fixed = TRUE | ||
| ) | ||
| expect_output( | ||
| expect_error( | ||
| check_versions("10.0.0", "10.0.0-SNAPSHOT"), | ||
| "version mismatch" | ||
| ), | ||
| "**** Not using: C++ library version (10.0.0-SNAPSHOT) does not match R package (10.0.0)", | ||
| fixed = TRUE | ||
| ) | ||
| expect_output( | ||
| expect_error( | ||
| check_versions("10.0.0.9000", "10.0.0-SNAPSHOT"), | ||
| "version mismatch" | ||
| ), | ||
| "**** Not using: C++ library version (10.0.0-SNAPSHOT) does not match R package (10.0.0.9000)", | ||
| fixed = TRUE | ||
| ) | ||
| expect_output( | ||
| expect_error( | ||
| check_versions("10.0.0.9000", "10.0.0"), | ||
| "version mismatch" | ||
| ), | ||
| "**** Not using: C++ library version (10.0.0) does not match R package (10.0.0.9000)", | ||
| fixed = TRUE | ||
| ) | ||
| expect_output( | ||
| check_versions("10.0.0.9000", "11.0.0-SNAPSHOT"), | ||
| "*** > Packages are both on development versions (11.0.0-SNAPSHOT, 10.0.0.9000)\n", | ||
| fixed = TRUE | ||
| ) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 Not necessary to ship this, of course, but I will add a 🗳️ to this I have needed to | wanted to do this while debugging in the past.