jonkeane commented on code in PR #38534:
URL: https://github.com/apache/arrow/pull/38534#discussion_r1388229597
##########
r/tools/nixlibs.R:
##########
@@ -44,17 +46,32 @@ find_latest_nightly <- function(description_version) {
res <- try(
{
# Binaries are only uploaded if all jobs pass so can just look at the
source versions.
- urls <- readLines("https://nightlies.apache.org/arrow/r/src/contrib")
- versions <- grep("arrow_.*\\.tar\\.gz", urls, value = TRUE)
- versions <- sub(".*arrow_(.*)\\.tar\\.gz.*", "\\1", x = versions)
- versions <- sapply(versions, package_version)
- versions <- data.frame(do.call(rbind, versions))
- matching_major <- versions[versions$X1 == description_version[1, 1], ]
- latest <- matching_major[which.max(matching_major$X4), ]
- package_version(paste0(latest, collapse = "."))
+ urls <- readLines(list_uri)
+ versions <- grep("Version:\\s*.*?", urls, value = TRUE)
+ versions <- sort(package_version(sub("Version:\\s*", "\\1", versions)))
+ major_versions <- vapply(
+ versions,
+ function(x) as.integer(x[[c(1, 1)]]),
+ integer(1)
+ )
+
+ description_version_major <- as.integer(description_version[1, 1])
+ matching_major <- major_versions == description_version_major
+ if (!any(matching_major)) {
+ lg(
+ "No nightly binaries were found for version %s: falling back to
libarrow build from source",
+ description_version
+ )
+
+ return(description_version)
+ }
+
+ versions <- versions[matching_major]
+ versions[[length(versions)]]
Review Comment:
Would this be equivalent here?
```suggestion
max(versions)
```
If so, it might be nicer since it's clearer that you're taking the largest
available version (as opposed to the last version available, which above is
sorted such that it's actually the largest), no?
--
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]