From 237d88c97e1f08f8c1513261ac5fea847d5917ff Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 19 Jun 2020 14:47:10 +0000 Subject: [PATCH] FileSystemHash -> DerivationOutputHash --- src/libexpr/primops.cc | 6 +++--- src/libstore/derivations.cc | 10 +++++----- src/libstore/derivations.hh | 12 ++++++------ src/nix/develop.cc | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 8288dd6a1..175fccf39 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -776,7 +776,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * if (!jsonObject) drv.env["out"] = state.store->printStorePath(outPath); drv.outputs.insert_or_assign("out", DerivationOutput { .path = std::move(outPath), - .hash = FileSystemHash { ingestionMethod, std::move(h) }, + .hash = DerivationOutputHash { ingestionMethod, std::move(h) }, }); } @@ -792,7 +792,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * drv.outputs.insert_or_assign(i, DerivationOutput { .path = StorePath::dummy, - .hash = std::optional {}, + .hash = std::optional {}, }); } @@ -804,7 +804,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * drv.outputs.insert_or_assign(i, DerivationOutput { .path = std::move(outPath), - .hash = std::optional(), + .hash = std::optional(), }); } } diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 826b336e0..51a01feac 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -8,7 +8,7 @@ namespace nix { -std::string FileSystemHash::printMethodAlgo() const { +std::string DerivationOutputHash::printMethodAlgo() const { return makeFileIngestionPrefix(method) + printHashType(hash.type); } @@ -113,7 +113,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream expect(str, ","); const auto hash = parseString(str); expect(str, ")"); - std::optional fsh; + std::optional fsh; if (hashAlgo != "") { auto method = FileIngestionMethod::Flat; if (string(hashAlgo, 0, 2) == "r:") { @@ -123,7 +123,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream const HashType hashType = parseHashType(hashAlgo); if (hashType == htUnknown) throw Error("unknown hash hashAlgorithm '%s'", hashAlgo); - fsh = FileSystemHash { + fsh = DerivationOutputHash { std::move(method), Hash(hash, hashType), }; @@ -413,7 +413,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store) auto hashAlgo = readString(in); const auto hash = readString(in); - std::optional fsh; + std::optional fsh; if (hashAlgo != "") { auto method = FileIngestionMethod::Flat; if (string(hashAlgo, 0, 2) == "r:") { @@ -423,7 +423,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store) const HashType hashType = parseHashType(hashAlgo); if (hashType == htUnknown) throw Error("unknown hash hashAlgorithm '%s'", hashAlgo); - fsh = FileSystemHash { + fsh = DerivationOutputHash { std::move(method), Hash(hash, hashType), }; diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index 3b4eb7ec4..f3eff2748 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -13,23 +13,23 @@ namespace nix { /* Abstract syntax of derivations. */ /// Pair of a hash, and how the file system was ingested -struct FileSystemHash { +struct DerivationOutputHash { FileIngestionMethod method; Hash hash; - FileSystemHash(FileIngestionMethod method, Hash hash) + DerivationOutputHash(FileIngestionMethod method, Hash hash) : method(std::move(method)) , hash(std::move(hash)) { } - FileSystemHash(const FileSystemHash &) = default; - FileSystemHash(FileSystemHash &&) = default; - FileSystemHash & operator = (const FileSystemHash &) = default; + DerivationOutputHash(const DerivationOutputHash &) = default; + DerivationOutputHash(DerivationOutputHash &&) = default; + DerivationOutputHash & operator = (const DerivationOutputHash &) = default; std::string printMethodAlgo() const; }; struct DerivationOutput { StorePath path; - std::optional hash; /* hash used for expected hash computation */ + std::optional hash; /* hash used for expected hash computation */ void parseHashInfo(FileIngestionMethod & recursive, Hash & hash) const; }; diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 8abb710c2..0845c65fa 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -137,7 +137,7 @@ StorePath getDerivationEnvironment(ref store, const StorePath & drvPath) auto shellOutPath = store->makeOutputPath("out", h, drvName); drv.outputs.insert_or_assign("out", DerivationOutput { .path = shellOutPath, - .hash = FileSystemHash { + .hash = DerivationOutputHash { FileIngestionMethod::Flat, Hash { } }, });