chore: clean local/

This commit is contained in:
Patrick Schratz 2024-11-15 00:18:18 +01:00
commit a65b93a367
Signed by: pat-s
GPG key ID: 3C6318841EF78925
3 changed files with 41 additions and 45 deletions

1
.gitignore vendored
View file

@ -6,5 +6,4 @@
.envrc .envrc
exec.sh exec.sh
exec.R exec.R
PACKAGES*
docs/ docs/

View file

@ -7,10 +7,3 @@ query_metadata_table() |>
arrange(desc(timestamp)) |> arrange(desc(timestamp)) |>
select(name, timestamp) |> select(name, timestamp) |>
filter(row_number()==1) filter(row_number()==1)
### Query index of package in the CRAN DB (which is sorted alphabetically)
pkgs <- tools::CRAN_package_db()$Package
pkgs <- setdiff(pkgs, c("biplotbootGUI", "Rsymphony", "PortfolioAnalytics", "ROI.plugin.symphony", "adea", "RInno", "skedastic", "RPushbullet", "SimNPH", "SimDesign","simCAT", "SIAmodules", "shinytest2", "shinyIRT", "ShinyItemAnalysis", "shiny.benchmark", "scDIFtest", "RSP", "ROracle", "ROI.plugin.qpoases", "ROI.plugin.cplex", "RmecabKo", "rmarchingcubes", "RcppMeCab", "Rcplex", "ravetools", "Rbeast", "Rblpapi", "RcppEnsmallen", "qtkit", "priorCON", "prior3D", "PerFit", "outlierensembles", "nomnoml", "mxfda", "MultBiplotR", "mstDIF", "mdsr", "makepipe", "lordif", "KSgeneral", "kequate", "jstager", "jrt", "irtreliability", "irtQ", "irtpwr", "irtawsi", "GRShiny", "gpuR", "googletraffic", "giacR", "gamstransfer", "flps", "flow", "filters", "faoutlier", "equateIRT", "EnrichIntersect", "EFA.dimensions", "DFIT", "D3mirt", "ctgdist", "CoTiMA", "ConvertPar", "clrng", "bscui", "BifactorIndicesCalculator", "autoFC", "airt"))
which(pkgs == "urca")
pkgs[19121:19122]

View file

@ -0,0 +1,101 @@
###
# Scope: List Packages for which the most recent CRAN release is not available
###
library(furrr)
library(cli)
library(dplyr)
library(data.table)
last_versions_cran <- available.packages("https://cloud.r-project.org/src/contrib")[, c("Package", "Version")]
arch <- c("amd64", "arm64")
os_ids <- c("rhel8", "rhel9", "noble", "jammy", "alpine320")
grid <- tidyr::expand_grid(arch = arch, os_ids = os_ids)
# Define the function to check for missing packages
check_package <- function(pkg_name, available_pkgs, version_cran, arch, os_id) {
if (pkg_name %in% available_pkgs$Package) {
version_devxy <- available_pkgs %>%
filter(Package == pkg_name) %>%
pull(Version)
if (is.na(version_devxy) || version_cran != version_devxy) {
# Package is missing or version mismatch
return(data.frame(pkg_name = pkg_name, arch = arch, ID = os_id))
}
} else {
# Package completely missing in devxy
return(data.frame(pkg_name = pkg_name, arch = arch, ID = os_id))
}
return(NULL) # No mismatch, no entry added
}
# Run the mapping with parallel processing for each (arch, os_id) combination
future::plan("multisession", workers = 5)
pkgs_missing <- future_map2(grid$arch, grid$os_ids, ~ {
# Prepare the URL and fetch available packages only once per (arch, os_id)
repo_url <- sprintf("https://cran.devxy.io/%s/%s/latest/src/contrib", .x, .y)
available_pkgs <- as.data.table(available.packages(contriburl = repo_url)[, c("Package", "Version")])
# Define the packages to check once
cran_pkgs <- as.data.table(last_versions_cran)
# Accumulate results in a list
pkg_entries <- list()
# Loop through each package name and check if it's missing
for (pkg_name in cran_pkgs$Package) {
version_cran <- cran_pkgs[Package == pkg_name, Version]
result <- check_package(pkg_name, available_pkgs, version_cran, .x, .y)
if (!is.null(result)) {
pkg_entries[[length(pkg_entries) + 1]] <- result
}
}
# Combine results for the current (arch, os_id)
if (length(pkg_entries) > 0) {
return(rbindlist(pkg_entries))
} else {
return(data.table(pkg_name = character(), arch = character(), ID = character()))
}
})
df_missing_pkgs <- rbindlist(pkgs_missing, fill = TRUE)
# Group and count missing packages by architecture and ID
df_summary <- df_missing_pkgs %>%
group_by(arch, ID) %>%
arrange(arch, ID) %>%
count()
# Extract and copy missing package names for each architecture and ID combination
extract_and_copy_pkgs <- function(df, arch, id, clip = FALSE) {
pkgs <- df %>%
filter(arch == arch, ID == id) %>%
pull(pkg_name)
# Print and copy to clipboard if needed
formatted_pkgs <- gsub('"', "'", capture.output(dput(pkgs[1:300])))
cat(formatted_pkgs, "\n", sep = "")
if (clip) {
clipr::write_clip(formatted_pkgs)
}
return(pkgs)
}
# Usage for different architecture and ID combinations
pkgs_missing_amd64_rhel8 <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "rhel8", clip = TRUE)
pkgs_missing_amd64_rhel9 <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "rhel9", clip = TRUE)
pkgs_missing_amd64_jammy <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "jammy", clip = TRUE)
pkgs_missing_amd64_noble <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "noble", clip = TRUE)
pkgs_missing_amd64_alpine320 <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "alpine320", clip = TRUE)
pkgs_missing_arm64_rhel8 <- extract_and_copy_pkgs(df_missing_pkgs, "arm64", "rhel8", clip = TRUE)
pkgs_missing_arm64_rhel9 <- extract_and_copy_pkgs(df_missing_pkgs, "arm64", "rhel9", clip = TRUE)
pkgs_missing_arm64_jammy <- extract_and_copy_pkgs(df_missing_pkgs, "arm64", "jammy", clip = TRUE)
pkgs_missing_arm64_noble <- extract_and_copy_pkgs(df_missing_pkgs, "arm64", "noble", clip = TRUE)
pkgs_missing_arm64_alpine320 <- extract_and_copy_pkgs(df_missing_pkgs, "arm64", "alpine320", clip = TRUE)