mirror of
https://github.com/NixOS/nix.git
synced 2025-11-18 08:19:35 +01:00
Merge branch 'path-info' into ca-drv-exotic
This commit is contained in:
commit
848b0832b5
13 changed files with 38 additions and 30 deletions
|
|
@ -313,7 +313,7 @@ StorePath BinaryCacheStore::addToStoreFromDump(Source & dump, std::string_view n
|
|||
.method = method,
|
||||
.hash = nar.first,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
|
@ -433,7 +433,7 @@ StorePath BinaryCacheStore::addToStore(
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -211,10 +211,16 @@ Hash getContentAddressHash(const ContentAddress & ca)
|
|||
ContentAddressWithReferences caWithoutRefs(const ContentAddress & ca) {
|
||||
return std::visit(overloaded {
|
||||
[&](const TextHash & h) -> ContentAddressWithReferences {
|
||||
return TextInfo { h, {}};
|
||||
return TextInfo {
|
||||
h,
|
||||
.references = {},
|
||||
};
|
||||
},
|
||||
[&](const FixedOutputHash & h) -> ContentAddressWithReferences {
|
||||
return FixedOutputInfo { h, {}};
|
||||
return FixedOutputInfo {
|
||||
h,
|
||||
.references = {},
|
||||
};
|
||||
},
|
||||
}, ca);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1426,7 +1426,7 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
|
|||
.method = method,
|
||||
.hash = hash,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ std::map<StorePath, StorePath> makeContentAddressed(
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = narModuloHash,
|
||||
},
|
||||
std::move(refs),
|
||||
.references = std::move(refs),
|
||||
},
|
||||
},
|
||||
Hash::dummy,
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ std::pair<StorePath, Hash> Store::computeStorePathForPath(std::string_view name,
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
};
|
||||
return std::make_pair(makeFixedOutputPath(name, caInfo), h);
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
|
|||
.method = method,
|
||||
.hash = hash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
|
@ -1270,16 +1270,18 @@ std::optional<StorePathDescriptor> ValidPathInfo::fullStorePathDescriptorOpt() c
|
|||
return StorePathDescriptor {
|
||||
.name = std::string { path.name() },
|
||||
.info = std::visit(overloaded {
|
||||
[&](const TextHash & th) {
|
||||
TextInfo info { th };
|
||||
[&](const TextHash & th) -> ContentAddressWithReferences {
|
||||
assert(!hasSelfReference);
|
||||
info.references = references;
|
||||
return ContentAddressWithReferences { info };
|
||||
return TextInfo {
|
||||
th,
|
||||
.references = references,
|
||||
};
|
||||
},
|
||||
[&](const FixedOutputHash & foh) {
|
||||
FixedOutputInfo info { foh };
|
||||
info.references = static_cast<PathReferences<StorePath>>(*this);
|
||||
return ContentAddressWithReferences { info };
|
||||
[&](const FixedOutputHash & foh) -> ContentAddressWithReferences {
|
||||
return FixedOutputInfo {
|
||||
foh,
|
||||
.references = static_cast<PathReferences<StorePath>>(*this),
|
||||
};
|
||||
},
|
||||
}, *ca),
|
||||
};
|
||||
|
|
@ -1338,13 +1340,13 @@ ValidPathInfo::ValidPathInfo(
|
|||
, narHash(narHash)
|
||||
{
|
||||
std::visit(overloaded {
|
||||
[this](const TextInfo & ti) {
|
||||
this->references = ti.references;
|
||||
this->ca = TextHash { std::move(ti) };
|
||||
[this](TextInfo && ti) {
|
||||
this->references = std::move(ti.references);
|
||||
this->ca = std::move((TextHash &&) ti);
|
||||
},
|
||||
[this](const FixedOutputInfo & foi) {
|
||||
*(static_cast<PathReferences<StorePath> *>(this)) = foi.references;
|
||||
this->ca = FixedOutputHash { (FixedOutputHash) std::move(foi) };
|
||||
[this](FixedOutputInfo && foi) {
|
||||
*(static_cast<PathReferences<StorePath> *>(this)) = std::move(foi.references);
|
||||
this->ca = std::move((FixedOutputHash &&) foi);
|
||||
},
|
||||
}, std::move(info.info));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue