From 647abec4c62b26765beaf8cb397f0ca687bdffb4 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Sun, 15 Sep 2024 08:22:30 -0500 Subject: [PATCH 1/5] Add rocky + opensuse to allow list for binaries --- r/tools/nixlibs-allowlist.txt | 2 ++ r/tools/nixlibs.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/r/tools/nixlibs-allowlist.txt b/r/tools/nixlibs-allowlist.txt index bd9f0c1b2c084..f3a5c0cb4e0e8 100644 --- a/r/tools/nixlibs-allowlist.txt +++ b/r/tools/nixlibs-allowlist.txt @@ -2,3 +2,5 @@ ubuntu centos redhat rhel +rocky +opensuse-leap diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index fc79e06328005..81b04062ef913 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -222,7 +222,7 @@ check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apa # 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") + error = function(e) c("ubuntu", "centos", "redhat", "rhel", "rocky", "opensuse-leap") ) # allowlist should contain valid regular expressions (plain strings ok too) any(grepl(paste(allowlist, collapse = "|"), os)) From b8d9d129d87f59ddfc1f94f48f207c73595ab0a3 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Sat, 21 Sep 2024 13:41:50 -0500 Subject: [PATCH 2/5] more general opensuse, readlines --- r/tools/nixlibs-allowlist.txt | 2 +- r/tools/nixlibs.R | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/r/tools/nixlibs-allowlist.txt b/r/tools/nixlibs-allowlist.txt index f3a5c0cb4e0e8..86902023763a2 100644 --- a/r/tools/nixlibs-allowlist.txt +++ b/r/tools/nixlibs-allowlist.txt @@ -3,4 +3,4 @@ centos redhat rhel rocky -opensuse-leap +opensuse diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 81b04062ef913..ae8c059b440fa 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -217,12 +217,12 @@ identify_binary <- function(lib = Sys.getenv("LIBARROW_BINARY"), info = distro() lib } -check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apache/arrow/main/r/tools/nixlibs-allowlist.txt") { +check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apache/arrow/main/r/tools/nixibs-allowlist.txt") { 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", "rocky", "opensuse-leap") + # 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)) From 7205ca18a69657629288956d64de17999266f998 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 8 Oct 2024 07:20:07 -0500 Subject: [PATCH 3/5] Update r/tools/nixlibs.R Co-authored-by: eitsupi <50911393+eitsupi@users.noreply.github.com> --- r/tools/nixlibs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index ae8c059b440fa..ef6c1700b1ad9 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -217,7 +217,7 @@ identify_binary <- function(lib = Sys.getenv("LIBARROW_BINARY"), info = distro() lib } -check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apache/arrow/main/r/tools/nixibs-allowlist.txt") { +check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apache/arrow/main/r/tools/nixlibs-allowlist.txt") { allowlist <- tryCatch( # Try a remote allowlist so that we can add/remove without a release suppressWarnings(readLines(allowed)), From 9b8dfff63ed2ab480c8111bd7117b66e0abc6e6e Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 8 Oct 2024 07:35:35 -0500 Subject: [PATCH 4/5] Fix the tests in test-nixlibs.r --- r/tools/test-nixlibs.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index 02e822c3420c8..1bb325c779cf7 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. + local_dir("..") + tf <- tempfile() cat("tu$\n^cent\n^dar\n", file = tf) expect_true(check_allowlist("ubuntu", tf)) From 95e606e162a303b5d056b9d23b8c516560c47a82 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 8 Oct 2024 08:18:24 -0500 Subject: [PATCH 5/5] Update r/tools/test-nixlibs.R --- r/tools/test-nixlibs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index 1bb325c779cf7..838b39ac54c73 100644 --- a/r/tools/test-nixlibs.R +++ b/r/tools/test-nixlibs.R @@ -152,7 +152,7 @@ test_that("check_allowlist", { # (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. - local_dir("..") + withr::local_dir("..") tf <- tempfile() cat("tu$\n^cent\n^dar\n", file = tf)