Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report CRAN rust versions #40

Open
JosiahParry opened this issue Sep 7, 2024 · 0 comments
Open

Report CRAN rust versions #40

JosiahParry opened this issue Sep 7, 2024 · 0 comments

Comments

@JosiahParry
Copy link
Contributor

We can begin reporting CRAN's rust versions by using this script.
It relies on the CRAN check status of @albersonmiranda's {fio} package

library(rvest)

check_links <- "https://cran.r-project.org/web/checks/check_results_fio.html" |> 
  read_html() |> 
  html_node(".container") |> 
  html_nodes("a") |> 
  html_attr("href") 

check_links <- unique(check_links[grepl("^https://", check_links)])

install_logs <- gsub(
  "00check.html",
  "00install.html",
  check_links
)

extract_semver <- function(ver) {
  if (grepl("\\d+\\.\\d+(\\.\\d+)?", ver)) {
    sub(".*?(\\d+\\.\\d+(\\.\\d+)?).*", "\\1", ver)
  } else {
    NA
  }
}

versions <- lapply(install_logs, function(.log) {
  message("Extracting Rust & Cargo version from ", .log)
  lns <- readLines(.log)
  rust_version <- extract_semver(lns[grepl("^Rust version:", lns)])
  cargo_version <- extract_semver(lns[grepl("^Cargo version:", lns)])
  data.frame(rustc = rust_version, cargo = cargo_version)
})


# get all of the flavors
flavor <- dirname(
  gsub("https://www.r-project.org/nosvn/r.check/", "", tolower(install_logs))
)

res <- cbind(
  flavor = flavor,
  do.call(rbind.data.frame, versions)
) |> 
  dplyr::mutate(rustc = numeric_version(rustc), cargo = numeric_version(cargo)) |> 
  dplyr::arrange(rustc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant