From 1da2c9b42f6513fff1ffd73ef6493bd04a46908d Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Mon, 24 Feb 2025 11:25:55 -0800 Subject: [PATCH] Update update-checksums.R --- r/tools/update-checksums.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/r/tools/update-checksums.R b/r/tools/update-checksums.R index f41652e87849e..5502c9c9cee6b 100644 --- a/r/tools/update-checksums.R +++ b/r/tools/update-checksums.R @@ -28,6 +28,13 @@ args <- commandArgs(TRUE) VERSION <- args[1] tools_root <- "" +# Use gsed on macOS and sed otherwise +if (identical(unname(Sys.info()["sysname"]), "Darwin")) { + SED_BIN <- "gsed" +} else { + SED_BIN <- "sed" +} + if (length(args) != 1) { stop("Usage: Rscript tools/update-checksums.R ") } @@ -62,7 +69,7 @@ for (path in binary_paths) { if (grepl("windows", path)) { cat(paste0("Converting ", path, " to windows style line endings\n")) # UNIX style line endings cause errors with mysys2 sha512sum - sed_status <- system2("sed", args = c("-i", "s/\\\\r//", file)) + sed_status <- system2(SED_BIN, args = c("-i", "s/\\\\r//", file)) if (sed_status != 0) { stop("Failed to remove \\r from windows checksum file. Exit code: ", sed_status) }