diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2017-01-29 22:12:41 +0100 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-07-07 12:02:29 -0400 |
commit | 5afcdc88fa7ce9583eecec136de49685923e8df7 (patch) | |
tree | f6d26c7f25f0198e9ea3a05fa2d8510f6956bb3c /pkgs | |
parent | 7fdf18e8928870d6e015ad8aadc4a3e856076f18 (diff) | |
download | nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar.gz nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar.bz2 nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar.lz nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar.xz nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.tar.zst nixlib-5afcdc88fa7ce9583eecec136de49685923e8df7.zip |
stdenv: simple refactor to get rid of pos'
Suggested by Ericson2314.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 8db0017f2d99..065f4fb508de 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -135,7 +135,10 @@ let , crossConfig ? null , meta ? {} , passthru ? {} - , pos ? null # position used in error messages and for meta.position + , pos ? # position used in error messages and for meta.position + (if attrs.meta.description or null != null + then builtins.unsafeGetAttrPos "description" attrs.meta + else builtins.unsafeGetAttrPos "name" attrs) , separateDebugInfo ? false , outputs ? [ "out" ] , __impureHostDeps ? [] @@ -153,15 +156,7 @@ let (map (drv: drv.crossDrv or drv) propagatedBuildInputs) ]; in let - pos' = - if pos != null then - pos - else if attrs.meta.description or null != null then - builtins.unsafeGetAttrPos "description" attrs.meta - else - builtins.unsafeGetAttrPos "name" attrs; - pos'' = if pos' != null then "‘" + pos'.file + ":" + toString pos'.line + "’" else "«unknown-file»"; - + pos_str = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»"; remediation = { unfree = remediate_whitelist "Unfree"; @@ -216,7 +211,7 @@ let throwEvalHelp = { reason , errormsg ? "" }: throw ('' - Package ‘${attrs.name or "«name-missing»"}’ in ${pos''} ${errormsg}, refusing to evaluate. + Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate. '' + ((builtins.getAttr reason remediation) attrs)); @@ -293,7 +288,7 @@ let # Throw an error if trying to evaluate an non-valid derivation validityCondition = - let v = checkValidity attrs; + let v = checkValidity attrs; in if !v.valid then throwEvalHelp (removeAttrs v ["valid"]) else true; @@ -364,8 +359,8 @@ let } // attrs.meta or {} # Fill `meta.position` to identify the source location of the package. - // lib.optionalAttrs (pos' != null) - { position = pos'.file + ":" + toString pos'.line; } + // lib.optionalAttrs (pos != null) + { position = pos.file + ":" + toString pos.line; } ; in |