build-cran-binaries/local/debug-packages-writing.R

79 lines
1.7 KiB
R

library(future)
future::plan(multisession)
future::plan(sequential)
time = Sys.time()
files <- s3fs::s3_dir_ls(
sprintf(
"devxy-r-package-binaries-hel1/arm64/rhel9/latest/src/contrib/Archive"
),
recurse = T
)
Sys.time() - time
archive <- llply(dirs, function(dir) {
files <- list.files(
dir,
recursive = FALSE,
full.names = TRUE,
pattern = "*.tar.gz"
)
if (length(files) == 0) {
print(paste0("Error: Empty directory: ", dir))
return(NULL)
}
info <- file.info(files)
tryCatch(
{
rownames(info) <- paste0(basename(dirname(files)), "/", basename(files))
},
error = function(e) {
print(paste0("Error: Exception catched for Archived directory: ", dir))
print(e)
return(NULL)
}
)
info
})
tryCatch(
{
rownames(info) <- paste0(basename(dirname(files)), "/", basename(files))
},
error = function(e) {
print(paste0("Error: Exception catched for Archived directory: ", dir))
print(e)
return(NULL)
}
)
curl::curl_download(
"https://cran.devxy.io/amd64/rhel9/latest/src/contrib/PACKAGES.db",
"PACKAGES.db"
)
con = DBI::dbConnect(RSQLite::SQLite(), "PACKAGES.db")
df = DBI::dbReadTable(con, "packages")
cranlike:::write_packages_files("/tmp", "PACKAGES.db")
# check
which(grepl("digest", df$Package))
which(grepl("digest", df$Package))
system("cat /tmp/PACKAGES | grep '^Package: digest' | wc -l")
curl::curl_fetch_memory(
"https://cloud.r-project.org/src/contrib/Meta/archive.rds"
)
remotes = readRDS(url(
"https://cloud.r-project.org/src/contrib/Meta/archive.rds",
"rb"
))
packages = readRDS(url(
"https://cran.devxy.io/arm64/noble/latest/src/contrib/PACKAGES.rds",
"rb"
))