diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-29 17:56:46 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-29 18:03:21 +0000 |
commit | 987a4a0be9978e568d736801f281791e54928ca3 (patch) | |
tree | 128c09cce15d896558eea120394379751657634b /src/libstore/builtins | |
parent | 8d51d38e4ccf2ca0fa0b0471b32531fe287e38a4 (diff) | |
parent | 58bc3b65789a6c1216abb0dfb4f553b2a6b7f479 (diff) |
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
Diffstat (limited to 'src/libstore/builtins')
-rw-r--r-- | src/libstore/builtins/fetchurl.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstore/builtins/fetchurl.cc b/src/libstore/builtins/fetchurl.cc index f3827684b..84c7d2082 100644 --- a/src/libstore/builtins/fetchurl.cc +++ b/src/libstore/builtins/fetchurl.cc @@ -58,13 +58,16 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData) } }; + /* We always have one output, and if it's a fixed-output derivation (as + checked below) it must be the only output */ + auto & output = drv.outputs.begin()->second; + /* Try the hashed mirrors first. */ - if (getAttr("outputHashMode") == "flat") + if (output.hash && output.hash->method == FileIngestionMethod::Flat) for (auto hashedMirror : settings.hashedMirrors.get()) try { if (!hasSuffix(hashedMirror, "/")) hashedMirror += '/'; - auto ht = parseHashTypeOpt(getAttr("outputHashAlgo")); - auto h = Hash(getAttr("outputHash"), ht); + auto & h = output.hash->hash; fetch(hashedMirror + printHashType(h.type) + "/" + h.to_string(Base16, false)); return; } catch (Error & e) { |