add range arg to list pkgs without binaries

This commit is contained in:
Patrick Schratz 2024-11-20 20:19:28 +01:00
commit 7833c101c2
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -71,24 +71,26 @@ df_summary <- df_missing_pkgs %>%
count()
# Extract and copy missing package names for each architecture and ID combination
extract_and_copy_pkgs <- function(df, arch, id, clip = FALSE) {
extract_and_copy_pkgs <- function(df, arch, range = 300, 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 = "")
# Format, remove line breaks, and print as a single line
formatted_pkgs <- gsub('"', "'", capture.output(dput(pkgs[1:range])))
formatted_pkgs_one_line <- paste(formatted_pkgs, collapse = " ")
cat(formatted_pkgs_one_line, "\n", sep = "")
if (clip) {
clipr::write_clip(formatted_pkgs)
clipr::write_clip(formatted_pkgs_one_line)
}
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_rhel8 <- extract_and_copy_pkgs(df_missing_pkgs, "amd64", "rhel8", range = 20, 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)