From 0707c0495f71418fde19249e7d7be8b0b0f6a5f5 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 8 Oct 2024 09:27:42 -0500 Subject: [PATCH] GH-44114: [R] Add Rocky and opensuse to the allowlist for libarrow binaries (#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 <50911393+eitsupi@users.noreply.github.com> --- r/tools/nixlibs-allowlist.txt | 2 ++ r/tools/nixlibs.R | 4 ++-- r/tools/test-nixlibs.R | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) 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))