"Downstream placeholders" should not be store paths

Insead they should be opaque `/<hash>` like the placeholders we already
have.
This commit is contained in:
John Ericson 2020-08-21 19:35:35 +00:00
parent 27a3f82c0b
commit 3a7b330b64
3 changed files with 7 additions and 9 deletions

View file

@ -82,13 +82,13 @@ static void mkOutputString(EvalState & state, Value & v,
auto optOutputPath = o.second.pathOpt(*state.store, drv.name, o.first); auto optOutputPath = o.second.pathOpt(*state.store, drv.name, o.first);
mkString( mkString(
*state.allocAttr(v, state.symbols.create(o.first)), *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 /* Downstream we would substitute this for an actual path once
we build the floating CA derivation */ we build the floating CA derivation */
/* FIXME: we need to depend on the basic derivation, not /* FIXME: we need to depend on the basic derivation, not
derivation */ derivation */
: downstreamPlaceholder(*state.store, drvPath, o.first)), : downstreamPlaceholder(*state.store, drvPath, o.first),
{"!" + o.first + "!" + state.store->printStorePath(drvPath)}); {"!" + o.first + "!" + state.store->printStorePath(drvPath)});
} }

View file

@ -664,14 +664,12 @@ std::string hashPlaceholder(const std::string & outputName)
return "/" + hashString(htSHA256, "nix-output:" + outputName).to_string(Base32, false); 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 drvNameWithExtension = drvPath.name();
auto drvName = drvNameWithExtension.substr(0, drvNameWithExtension.size() - 4); auto drvName = drvNameWithExtension.substr(0, drvNameWithExtension.size() - 4);
return store.makeStorePath( auto clearText = "nix-upstream-output:" + std::string { drvPath.hashPart() } + ":" + outputPathName(drvName, outputName);
"downstream-placeholder:" + std::string { drvPath.name() } + ":" + std::string { outputName }, return "/" + hashString(htSHA256, clearText).to_string(Base32, false);
"compressed:" + std::string { drvPath.hashPart() },
outputPathName(drvName, outputName));
} }
} }

View file

@ -196,6 +196,6 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
std::string hashPlaceholder(const std::string & outputName); 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);
} }