Merge pull request #224451 from jbedo/cran

rPackages: switch to official CRAN repository
This commit is contained in:
Justin Bedő 2023-04-06 08:51:02 +10:00 committed by GitHub
commit a9dd7b9e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3603 additions and 3484 deletions

View File

@ -43,6 +43,11 @@
"http://bioconductor.jp/packages/"
];
# CRAN mirrors
cran = [
"https://cran.r-project.org/src/contrib/"
];
# BitlBee mirrors, see https://www.bitlbee.org/main.php/mirrors.html
bitlbee = [
"https://get.bitlbee.org/"

File diff suppressed because it is too large Load Diff

View File

@ -68,9 +68,10 @@ let
hydraPlatforms = [];
};
deriveCran = mkDerive {
mkHomepage = {name, snapshot, ...}: "https://cran.r-project.org/${snapshot}/web/packages/${name}/";
mkUrls = {name, version, snapshot}: [
"https://packagemanager.rstudio.com/cran/${snapshot}/src/contrib/${name}_${version}.tar.gz"
mkHomepage = {name, ...}: "https://cran.r-project.org/web/packages/${name}/";
mkUrls = {name, version}: [
"mirror://cran/${name}_${version}.tar.gz"
"mirror://cran/Archive/${name}/${name}_${version}.tar.gz"
];
};

View File

@ -1,6 +1,5 @@
#!/usr/bin/env Rscript
library(data.table)
library(jsonlite)
library(parallel)
library(BiocManager)
cl <- makeCluster(10)
@ -12,13 +11,11 @@ if ("release" %in% biocVersion$BiocStatus) {
} else {
biocVersion <- max(as.numeric(as.character(biocVersion$Bioc)))
}
dates <- stream_in(url("https://packagemanager.rstudio.com/__api__/repos/2/transaction-dates"), verbose = FALSE)
snapshotDate <- as.Date(dates[nrow(dates), "alias"])
mirrorUrls <- list( bioc=paste0("http://bioconductor.statistik.tu-dortmund.de/packages/", biocVersion, "/bioc/src/contrib/")
, "bioc-annotation"=paste0("http://bioconductor.statistik.tu-dortmund.de/packages/", biocVersion, "/data/annotation/src/contrib/")
, "bioc-experiment"=paste0("http://bioconductor.statistik.tu-dortmund.de/packages/", biocVersion, "/data/experiment/src/contrib/")
, cran=paste0("https://packagemanager.rstudio.com/cran/", snapshotDate, "/src/contrib/")
, cran="https://cran.r-project.org/src/contrib/"
)
mirrorType <- commandArgs(trailingOnly=TRUE)[1]
@ -44,6 +41,10 @@ nixPrefetch <- function(name, version) {
url <- paste0(mirrorUrl, name, "_", version, ".tar.gz")
tmp <- tempfile(pattern=paste0(name, "_", version), fileext=".tar.gz")
cmd <- paste0("wget -q -O '", tmp, "' '", url, "'")
if(mirrorType == "cran"){
archiveUrl <- paste0(mirrorUrl, "Archive/", name, "/", name, "_", version, ".tar.gz")
cmd <- paste0(cmd, " || wget -q -O '", tmp, "' '", archiveUrl, "'")
}
cmd <- paste0(cmd, " && nix-hash --type sha256 --base32 --flat '", tmp, "'")
cmd <- paste0(cmd, " && echo >&2 ' added ", name, " v", version, "'")
cmd <- paste0(cmd, " ; rm -rf '", tmp, "'")
@ -74,9 +75,8 @@ formatPackage <- function(name, version, sha256, depends, imports, linkingTo) {
paste0(" ", attr, " = derive2 { name=\"", name, "\"; version=\"", version, "\"; sha256=\"", sha256, "\"; depends=[", depends, "]; };")
}
clusterExport(cl, c("nixPrefetch","readFormatted", "mirrorUrl", "knownPackages"))
clusterExport(cl, c("nixPrefetch","readFormatted", "mirrorUrl", "mirrorType", "knownPackages"))
pkgs <- as.data.table(available.packages(mirrorUrl, filters=c("R_version", "OS_type", "duplicates"), method="libcurl"))
pkgs <- pkgs[order(Package)]
write(paste("updating", mirrorType, "packages"), stderr())
@ -102,7 +102,7 @@ cat(paste("# Rscript generate-r-packages.R", mirrorType, ">new && mv new", packa
cat("\n\n")
cat("{ self, derive }:\n")
cat("let derive2 = derive ")
if (mirrorType == "cran") { cat("{ snapshot = \"", paste(snapshotDate), "\"; }", sep="")
if (mirrorType == "cran") { cat("{ }")
} else if (mirrorType == "irkernel") { cat("{}")
} else { cat("{ biocVersion = \"", biocVersion, "\"; }", sep="") }
cat(";\n")

View File

@ -15,7 +15,6 @@ stdenv.mkDerivation {
(rWrapper.override {
packages = with rPackages; [
data_table
jsonlite
parallel
BiocManager
];