Skip to content

Commit

Permalink
apacheGH-39041:[R] Improve update-checksum.R output (apache#39042)
Browse files Browse the repository at this point in the history
### Rationale for this change

The script was to quiet.

### What changes are included in this PR?

Fix regex and add some output: 
```
Rscript tools/update-checksums.R 14.0.0                                                                           1 ✘
[1] "Extracting libarrow binary paths from tasks.yml"
[1] "Downloading windows/arrow-14.0.0.zip.sha512"
[1] "Converting windows/arrow-14.0.0.zip to windows style line endings"
[1] "Downloading linux-openssl-1.0/arrow-14.0.0.zip.sha512"
[1] "Downloading linux-openssl-1.1/arrow-14.0.0.zip.sha512"
[1] "Downloading linux-openssl-3.0/arrow-14.0.0.zip.sha512"
[1] "Downloading darwin-arm64-openssl-1.1/arrow-14.0.0.zip.sha512"
[1] "Downloading darwin-arm64-openssl-3.0/arrow-14.0.0.zip.sha512"
[1] "Downloading darwin-x86_64-openssl-1.1/arrow-14.0.0.zip.sha512"
[1] "Downloading darwin-x86_64-openssl-3.0/arrow-14.0.0.zip.sha512"
[1] "Checksums updated successfully!"
```

### Are these changes tested?
locally 

### Are there any user-facing changes?
no
* Closes: apache#39041

Authored-by: Jacob Wujciak-Jens <jacob@wujciak.de>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
assignUser authored Dec 5, 2023
1 parent cf80bd1 commit 7346bdf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions r/tools/update-checksums.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if (!file.exists(tasks_yml)) {
stop("Run this script from the r/ directory of the arrow repo")
}

cat("Extracting libarrow binary paths from tasks.yml\n")
# Get the libarrow binary paths from the tasks.yml file
binary_paths <- readLines(tasks_yml) |>
grep("r-lib__libarrow", x = _, value = TRUE) |>
Expand All @@ -53,15 +54,19 @@ for (path in binary_paths) {
sha_path <- paste0(path, ".sha512")
file <- file.path("tools/checksums", sha_path)
dirname(file) |> dir.create(path = _, recursive = TRUE, showWarnings = FALSE)


cat(paste0("Downloading ", sha_path, "\n"))
url <- sprintf(artifactory_root, VERSION, sha_path)
download.file(url, file, quiet = TRUE, cacheOK = FALSE)

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", args = c("-i", "s/\\\\r//", file))
if (sed_status != 0) {
stop("Failed to remove \\r from windows checksum file. Exit code: ", sed_status)
}
}
}

cat("Checksums updated successfully!\n")

0 comments on commit 7346bdf

Please sign in to comment.