aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/derivations.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-05 21:49:01 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-05 21:49:01 +0000
commita38ab99d576bb31288edb8a68c9564d962415662 (patch)
tree883f2b1fdaaa5e241cd71e1f786c3f2aaf1813ba /src/libstore/derivations.cc
parent8313f0e939a99b1f715695c0e798cfb368dfc1f2 (diff)
parent14227aeb327798a1446ddde59fc561c3d2e6b7a8 (diff)
Merge remote-tracking branch 'upstream/master' into derivation-header-include-order
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r--src/libstore/derivations.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index 9f2c9b2cb..f0f5c95bf 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -7,11 +7,6 @@
namespace nix {
-std::string DerivationOutputHash::printMethodAlgo() const {
- return makeFileIngestionPrefix(method) + printHashType(*hash.type);
-}
-
-
const StorePath & BasicDerivation::findOutput(const string & id) const
{
auto i = outputs.find(id);
@@ -112,7 +107,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream
expect(str, ","); const auto hash = parseString(str);
expect(str, ")");
- std::optional<DerivationOutputHash> fsh;
+ std::optional<FixedOutputHash> fsh;
if (hashAlgo != "") {
auto method = FileIngestionMethod::Flat;
if (string(hashAlgo, 0, 2) == "r:") {
@@ -120,7 +115,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream
hashAlgo = string(hashAlgo, 2);
}
const HashType hashType = parseHashType(hashAlgo);
- fsh = DerivationOutputHash {
+ fsh = FixedOutputHash {
.method = std::move(method),
.hash = Hash(hash, hashType),
};
@@ -380,17 +375,17 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
{
auto path = store.parseStorePath(readString(in));
auto hashAlgo = readString(in);
- const auto hash = readString(in);
+ auto hash = readString(in);
- std::optional<DerivationOutputHash> fsh;
+ std::optional<FixedOutputHash> fsh;
if (hashAlgo != "") {
auto method = FileIngestionMethod::Flat;
if (string(hashAlgo, 0, 2) == "r:") {
method = FileIngestionMethod::Recursive;
hashAlgo = string(hashAlgo, 2);
}
- const HashType hashType = parseHashType(hashAlgo);
- fsh = DerivationOutputHash {
+ auto hashType = parseHashType(hashAlgo);
+ fsh = FixedOutputHash {
.method = std::move(method),
.hash = Hash(hash, hashType),
};
@@ -439,11 +434,16 @@ Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv)
void writeDerivation(Sink & out, const Store & store, const BasicDerivation & drv)
{
out << drv.outputs.size();
- for (auto & i : drv.outputs)
+ for (auto & i : drv.outputs) {
out << i.first
- << store.printStorePath(i.second.path)
- << i.second.hash->printMethodAlgo()
- << i.second.hash->hash.to_string(Base16, false);
+ << store.printStorePath(i.second.path);
+ if (i.second.hash) {
+ out << i.second.hash->printMethodAlgo()
+ << i.second.hash->hash.to_string(Base16, false);
+ } else {
+ out << "" << "";
+ }
+ }
writeStorePaths(store, out, drv.inputSrcs);
out << drv.platform << drv.builder << drv.args;
out << drv.env.size();