Merge pull request #139312 from jbedo/r-broken

rPackages: mark packages as broken when generating package sets
This commit is contained in:
Matthieu Coudron 2021-09-27 10:32:30 +02:00 committed by GitHub
commit 639df4e23a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 8 deletions

View file

@ -96,6 +96,11 @@ re-enter the shell.
## Updating the package set {#updating-the-package-set} ## Updating the package set {#updating-the-package-set}
There is a script and associated environment for regenerating the package
sets and synchronising the rPackages tree to the current CRAN and matching
BIOC release. These scripts are found in the `pkgs/development/r-modules`
directory and executed as follows:
```bash ```bash
nix-shell generate-shell.nix nix-shell generate-shell.nix
@ -112,12 +117,11 @@ Rscript generate-r-packages.R bioc-experiment > bioc-experiment-packages.nix.new
mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix
``` ```
`generate-r-packages.R <repo>` reads `<repo>-packages.nix`, therefor the renaming. `generate-r-packages.R <repo>` reads `<repo>-packages.nix`, therefore
the renaming.
## Testing if the Nix-expression could be evaluated {#testing-if-the-nix-expression-could-be-evaluated} Some packages require overrides to specify external dependencies or other
patches and special requirements. These overrides are specified in the
```bash `pkgs/development/r-modules/default.nix` file. As the `*-packages.nix`
nix-build test-evaluation.nix --dry-run contents are automatically generated it should not be edited and broken
``` builds should be addressed using overrides.
If this exits fine, the expression is ok. If not, you have to edit `default.nix`

View file

@ -82,6 +82,17 @@ pkgs$sha256 <- parApply(cl, pkgs, 1, function(p) nixPrefetch(p[1], p[2]))
nix <- apply(pkgs, 1, function(p) formatPackage(p[1], p[2], p[18], p[4], p[5], p[6])) nix <- apply(pkgs, 1, function(p) formatPackage(p[1], p[2], p[18], p[4], p[5], p[6]))
write("done", stderr()) write("done", stderr())
# Mark deleted packages as broken
setkey(readFormatted, V2)
markBroken <- function(name) {
str <- paste0(readFormatted[name], collapse='"')
if(sum(grep("broken = true;", str)))
return(str)
write(paste("marked", name, "as broken"), stderr())
gsub("};$", "broken = true; };", str)
}
broken <- lapply(setdiff(readFormatted[[2]], pkgs[[1]]), markBroken)
cat("# This file is generated from generate-r-packages.R. DO NOT EDIT.\n") cat("# This file is generated from generate-r-packages.R. DO NOT EDIT.\n")
cat("# Execute the following command to update the file.\n") cat("# Execute the following command to update the file.\n")
cat("#\n") cat("#\n")
@ -95,6 +106,7 @@ if (mirrorType == "cran") { cat("{ snapshot = \"", paste(snapshotDate), "\"; }",
cat(";\n") cat(";\n")
cat("in with self; {\n") cat("in with self; {\n")
cat(paste(nix, collapse="\n"), "\n", sep="") cat(paste(nix, collapse="\n"), "\n", sep="")
cat(paste(broken, collapse="\n"), "\n", sep="")
cat("}\n") cat("}\n")
stopCluster(cl) stopCluster(cl)