forked from lix-project/lix
Merge branch 'path-info' into ca-drv-exotic
This commit is contained in:
commit
848b0832b5
13 changed files with 38 additions and 30 deletions
|
@ -299,7 +299,7 @@ SV * makeFixedOutputPath(int recursive, char * algo, char * hash, char * name)
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
||||
} catch (Error & e) {
|
||||
|
|
|
@ -235,7 +235,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
|
|||
.method = unpack ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat,
|
||||
.hash = *expectedHash,
|
||||
},
|
||||
{}
|
||||
.references = {}
|
||||
});
|
||||
|
||||
if (state.store->isValidPath(expectedPath)) {
|
||||
|
|
|
@ -215,7 +215,7 @@ StorePath Input::computeStorePath(Store & store) const
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = *narHash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ DownloadFileResult downloadFile(
|
|||
.method = FileIngestionMethod::Flat,
|
||||
.hash = hash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
hashString(htSHA256, sink.s),
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ static void opPrintFixedPath(Strings opFlags, Strings opArgs)
|
|||
.method = method,
|
||||
.hash = Hash::parseAny(hash, hashAlgo),
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
})));
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
|||
.method = std::move(ingestionMethod),
|
||||
.hash = std::move(hash),
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
|
|
@ -72,7 +72,7 @@ std::tuple<StorePath, Hash> prefetchFile(
|
|||
.method = ingestionMethod,
|
||||
.hash = *expectedHash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
if (store->isValidPath(*storePath))
|
||||
hash = expectedHash;
|
||||
|
|
|
@ -205,7 +205,7 @@ struct ProfileManifest
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = narHash,
|
||||
},
|
||||
{ references },
|
||||
.references = { references },
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
|
Loading…
Reference in a new issue