stdenv: simple refactor to get rid of pos'

Suggested by Ericson2314.

authored by Vladimír Čunát and committed by John Ericson 5afcdc88 7fdf18e8

+9 -14
+9 -14
pkgs/stdenv/generic/default.nix
··· 135 135 , crossConfig ? null 136 136 , meta ? {} 137 137 , passthru ? {} 138 - , pos ? null # position used in error messages and for meta.position 138 + , pos ? # position used in error messages and for meta.position 139 + (if attrs.meta.description or null != null 140 + then builtins.unsafeGetAttrPos "description" attrs.meta 141 + else builtins.unsafeGetAttrPos "name" attrs) 139 142 , separateDebugInfo ? false 140 143 , outputs ? [ "out" ] 141 144 , __impureHostDeps ? [] ··· 153 156 (map (drv: drv.crossDrv or drv) propagatedBuildInputs) 154 157 ]; 155 158 in let 156 - pos' = 157 - if pos != null then 158 - pos 159 - else if attrs.meta.description or null != null then 160 - builtins.unsafeGetAttrPos "description" attrs.meta 161 - else 162 - builtins.unsafeGetAttrPos "name" attrs; 163 - pos'' = if pos' != null then "‘" + pos'.file + ":" + toString pos'.line + "’" else "«unknown-file»"; 164 - 159 + pos_str = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»"; 165 160 166 161 remediation = { 167 162 unfree = remediate_whitelist "Unfree"; ··· 216 211 217 212 throwEvalHelp = { reason , errormsg ? "" }: 218 213 throw ('' 219 - Package ‘${attrs.name or "«name-missing»"}’ in ${pos''} ${errormsg}, refusing to evaluate. 214 + Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate. 220 215 221 216 '' + ((builtins.getAttr reason remediation) attrs)); 222 217 ··· 293 288 294 289 # Throw an error if trying to evaluate an non-valid derivation 295 290 validityCondition = 296 - let v = checkValidity attrs; 291 + let v = checkValidity attrs; 297 292 in if !v.valid 298 293 then throwEvalHelp (removeAttrs v ["valid"]) 299 294 else true; ··· 364 359 } 365 360 // attrs.meta or {} 366 361 # Fill `meta.position` to identify the source location of the package. 367 - // lib.optionalAttrs (pos' != null) 368 - { position = pos'.file + ":" + toString pos'.line; } 362 + // lib.optionalAttrs (pos != null) 363 + { position = pos.file + ":" + toString pos.line; } 369 364 ; 370 365 371 366 in