nealrichardson commented on code in PR #39587:
URL: https://github.com/apache/arrow/pull/39587#discussion_r1451850193


##########
r/tools/nixlibs.R:
##########
@@ -116,33 +105,64 @@ download_binary <- function(lib) {
   # validate binary checksum for CRAN release only
   if (!skip_checksum && dir.exists(checksum_path) && is_release ||
     enforce_checksum) {
+    # Munge the path to the correct sha file which we include during the
+    # release process
     checksum_file <- sub(".+/bin/(.+\\.zip)", "\\1\\.sha512", binary_url)
     checksum_file <- file.path(checksum_path, checksum_file)
-    checksum_cmd <- "shasum"
-    checksum_args <- c("--status", "-a", "512", "-c", checksum_file)
-
-    # shasum is not available on all linux versions
-    status_shasum <- try(
-      suppressWarnings(
-        system2("shasum", args = c("--help"), stdout = FALSE, stderr = FALSE)
-      ),
-      silent = TRUE
+
+    # Try `shasum`, and if that doesn't work, fall back to `sha512sum` if not 
found
+    checksum_ok <- tryCatch({
+      system2(
+        "shasum",
+        args = c("--status", "-a", "512", "-c", checksum_file),
+        stdout = FALSE,
+        stderr = FALSE
+      ) == 0
+    },
+    error = function(e) {
+      system2(
+        "shasum",

Review Comment:
   If I read the old code correctly, this should be 
   ```suggestion
           "sha512sum",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to