diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-21 19:35:35 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-21 19:35:35 +0000 |
commit | 3a7b330b64c6ea77e18a0a96aad7fb14947382d9 (patch) | |
tree | 3edbc7fb3a4010051d64e8e678401b7ac83d560b /src | |
parent | 27a3f82c0bb22692b8a9d373a10f3f237b19742f (diff) |
"Downstream placeholders" should not be store paths
Insead they should be opaque `/<hash>` like the placeholders we already
have.
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops.cc | 6 | ||||
-rw-r--r-- | src/libstore/derivations.cc | 8 | ||||
-rw-r--r-- | src/libstore/derivations.hh | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 0ddba6384..d28024639 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -82,13 +82,13 @@ static void mkOutputString(EvalState & state, Value & v, auto optOutputPath = o.second.pathOpt(*state.store, drv.name, o.first); mkString( *state.allocAttr(v, state.symbols.create(o.first)), - state.store->printStorePath(optOutputPath - ? *optOutputPath + optOutputPath + ? state.store->printStorePath(*optOutputPath) /* Downstream we would substitute this for an actual path once we build the floating CA derivation */ /* FIXME: we need to depend on the basic derivation, not derivation */ - : downstreamPlaceholder(*state.store, drvPath, o.first)), + : downstreamPlaceholder(*state.store, drvPath, o.first), {"!" + o.first + "!" + state.store->printStorePath(drvPath)}); } diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index fb1d06466..5319c1a38 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -664,14 +664,12 @@ std::string hashPlaceholder(const std::string & outputName) return "/" + hashString(htSHA256, "nix-output:" + outputName).to_string(Base32, false); } -StorePath downstreamPlaceholder(const Store & store, const StorePath & drvPath, std::string_view outputName) +std::string downstreamPlaceholder(const Store & store, const StorePath & drvPath, std::string_view outputName) { auto drvNameWithExtension = drvPath.name(); auto drvName = drvNameWithExtension.substr(0, drvNameWithExtension.size() - 4); - return store.makeStorePath( - "downstream-placeholder:" + std::string { drvPath.name() } + ":" + std::string { outputName }, - "compressed:" + std::string { drvPath.hashPart() }, - outputPathName(drvName, outputName)); + auto clearText = "nix-upstream-output:" + std::string { drvPath.hashPart() } + ":" + outputPathName(drvName, outputName); + return "/" + hashString(htSHA256, clearText).to_string(Base32, false); } } diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index 49374d046..76f983561 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -196,6 +196,6 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr std::string hashPlaceholder(const std::string & outputName); -StorePath downstreamPlaceholder(const Store & store, const StorePath & drvPath, std::string_view outputName); +std::string downstreamPlaceholder(const Store & store, const StorePath & drvPath, std::string_view outputName); } |