Skip to content

Commit

Permalink
GH-44114: [R] Add Rocky and opensuse to the allowlist for libarrow bi…
Browse files Browse the repository at this point in the history
…naries (#44124)

### Rationale for this change

Add two distros not checked on CRAN to our allow list for easier binary
installs

### What changes are included in this PR?

Added to distro names

### Are these changes tested?

These configurations are tested elsewhere, the real test will come later
if CRAN somehow runs these covertly

### Are there any user-facing changes?

Faster, more reliably installs without intervention
* GitHub Issue: #44114

---------

Co-authored-by: eitsupi <[email protected]>
  • Loading branch information
jonkeane and eitsupi authored Oct 8, 2024
1 parent 64891d1 commit 0707c04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions r/tools/nixlibs-allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ ubuntu
centos
redhat
rhel
rocky
opensuse
4 changes: 2 additions & 2 deletions r/tools/nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apa
allowlist <- tryCatch(
# Try a remote allowlist so that we can add/remove without a release
suppressWarnings(readLines(allowed)),
# Fallback to default: allowed only on Ubuntu and CentOS/RHEL
error = function(e) c("ubuntu", "centos", "redhat", "rhel")
# Fallback to default allow list shipped with the package
error = function(e) readLines("tools/nixlibs-allowlist.txt")
)
# allowlist should contain valid regular expressions (plain strings ok too)
any(grepl(paste(allowlist, collapse = "|"), os))
Expand Down
7 changes: 7 additions & 0 deletions r/tools/test-nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ test_that("select_binary() with test program", {
})

test_that("check_allowlist", {
# because we read from a file when we can't get the allow list from github,
# we need to make sure we are in the same directory as we would be when building
# (which is one level higher, so we can find `tools/nixlibs.R`)
# TODO: it's possible that we don't want to run this whole file in that directory
# like we do currently.
withr::local_dir("..")

tf <- tempfile()
cat("tu$\n^cent\n^dar\n", file = tf)
expect_true(check_allowlist("ubuntu", tf))
Expand Down

0 comments on commit 0707c04

Please sign in to comment.