diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-12-11 14:53:30 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-12-11 14:53:30 +0100 |
commit | ecb3a1afa2395c46c4ba2ec9da550f45414dbe6d (patch) | |
tree | 6d1038ee909bd1ba69948a0bc326cd5ba6824e01 /src/libexpr/flake | |
parent | ab88f4bbd4117db458a79f0a02a4de7bf7931f4c (diff) | |
parent | f800d450b78091835ab7ca67847d76e75d877a24 (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r-- | src/libexpr/flake/eval-cache.cc | 4 | ||||
-rw-r--r-- | src/libexpr/flake/eval-cache.hh | 5 | ||||
-rw-r--r-- | src/libexpr/flake/flake.cc | 10 | ||||
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 2 | ||||
-rw-r--r-- | src/libexpr/flake/lockfile.cc | 2 |
5 files changed, 12 insertions, 11 deletions
diff --git a/src/libexpr/flake/eval-cache.cc b/src/libexpr/flake/eval-cache.cc index b32d502f7..8d01ef0fc 100644 --- a/src/libexpr/flake/eval-cache.cc +++ b/src/libexpr/flake/eval-cache.cc @@ -77,7 +77,7 @@ void EvalCache::addDerivation( (fingerprint.hash, fingerprint.hashSize) (attrPath) (ValueType::Derivation) - (drv.drvPath + " " + drv.outPath + " " + drv.outputName).exec(); + (std::string(drv.drvPath.to_string()) + " " + std::string(drv.outPath.to_string()) + " " + drv.outputName).exec(); } std::optional<EvalCache::Derivation> EvalCache::getDerivation( @@ -104,7 +104,7 @@ std::optional<EvalCache::Derivation> EvalCache::getDerivation( debug("evaluation cache hit for '%s'", attrPath); - return Derivation { ss[0], ss[1], ss[2] }; + return Derivation { StorePath::fromBaseName(ss[0]), StorePath::fromBaseName(ss[1]), ss[2] }; } EvalCache & EvalCache::singleton() diff --git a/src/libexpr/flake/eval-cache.hh b/src/libexpr/flake/eval-cache.hh index 03aea142e..f81d48ba5 100644 --- a/src/libexpr/flake/eval-cache.hh +++ b/src/libexpr/flake/eval-cache.hh @@ -2,6 +2,7 @@ #include "sync.hh" #include "flake.hh" +#include "path.hh" namespace nix { struct SQLite; struct SQLiteStmt; } @@ -19,8 +20,8 @@ public: struct Derivation { - Path drvPath; - Path outPath; + StorePath drvPath; + StorePath outPath; std::string outputName; }; diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 80726a257..a644f6ad3 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -163,7 +163,7 @@ static SourceInfo fetchInput(EvalState & state, const FlakeRef & resolvedRef) SourceInfo info(ref); info.storePath = gitInfo.storePath; info.revCount = gitInfo.revCount; - info.narHash = state.store->queryPathInfo(info.storePath)->narHash; + info.narHash = state.store->queryPathInfo(state.store->parseStorePath(info.storePath))->narHash; info.lastModified = gitInfo.lastModified; return info; }; @@ -212,7 +212,7 @@ static Flake getFlake(EvalState & state, const FlakeRef & originalRef, refMap.push_back({originalRef, resolvedRef}); refMap.push_back({flakeRef, resolvedRef}); - state.store->assertStorePath(sourceInfo.storePath); + state.store->parseStorePath(sourceInfo.storePath); if (state.allowedPaths) state.allowedPaths->insert(state.store->toRealPath(sourceInfo.storePath)); @@ -334,7 +334,7 @@ static SourceInfo getNonFlake(EvalState & state, const FlakeRef & originalRef, refMap.push_back({originalRef, resolvedRef}); refMap.push_back({flakeRef, resolvedRef}); - state.store->assertStorePath(sourceInfo.storePath); + state.store->parseStorePath(sourceInfo.storePath); if (state.allowedPaths) state.allowedPaths->insert(sourceInfo.storePath); @@ -490,7 +490,7 @@ void updateLockFile(EvalState & state, const FlakeRef & flakeRef, bool recreateL static void emitSourceInfoAttrs(EvalState & state, const SourceInfo & sourceInfo, Value & vAttrs) { auto & path = sourceInfo.storePath; - assert(state.store->isValidPath(path)); + assert(state.store->isValidPath(state.store->parseStorePath(path))); mkString(*state.allocAttr(vAttrs, state.sOutPath), path, {path}); if (sourceInfo.resolvedRef.rev) { @@ -542,7 +542,7 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V state.mkAttrs(v, 8); - assert(state.store->isValidPath(sourceInfo.storePath)); + assert(state.store->isValidPath(state.store->parseStorePath(sourceInfo.storePath))); mkString(*state.allocAttr(v, state.sOutPath), sourceInfo.storePath, {sourceInfo.storePath}); diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index 8e90e5989..ff7c725cb 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -161,7 +161,7 @@ FlakeRef::FlakeRef(const std::string & uri_, bool allowRelative) } while (true) { if (pathExists(d.path + "/.git")) break; - subdir = baseNameOf(d.path) + (subdir.empty() ? "" : "/" + subdir); + subdir = std::string(baseNameOf(d.path)) + (subdir.empty() ? "" : "/" + subdir); d.path = dirOf(d.path); if (d.path == "/") throw MissingFlake("path '%s' is not a flake (because it does not reference a Git repository)", uri); diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc index 5693e57dc..93d4ae946 100644 --- a/src/libexpr/flake/lockfile.cc +++ b/src/libexpr/flake/lockfile.cc @@ -26,7 +26,7 @@ nlohmann::json LockedInput::toJson() const Path LockedInput::computeStorePath(Store & store) const { - return store.makeFixedOutputPath(true, narHash, "source"); + return store.printStorePath(store.makeFixedOutputPath(true, narHash, "source")); } LockedInputs::LockedInputs(const nlohmann::json & json) |