diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-07-27 16:48:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 16:48:41 +0200 |
commit | a5f7d310dd10fe86b6f6aa1c2771c30f113741d4 (patch) | |
tree | ed365ca233fa7edfba9551539c4a903f109abef0 /src/libstore/builtins | |
parent | d7c0f094cbcfe1ae4ccc3d54baec00b66ccb1ed0 (diff) | |
parent | d5bb67cfa4da130a9949a9b4eb8aba6cb74ea5c7 (diff) |
Merge pull request #3795 from obsidiansystems/optional-derivation-output-storepath
Only store hash in DerivationOutput for fixed output derivations
Diffstat (limited to 'src/libstore/builtins')
-rw-r--r-- | src/libstore/builtins/fetchurl.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/libstore/builtins/fetchurl.cc b/src/libstore/builtins/fetchurl.cc index e630cf6f1..017a633b5 100644 --- a/src/libstore/builtins/fetchurl.cc +++ b/src/libstore/builtins/fetchurl.cc @@ -63,16 +63,19 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData) auto & output = drv.outputs.begin()->second; /* Try the hashed mirrors first. */ - if (output.hash && output.hash->method == FileIngestionMethod::Flat) - for (auto hashedMirror : settings.hashedMirrors.get()) - try { - if (!hasSuffix(hashedMirror, "/")) hashedMirror += '/'; - auto & h = output.hash->hash; - fetch(hashedMirror + printHashType(*h.type) + "/" + h.to_string(Base16, false)); - return; - } catch (Error & e) { - debug(e.what()); + if (auto hash = std::get_if<DerivationOutputFixed>(&output.output)) { + if (hash->hash.method == FileIngestionMethod::Flat) { + for (auto hashedMirror : settings.hashedMirrors.get()) { + try { + if (!hasSuffix(hashedMirror, "/")) hashedMirror += '/'; + fetch(hashedMirror + printHashType(*hash->hash.hash.type) + "/" + hash->hash.hash.to_string(Base16, false)); + return; + } catch (Error & e) { + debug(e.what()); + } } + } + } /* Otherwise try the specified URL. */ fetch(mainUrl); |