on iko/ghcjs-patch-master help sign in
Make haskell.nix quieter (#944)

* Remove unconditional trace for index-state We already have messages for unusual cases (like using the latest index-state). This message is unconditional, so quite noisy. We include the actual index-state in the builer log so it's available if you want to check it. * Move source-cleaning warning to builder log It's not *that* interesting, and someone who cares will likely check the log. * Move shellFor trace message to builder log Not that interesting, really. Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>

commitdbff20d0c80d60af536373034203770a846f3514 authorMichael Peyton Jones <michael.peyton-jones@iohk.io> dateFri 27 Nov 2020, 01:18 (6 years ago) parentb4afb5f
3 files changed+17−15
builder/comp-builder.nix+5−3 builder/shell-for.nix+6−8 lib/call-cabal-project-to-nix.nix+6−4
builder/comp-builder.nix+5−3
@@ -76,9 +76,8 @@ let self =
7676
7777let
7878 # TODO fix cabal wildcard support so hpack wildcards can be mapped to cabal wildcards
79− cleanSrc = if cabal-generator == "hpack" && !(package.cleanHpack or false)
80− then builtins.trace ("Cleaning component source not supported for hpack package: " + name) src
81− else haskellLib.cleanCabalComponent package component src;
79+ canCleanSource = !(cabal-generator == "hpack" && !(package.cleanHpack or false));
80+ cleanSrc = if canCleanSource then haskellLib.cleanCabalComponent package component src else src;
8281
8382 nameOnly = "${package.identifier.name}-${componentId.ctype}-${componentId.cname}";
8483
@@ -287,6 +286,9 @@ let
287286 ++ (lib.optional keepSource "source");
288287
289288 configurePhase =
289+ (lib.optionalString (!canCleanSource) ''
290+ echo "Cleaning component source not supported, leaving it un-cleaned"
291+ '') +
290292 (lib.optionalString keepSource ''
291293 cp -r . $source
292294 cd $source
builder/shell-for.nix+6−8
@@ -3,18 +3,13 @@
33{ # `packages` function selects packages that will be worked on in the shell itself.
44 # These packages will not be built by `shellFor`, but their
55 # dependencies will be included in the shell's `ghc-pkg list`.
6− packages ? ps:
7− let
8− selected = haskellLib.selectLocalPackages ps;
9− in
10− builtins.trace ("Shell for " + toString (builtins.attrNames selected))
11− (builtins.attrValues selected)
6+ packages ? ps: builtins.attrValues (haskellLib.selectLocalPackages ps)
127 # `components` function selects components that will be worked on in the shell itself.
138 # By default `shellFor` will include the dependencies of all of the components
149 # in the selected packages. If only as subset of the components will be
1510 # worked on in the shell then we can pass a different `components` function
1611 # to select those.
17−, components ? ps: lib.concatMap haskellLib.getAllComponents (packages hsPkgs)
12+, components ? ps: lib.concatMap haskellLib.getAllComponents (packages hsPkgs)
1813 # Additional packages to be added unconditionally
1914, additional ? _: []
2015, withHoogle ? true
@@ -143,7 +138,10 @@ in
143138 "$@"
144139 '');
145140 phases = ["installPhase"];
146− installPhase = "echo $nativeBuildInputs $buildInputs > $out";
141+ installPhase = ''
142+ echo "${"Shell for " + toString (builtins.map (p : p.identifier.name) selectedPackages)}"
143+ echo $nativeBuildInputs $buildInputs > $out
144+ '';
147145 LANG = "en_US.UTF-8";
148146 LOCALE_ARCHIVE = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${glibcLocales}/lib/locale/locale-archive";
149147
lib/call-cabal-project-to-nix.nix+6−4
@@ -111,8 +111,9 @@ let
111111 then index-state
112112 else if cabalProjectIndexState != null
113113 then cabalProjectIndexState
114− else builtins.trace ("Using latest index state" + (if name == null then "" else " for " + name) + "!")
115− (pkgs.lib.last (builtins.attrNames index-state-hashes));
114+ else
115+ let latest-index-state = pkgs.lib.last (builtins.attrNames index-state-hashes);
116+ in builtins.trace ("No index state specified" + (if name == null then "" else " for " + name) + ", using the latest index state that we know about (${latest-index-state})!") latest-index-state;
116117
117118 index-state-pinned = index-state != null || cabalProjectIndexState != null;
118119
@@ -423,6 +424,8 @@ let
423424 ''}
424425 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
425426 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
427+
428+ echo "Using index-state ${index-state-found}"
426429 HOME=${
427430 # This creates `.cabal` directory that is as it would have
428431 # been at the time `cached-index-state`. We may include
@@ -438,8 +441,7 @@ let
438441 # Setting the desired `index-state` here in case it was not
439442 # from the cabal.project file. This will further restrict the
440443 # packages used by the solver (cached-index-state >= index-state-found).
441− builtins.trace ("Using index-state: ${index-state-found}" + (if name == null then "" else " for " + name))
442− index-state-found} \
444+ index-state-found} \
443445 -w ${
444446 # We are using `-w` rather than `--with-ghc` here to override
445447 # the `with-compiler:` in the `cabal.project` file.