diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-14 17:00:13 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-14 17:00:13 +0000 |
commit | 3c8b5b62192b828c392e9122536d666e23278d8e (patch) | |
tree | 6302c4599c947dee9044e74f5f116aa927713c8f /src/libstore/derivations.hh | |
parent | 5f80aea795d3f6f78d682c7b99453b6fb7c9b6ba (diff) | |
parent | 13e49be6602314fe5e5d7beb8a807d5d892e864e (diff) |
Merge remote-tracking branch 'upstream/master' into single-ca-drv-build
Diffstat (limited to 'src/libstore/derivations.hh')
-rw-r--r-- | src/libstore/derivations.hh | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index f97e601cb..49374d046 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -48,11 +48,23 @@ struct DerivationOutput DerivationOutputCAFloating > output; std::optional<HashType> hashAlgoOpt(const Store & store) const; - std::optional<StorePath> pathOpt(const Store & store, std::string_view drvName) const; + /* Note, when you use this function you should make sure that you're passing + the right derivation name. When in doubt, you should use the safer + interface provided by BasicDerivation::outputsAndOptPaths */ + std::optional<StorePath> pathOpt(const Store & store, std::string_view drvName, std::string_view outputName) const; }; typedef std::map<string, DerivationOutput> DerivationOutputs; +/* These are analogues to the previous DerivationOutputs data type, but they + also contains, for each output, the (optional) store path in which it would + be written. To calculate values of these types, see the corresponding + functions in BasicDerivation */ +typedef std::map<string, std::pair<DerivationOutput, StorePath>> + DerivationOutputsAndPaths; +typedef std::map<string, std::pair<DerivationOutput, std::optional<StorePath>>> + DerivationOutputsAndOptPaths; + /* For inputs that are sub-derivations, we specify exactly which output IDs we are interested in. */ typedef std::map<StorePath, StringSet> DerivationInputs; @@ -99,6 +111,11 @@ struct BasicDerivation /* Return the output names of a derivation. */ StringSet outputNames() const; + /* Calculates the maps that contains all the DerivationOutputs, but + augmented with knowledge of the Store paths they would be written + into. */ + DerivationOutputsAndOptPaths outputsAndOptPaths(const Store & store) const; + static std::string_view nameFromPath(const StorePath & storePath); }; |