mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
Correctly substitute from different storeDir
Originally, the test was only checking for different “real” storeDir. That’s an easy case to handle, but the much harder one is if different virtual store dirs are used. To do this, we need the SubstitutionGoal to know about the ca, so it can recalculate the path to copy it over. An important note here is that the store path passed to copyStorePath needs to be one for srcStore - so that queryPathInfo works properly. This also adds an error message when the store path from queryPathInfo is different from the one we requested.
This commit is contained in:
parent
b2cb288cdd
commit
c214cda940
4 changed files with 42 additions and 20 deletions
|
@ -108,12 +108,12 @@ void Store::computeFSClosure(const StorePath & startPath,
|
|||
}
|
||||
|
||||
|
||||
static std::optional<std::string> getDerivationCA(ref<Derivation> drv)
|
||||
std::optional<std::string> getDerivationCA(const BasicDerivation & drv)
|
||||
{
|
||||
auto outputHashMode = drv->env.find("outputHashMode");
|
||||
auto outputHashAlgo = drv->env.find("outputHashAlgo");
|
||||
auto outputHash = drv->env.find("outputHash");
|
||||
if (outputHashMode != drv->env.end() && outputHashAlgo != drv->env.end() && outputHash != drv->env.end()) {
|
||||
auto outputHashMode = drv.env.find("outputHashMode");
|
||||
auto outputHashAlgo = drv.env.find("outputHashAlgo");
|
||||
auto outputHash = drv.env.find("outputHash");
|
||||
if (outputHashMode != drv.env.end() && outputHashAlgo != drv.env.end() && outputHash != drv.env.end()) {
|
||||
auto ht = parseHashType(outputHashAlgo->second);
|
||||
auto h = Hash(outputHash->second, ht);
|
||||
FileIngestionMethod ingestionMethod;
|
||||
|
@ -182,7 +182,7 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
|
|||
paths.insert(outPath.clone());
|
||||
|
||||
std::map<std::string, std::string> pathsCA = {};
|
||||
if (auto ca = getDerivationCA(drv))
|
||||
if (auto ca = getDerivationCA(*drv))
|
||||
pathsCA.insert({outPathS, *ca});
|
||||
querySubstitutablePathInfos(paths, infos, pathsCA);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue