From 9bc37bff1afd0bc3fc5b851ee4512ea4478fc583 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 24 Sep 2021 21:17:37 +1000 Subject: [PATCH 1/2] rPackages: mark packages as broken when generating package sets The current behaviour for generate-r-packages.R is to delete packages that have been remove upstream. This patch changes the behaviour to mark packages as broken rather than removing them. This has the advantage of never breaking expressions, which previously occured when a package with overrides in default.nix was deleted. As a result, the update procedure is simplified, allowing automated updates to the package tree to run, and additionally if a package is re-established upstream the previous overrides still exist. --- doc/languages-frameworks/r.section.md | 8 -------- pkgs/development/r-modules/generate-r-packages.R | 12 ++++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/languages-frameworks/r.section.md b/doc/languages-frameworks/r.section.md index 56e3da64df2a..6b64e264b669 100644 --- a/doc/languages-frameworks/r.section.md +++ b/doc/languages-frameworks/r.section.md @@ -113,11 +113,3 @@ mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix ``` `generate-r-packages.R ` reads `-packages.nix`, therefor the renaming. - -## Testing if the Nix-expression could be evaluated {#testing-if-the-nix-expression-could-be-evaluated} - -```bash -nix-build test-evaluation.nix --dry-run -``` - -If this exits fine, the expression is ok. If not, you have to edit `default.nix` diff --git a/pkgs/development/r-modules/generate-r-packages.R b/pkgs/development/r-modules/generate-r-packages.R index f656fdca0922..8c97c651e4c4 100755 --- a/pkgs/development/r-modules/generate-r-packages.R +++ b/pkgs/development/r-modules/generate-r-packages.R @@ -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])) 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("# Execute the following command to update the file.\n") cat("#\n") @@ -95,6 +106,7 @@ if (mirrorType == "cran") { cat("{ snapshot = \"", paste(snapshotDate), "\"; }", cat(";\n") cat("in with self; {\n") cat(paste(nix, collapse="\n"), "\n", sep="") +cat(paste(broken, collapse="\n"), "\n", sep="") cat("}\n") stopCluster(cl) From 5309818bf744a166a236ee2f829c154975cf6bcc Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Sun, 26 Sep 2021 07:29:58 +1000 Subject: [PATCH 2/2] doc: clarify location of rPackages overrides Detail the location of rPackage overrides and how broken builds should be addressed. --- doc/languages-frameworks/r.section.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/languages-frameworks/r.section.md b/doc/languages-frameworks/r.section.md index 6b64e264b669..ad0fb10987c9 100644 --- a/doc/languages-frameworks/r.section.md +++ b/doc/languages-frameworks/r.section.md @@ -96,6 +96,11 @@ re-enter the shell. ## 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 nix-shell generate-shell.nix @@ -112,4 +117,11 @@ Rscript generate-r-packages.R bioc-experiment > bioc-experiment-packages.nix.new mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix ``` -`generate-r-packages.R ` reads `-packages.nix`, therefor the renaming. +`generate-r-packages.R ` reads `-packages.nix`, therefore +the renaming. + +Some packages require overrides to specify external dependencies or other +patches and special requirements. These overrides are specified in the +`pkgs/development/r-modules/default.nix` file. As the `*-packages.nix` +contents are automatically generated it should not be edited and broken +builds should be addressed using overrides.