Merge pull request #52489 from grahamc/shorted-eval-errors

stdenv: shorten evaluation errors when in Hydra
This commit is contained in:
Graham Christensen 2018-12-18 11:09:26 -05:00 committed by GitHub
commit 9d7e14fbf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,10 @@
{ lib, config, hostPlatform, meta }: { lib, config, hostPlatform, meta }:
let let
# If we're in hydra, we can dispense with the more verbose error
# messages and make problems easier to spot.
inHydra = config.inHydra or false;
# See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426 # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
# for why this defaults to false, but I (@copumpkin) want to default it to true soon. # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
shouldCheckMeta = config.checkMeta or false; shouldCheckMeta = config.checkMeta or false;
@ -141,7 +145,9 @@ let
handleEvalIssue = attrs: { reason , errormsg ? "" }: handleEvalIssue = attrs: { reason , errormsg ? "" }:
let let
msg = '' msg = if inHydra
then "Failed to evaluate ${attrs.name or "«name-missing»"}: «${reason}»: ${errormsg}"
else ''
Package ${attrs.name or "«name-missing»"} in ${pos_str} ${errormsg}, refusing to evaluate. Package ${attrs.name or "«name-missing»"} in ${pos_str} ${errormsg}, refusing to evaluate.
'' + (builtins.getAttr reason remediation) attrs; '' + (builtins.getAttr reason remediation) attrs;