on iko/ghcjs-patch-master help sign in
Allow patches to optionally depend on version and revision
4050450Moritz Angermann
builder/comp-builder.nix+3−1
@@ -7,6 +7,7 @@
7, setup
7, setup
8, src
8, src
9, flags
9, flags
10+, revision
10, cabalFile
11, cabalFile
11, patches ? []
12, patches ? []
12
13
@@ -229,7 +230,8 @@ in stdenv.mkDerivation ({
229 runHook postInstall
230 runHook postInstall
230 '';
231 '';
231}
232}
233+# patches can (if they like) depend on the version and revision of the package.
232−// lib.optionalAttrs (patches != []) { inherit patches; }
234+// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
233// lib.optionalAttrs (preUnpack != "") { inherit preUnpack; }
235// lib.optionalAttrs (preUnpack != "") { inherit preUnpack; }
234// lib.optionalAttrs (postUnpack != "") { inherit postUnpack; }
236// lib.optionalAttrs (postUnpack != "") { inherit postUnpack; }
235// lib.optionalAttrs (preConfigure != "") { inherit preConfigure; }
237// lib.optionalAttrs (preConfigure != "") { inherit preConfigure; }
builder/default.nix+1−1
@@ -70,7 +70,7 @@ let
70 comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix { inherit ghc haskellLib nonReinstallablePkgs; };
70 comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix { inherit ghc haskellLib nonReinstallablePkgs; };
71
71
72 buildComp = componentId: component: comp-builder {
72 buildComp = componentId: component: comp-builder {
73− inherit componentId component package name src flags setup cabalFile patches
73+ inherit componentId component package name src flags setup cabalFile patches revision
74 preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall
74 preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall
75 ;
75 ;
76 };
76 };
modules/package.nix+1−1
@@ -202,7 +202,7 @@ in {
202 default = null;
202 default = null;
203 };
203 };
204 patches = mkOption {
204 patches = mkOption {
205− type = listOf (either package path);
205+ type = listOf (either unspecified path);
206 default = [];
206 default = [];
207 };
207 };
208 configureFlags = mkOption {
208 configureFlags = mkOption {
patches/default.nix−7
@@ -1,9 +1,2 @@
1{
1{
2− ghc841 = import ./ghc841;
3− ghc842 = import ./ghc842;
4− ghc843 = import ./ghc843;
5− ghc844 = import ./ghc844;
6− ghc861 = import ./ghc861;
7− ghc862 = import ./ghc862;
8− ghc863 = import ./ghc863;
9}
2}
patches/ghc843/default.nix+9−9
@@ -1,11 +1,11 @@
1{
1{
2− packages.array.patches = [ ./array-0.5.2.0.patch ];
2+ packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3.patch" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
3− packages.deepseq.patches = [ ./deepseq-1.4.3.0.patch ];
3+ packages.array.patches = [ ({ version, revision }: if version == "0.5.2.0.patch" && revision == 0 then ./array-0.5.2.0.patch else null) ];
4− packages.hpc.patches = [ ./hpc-0.6.0.3.patch ];
4+ packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0.patch" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5− packages.parallel.patches = [ ./parallel-3.2.1.1.patch ];
5+ packages.random.patches = [ ({ version, revision }: if version == "1.1.patch" && revision == 0 then ./random-1.1.patch else null) ];
6− packages.parsec.patches = [ ./parsec-3.1.13.0.patch ];
6+ packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2.patch" && revision == 0 then ./time-1.8.0.2.patch else null) ];
7− packages.random.patches = [ ./random-1.1.patch ];
7+ packages.deepseq.patches = [ ({ version, revision }: if version == "1.4.3.0.patch" && revision == 0 then ./deepseq-1.4.3.0.patch else null) ];
8− packages.time.patches = [ ./time-1.8.0.2.patch ];
8+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2.patch" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
9− packages.unix.patches = [ ./unix-2.7.2.2.patch ];
9+ packages.parallel.patches = [ ({ version, revision }: if version == "3.2.1.1.patch" && revision == 0 then ./parallel-3.2.1.1.patch else null) ];
10− packages.vector.patches = [ ./vector-0.11.0.0.patch ];
10+ packages.vector.patches = [ ({ version, revision }: if version == "0.11.0.0.patch" && revision == 0 then ./vector-0.11.0.0.patch else null) ];
11}
11}
patches/ghc844/default.nix+9−9
@@ -1,11 +1,11 @@
1{
1{
2− packages.array.patches = [ ./array-0.5.2.0.patch ];
2+ packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3.patch" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
3− packages.deepseq.patches = [ ./deepseq-1.4.3.0.patch ];
3+ packages.array.patches = [ ({ version, revision }: if version == "0.5.2.0.patch" && revision == 0 then ./array-0.5.2.0.patch else null) ];
4− packages.hpc.patches = [ ./hpc-0.6.0.3.patch ];
4+ packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0.patch" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5− packages.parallel.patches = [ ./parallel-3.2.1.1.patch ];
5+ packages.random.patches = [ ({ version, revision }: if version == "1.1.patch" && revision == 0 then ./random-1.1.patch else null) ];
6− packages.parsec.patches = [ ./parsec-3.1.13.0.patch ];
6+ packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2.patch" && revision == 0 then ./time-1.8.0.2.patch else null) ];
7− packages.random.patches = [ ./random-1.1.patch ];
7+ packages.deepseq.patches = [ ({ version, revision }: if version == "1.4.3.0.patch" && revision == 0 then ./deepseq-1.4.3.0.patch else null) ];
8− packages.time.patches = [ ./time-1.8.0.2.patch ];
8+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2.patch" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
9− packages.unix.patches = [ ./unix-2.7.2.2.patch ];
9+ packages.parallel.patches = [ ({ version, revision }: if version == "3.2.1.1.patch" && revision == 0 then ./parallel-3.2.1.1.patch else null) ];
10− packages.vector.patches = [ ./vector-0.11.0.0.patch ];
10+ packages.vector.patches = [ ({ version, revision }: if version == "0.11.0.0.patch" && revision == 0 then ./vector-0.11.0.0.patch else null) ];
11}
11}
patches/ghc861/default.nix+9−9
@@ -1,11 +1,11 @@
1{
1{
2− packages.array.patches = [ ./array-0.5.2.0.patch ];
2+ packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3.patch" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
3− packages.binary.patches = [ ./binary-0.8.6.0.patch ];
3+ packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1.patch" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
4− packages.containers.patches = [ ./containers-0.6.0.1.patch ];
4+ packages.binary.patches = [ ({ version, revision }: if version == "0.8.6.0.patch" && revision == 0 then ./binary-0.8.6.0.patch else null) ];
5− packages.hpc.patches = [ ./hpc-0.6.0.3.patch ];
5+ packages.array.patches = [ ({ version, revision }: if version == "0.5.2.0.patch" && revision == 0 then ./array-0.5.2.0.patch else null) ];
6− packages.parsec.patches = [ ./parsec-3.1.13.0.patch ];
6+ packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0.patch" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
7− packages.process.patches = [ ./process-1.6.3.0.patch ];
7+ packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2.patch" && revision == 0 then ./time-1.8.0.2.patch else null) ];
8− packages.time.patches = [ ./time-1.8.0.2.patch ];
8+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2.patch" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
9− packages.transformers.patches = [ ./transformers-0.5.5.0.patch ];
9+ packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0.patch" && revision == 0 then ./process-1.6.3.0.patch else null) ];
10− packages.unix.patches = [ ./unix-2.7.2.2.patch ];
10+ packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0.patch" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
11}
11}
patches/ghc862/default.nix+8−8
@@ -1,10 +1,10 @@
1{
1{
2− packages.binary.patches = [ ./binary-0.8.6.0.patch ];
2+ packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3.patch" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
3− packages.containers.patches = [ ./containers-0.6.0.1.patch ];
3+ packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1.patch" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
4− packages.hpc.patches = [ ./hpc-0.6.0.3.patch ];
4+ packages.binary.patches = [ ({ version, revision }: if version == "0.8.6.0.patch" && revision == 0 then ./binary-0.8.6.0.patch else null) ];
5− packages.parsec.patches = [ ./parsec-3.1.13.0.patch ];
5+ packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0.patch" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6− packages.process.patches = [ ./process-1.6.3.0.patch ];
6+ packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2.patch" && revision == 0 then ./time-1.8.0.2.patch else null) ];
7− packages.time.patches = [ ./time-1.8.0.2.patch ];
7+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2.patch" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
8− packages.transformers.patches = [ ./transformers-0.5.5.0.patch ];
8+ packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0.patch" && revision == 0 then ./process-1.6.3.0.patch else null) ];
9− packages.unix.patches = [ ./unix-2.7.2.2.patch ];
9+ packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0.patch" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
10}
10}
patches/ghc863/default.nix+8−8
@@ -1,10 +1,10 @@
1{
1{
2− packages.binary.patches = [ ./binary-0.8.6.0.patch ];
2+ packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3.patch" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
3− packages.containers.patches = [ ./containers-0.6.0.1.patch ];
3+ packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1.patch" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
4− packages.hpc.patches = [ ./hpc-0.6.0.3.patch ];
4+ packages.binary.patches = [ ({ version, revision }: if version == "0.8.6.0.patch" && revision == 0 then ./binary-0.8.6.0.patch else null) ];
5− packages.parsec.patches = [ ./parsec-3.1.13.0.patch ];
5+ packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0.patch" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6− packages.process.patches = [ ./process-1.6.3.0.patch ];
6+ packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2.patch" && revision == 0 then ./time-1.8.0.2.patch else null) ];
7− packages.time.patches = [ ./time-1.8.0.2.patch ];
7+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2.patch" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
8− packages.transformers.patches = [ ./transformers-0.5.5.0.patch ];
8+ packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0.patch" && revision == 0 then ./process-1.6.3.0.patch else null) ];
9− packages.unix.patches = [ ./unix-2.7.2.2.patch ];
9+ packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0.patch" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
10}
10}
patches/update-patches.shnew file+11
@@ -0,0 +1,11 @@
1+#!/bin/bash
2+for ghc in $(find . -name "ghc*" -type d); do
3+ (cd $ghc
4+ echo "{" > default.nix
5+ (for a in $(find . -name "*.patch" -type f); do
6+ b=${a%%.patch};
7+ b=${a##./};
8+ echo " packages.${b%%-*}.patches = [ ({ version, revision }: if version == \"${b##*-}\" && revision == 0 then $a else null) ];" >> default.nix
9+ done) || true
10+ echo "}" >> default.nix)
11+done