diff --git a/r/tools/nixlibs-allowlist.txt b/r/tools/nixlibs-allowlist.txt index bd9f0c1b2c084..86902023763a2 100644 --- a/r/tools/nixlibs-allowlist.txt +++ b/r/tools/nixlibs-allowlist.txt @@ -2,3 +2,5 @@ ubuntu centos redhat rhel +rocky +opensuse diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index fc79e06328005..ef6c1700b1ad9 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -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)) diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index 02e822c3420c8..838b39ac54c73 100644 --- a/r/tools/test-nixlibs.R +++ b/r/tools/test-nixlibs.R @@ -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))