diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-03 17:08:39 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-03 17:08:39 +0000 |
commit | 465daa9396a0e4203fb8f575da219ea79c5fefa8 (patch) | |
tree | 3237c125d59b88366d457503d277cbbdd4b3106d /src/libstore/builtins | |
parent | 1b23fe4afb8ed2c41604a1ed19cf3d49c34f46d1 (diff) | |
parent | 14227aeb327798a1446ddde59fc561c3d2e6b7a8 (diff) |
Merge remote-tracking branch 'upstream/master' into add-body-to-network-errors
Diffstat (limited to 'src/libstore/builtins')
-rw-r--r-- | src/libstore/builtins/fetchurl.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libstore/builtins/fetchurl.cc b/src/libstore/builtins/fetchurl.cc index 2048f8f87..e630cf6f1 100644 --- a/src/libstore/builtins/fetchurl.cc +++ b/src/libstore/builtins/fetchurl.cc @@ -58,14 +58,17 @@ 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 = parseHashType(getAttr("outputHashAlgo")); - auto h = Hash(getAttr("outputHash"), ht); - fetch(hashedMirror + printHashType(h.type) + "/" + h.to_string(Base16, false)); + auto & h = output.hash->hash; + fetch(hashedMirror + printHashType(*h.type) + "/" + h.to_string(Base16, false)); return; } catch (Error & e) { debug(e.what()); |