From 50395319f98c9ec5ddc731342a9ee337e60adb20 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 3 Feb 2021 16:37:46 +0100 Subject: [PATCH 01/14] Throw better error when conf files are missing Previously, if some directories were missing .conf files, an error like this would be thrown: cp: missing destination file operand after '/nix/store/pnmrz06g0sa4s3yx53hgmr9k8jrh6ww0-ouroboros-network-framework-lib-ouroboros-network-framework-0.1.0.0-haddock-config/lib/ghc-8.6.5/package.conf.d' While normally this shouldn't occur, I've seen it happen in CI anyways, with the problem disappearing if the store path that's missing the files was rebuilt a couple times. With this commit, it becomes much easier to figure out which store path is missing the files, which would be very hard to figure out from the previous message. --- builder/make-config-files.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/builder/make-config-files.nix b/builder/make-config-files.nix index bb779c19fd..60f46dfc09 100644 --- a/builder/make-config-files.nix +++ b/builder/make-config-files.nix @@ -93,12 +93,23 @@ let for l in "${cfgFiles}"; do if [ -n "$l" ]; then - cp -f "$l/${packageCfgDir}/"*.conf $out/${packageCfgDir} + files=("$l/${packageCfgDir}/"*.conf) + if (( ''${#files[@]} )); then + cp -f "''${files[@]}" $out/${packageCfgDir} + else + echo "$l/${packageCfgDir} didn't contain any *.conf files!" + exit 1 + fi fi done for l in "${libs}"; do if [ -n "$l" ]; then - cp -f "$l/package.conf.d/"*.conf $out/${packageCfgDir} + files=("$l/package.conf.d/"*.conf) + if (( ''${#files[@]} )); then + cp -f "''${files[@]}" $out/${packageCfgDir} + else + echo "$l/package.conf.d didn't contain any *.conf files!" + fi fi done From 0837a743ea546641e2d1e67a9e5ecc0ab4a987f5 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Feb 2021 11:30:40 +1300 Subject: [PATCH 02/14] ifdLevel 1 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index fc6f6ab404..9ccaed130e 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 3 +, ifdLevel ? 1 , checkMaterialization ? false }: let From baf3a84b125dd4a582f3afe1eedfb7fe02acd92a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Feb 2021 11:49:17 +1300 Subject: [PATCH 03/14] Try with another `exit 1` --- builder/make-config-files.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/make-config-files.nix b/builder/make-config-files.nix index 60f46dfc09..1eabb8268a 100644 --- a/builder/make-config-files.nix +++ b/builder/make-config-files.nix @@ -109,6 +109,7 @@ let cp -f "''${files[@]}" $out/${packageCfgDir} else echo "$l/package.conf.d didn't contain any *.conf files!" + exit 1 fi fi done From 44669170d8a6edc03139eb6285fb840222139213 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Feb 2021 19:33:49 +1300 Subject: [PATCH 04/14] Fix places where `exit 0` should be `exit 1` --- builder/comp-builder.nix | 6 +++--- compiler/ghc/default.nix | 8 ++++---- mk-local-hackage-repo/default.nix | 2 +- test/index-state/default.nix | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index bcbc4be2bf..2b863af7ab 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -371,7 +371,7 @@ let echo "package-id $id" >> $out/envDep else echo 'ERROR: ${package.identifier.name} id could not be found with ${target-pkg-and-db}' - exit 0 + exit 1 fi '' else @@ -389,7 +389,7 @@ let echo "--dependency=${package.identifier.name}:''${name#z-${package.identifier.name}-z-}=$id" >> $out/exactDep/configure-flags else echo 'ERROR: ${package.identifier.name} id could not be found with ${target-pkg-and-db}' - exit 0 + exit 1 fi '') } @@ -398,7 +398,7 @@ let echo "constraint: ${package.identifier.name} installed" >> $out/exactDep/cabal.config else echo 'ERROR: ${package.identifier.name} version could not be found with ${target-pkg-and-db}' - exit 0 + exit 1 fi ''} ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId) '' diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 8e3b8c4afd..4aa53a0a3c 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -285,19 +285,19 @@ stdenv.mkDerivation (rec { # Sanity checks for https://github.com/input-output-hk/haskell.nix/issues/660 if ! "$out/bin/${targetPrefix}ghc" --version; then echo "ERROR: Missing file $out/bin/${targetPrefix}ghc" - exit 0 + exit 1 fi if ! "$out/bin/${targetPrefix}ghc-pkg" --version; then echo "ERROR: Missing file $out/bin/${targetPrefix}ghc-pkg" - exit 0 + exit 1 fi if [[ ! -d "$out/lib/${targetPrefix}ghc-${version}" ]]; then echo "ERROR: Missing directory $out/lib/${targetPrefix}ghc-${version}" - exit 0 + exit 1 fi if (( $(ls -1 "$out/lib/${targetPrefix}ghc-${version}" | wc -l) < 30 )); then echo "ERROR: Expected more files in $out/lib/${targetPrefix}ghc-${version}" - exit 0 + exit 1 fi ''; diff --git a/mk-local-hackage-repo/default.nix b/mk-local-hackage-repo/default.nix index b1ae8f1a3d..fdef900a37 100644 --- a/mk-local-hackage-repo/default.nix +++ b/mk-local-hackage-repo/default.nix @@ -31,7 +31,7 @@ ${ pkgs.lib.optionalString (index ? outputHash) '' if [[ "${index.outputHash}" != "$index_sha256" ]]; then echo "ERROR See https://github.com/input-output-hk/haskell.nix/issues/884" - exit 0 + exit 1 fi ''} export index_length=$(stat --printf="%s" ${index}) diff --git a/test/index-state/default.nix b/test/index-state/default.nix index b044976c27..24962554ab 100644 --- a/test/index-state/default.nix +++ b/test/index-state/default.nix @@ -26,11 +26,11 @@ in buildCommand = '' if [[ "${version-before}" != "0.6.0.0" ]]; then echo 'Unexpected version ${version-before} (expected "0.6.0.0")' - exit 0 + exit 1 fi if [[ "${version-after}" != "0.6.0.1" ]]; then echo 'Unexpected version ${version-after} (expected "0.6.0.1")' - exit 0 + exit 1 fi touch $out From 9a1c58fd3a1fb0b9331e6fb88a0ca4675afa5a04 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 11:26:05 +1300 Subject: [PATCH 05/14] ifdLevel 2 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 9ccaed130e..328f971dec 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 1 +, ifdLevel ? 2 , checkMaterialization ? false }: let From a26604308f4add94a6cc24b50dc108e855676c9e Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 13:11:18 +1300 Subject: [PATCH 06/14] Include native version of ghc884 for R2003 This is mostly so that it will be cached at ifdLevel 1 as it is needed for eval of ifdLevel 2 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 328f971dec..9ccaed130e 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 2 +, ifdLevel ? 1 , checkMaterialization ? false }: let From 8f5d530727cf030c19596cbfe8b497a454a3bcf8 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 13:35:13 +1300 Subject: [PATCH 07/14] ifdLevel 2 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 9ccaed130e..328f971dec 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 1 +, ifdLevel ? 2 , checkMaterialization ? false }: let From 4914ac9521b9d36cc0193823ecbcf6d0cf52523a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 13:48:46 +1300 Subject: [PATCH 08/14] Include native version of ghc884 for R2003 This is mostly so that it will be cached at ifdLevel 1 as it is needed for eval of ifdLevel 2 --- ci.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index a3d615b2d0..9f88e284bc 100644 --- a/ci.nix +++ b/ci.nix @@ -25,6 +25,7 @@ # Update supported-ghc-versions.md to reflect any changes made here. { ghc865 = true; + ghc884 = false; # Just included because the native version is needed at eval time } // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2009") { ghc883 = false; ghc884 = true; @@ -51,7 +52,7 @@ || (nixpkgsName == "R2003" && __elem compiler-nix-name ["ghc865"]))) { # Windows cross compilation is currently broken on macOS inherit (lib.systems.examples) mingwW64; - } // lib.optionalAttrs (system == "x86_64-linux") { + } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName != "R2003") { # Musl cross only works on linux # aarch64 cross only works on linux inherit (lib.systems.examples) musl64 aarch64-multiplatform; From 5a5f28f398e7646fbb9cf9a1798fab0c06944b96 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 17:09:25 +1300 Subject: [PATCH 09/14] Include native version of ghc884 for R2003 This is mostly so that it will be cached at ifdLevel 1 as it is needed for eval of ifdLevel 2 --- ci.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 9f88e284bc..1fbbdeae91 100644 --- a/ci.nix +++ b/ci.nix @@ -52,9 +52,12 @@ || (nixpkgsName == "R2003" && __elem compiler-nix-name ["ghc865"]))) { # Windows cross compilation is currently broken on macOS inherit (lib.systems.examples) mingwW64; - } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName != "R2003") { + } // lib.optionalAttrs (system == "x86_64-linux" + && !(nixpkgsName == "R2003" && compiler-nix-name == "ghc884")) { # Musl cross only works on linux # aarch64 cross only works on linux + # We also skip these for the R2003 was build of ghc884 (we only need the + # native so ifdLevel 1 includes compiler needed in ifdLevel2 eval) inherit (lib.systems.examples) musl64 aarch64-multiplatform; }; isDisabled = d: From c38d53dc0b970703a70b1c1442060c223bf5c99d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Feb 2021 23:01:08 +1300 Subject: [PATCH 10/14] ifdLevel 3 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 328f971dec..fc6f6ab404 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 2 +, ifdLevel ? 3 , checkMaterialization ? false }: let From 096882be1a52c7fe5851eb86a895999f3c08ffd8 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sun, 7 Feb 2021 00:33:52 +1300 Subject: [PATCH 11/14] Fix for sublibs --- builder/comp-builder.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index 2b863af7ab..70087903e2 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -373,6 +373,13 @@ let echo 'ERROR: ${package.identifier.name} id could not be found with ${target-pkg-and-db}' exit 1 fi + if ver=$(${target-pkg-and-db} field ${package.identifier.name} version --simple-output); then + echo "constraint: ${package.identifier.name} == $ver" >> $out/exactDep/cabal.config + echo "constraint: ${package.identifier.name} installed" >> $out/exactDep/cabal.config + else + echo 'ERROR: ${package.identifier.name} version could not be found with ${target-pkg-and-db}' + exit 1 + fi '' else # If the component name is not the package name this must be a sublib. @@ -393,13 +400,6 @@ let fi '') } - if ver=$(${target-pkg-and-db} field ${package.identifier.name} version --simple-output); then - echo "constraint: ${package.identifier.name} == $ver" >> $out/exactDep/cabal.config - echo "constraint: ${package.identifier.name} installed" >> $out/exactDep/cabal.config - else - echo 'ERROR: ${package.identifier.name} version could not be found with ${target-pkg-and-db}' - exit 1 - fi ''} ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId) '' mkdir -p $out/bin From 8eb9b68101219dfff611e08f4516d30822e19ac2 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sun, 7 Feb 2021 02:09:42 +1300 Subject: [PATCH 12/14] ifdLevel 1 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index fc6f6ab404..9ccaed130e 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 3 +, ifdLevel ? 1 , checkMaterialization ? false }: let From 259f983dd876f10165f6966400b26bddc6778d91 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sun, 7 Feb 2021 11:32:51 +1300 Subject: [PATCH 13/14] ifdLevel 2 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 9ccaed130e..328f971dec 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 1 +, ifdLevel ? 2 , checkMaterialization ? false }: let From f6ac1521849a0c0eaec5c0b79171c472a749da0c Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sun, 7 Feb 2021 14:46:50 +1300 Subject: [PATCH 14/14] ifdLevel 3 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index 328f971dec..fc6f6ab404 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 2 +, ifdLevel ? 3 , checkMaterialization ? false }: let