forked from lix-project/lix
Rename
This commit is contained in:
parent
41659418cf
commit
7f6fe8ca1d
|
@ -7,17 +7,17 @@ static void prim_fetchClosure(EvalState & state, const Pos & pos, Value * * args
|
||||||
{
|
{
|
||||||
state.forceAttrs(*args[0], pos);
|
state.forceAttrs(*args[0], pos);
|
||||||
|
|
||||||
std::optional<StorePath> storePath;
|
std::optional<std::string> fromStoreUrl;
|
||||||
std::optional<std::string> from;
|
std::optional<StorePath> fromPath;
|
||||||
|
|
||||||
for (auto & attr : *args[0]->attrs) {
|
for (auto & attr : *args[0]->attrs) {
|
||||||
if (attr.name == "storePath") {
|
if (attr.name == "fromPath") {
|
||||||
PathSet context;
|
PathSet context;
|
||||||
storePath = state.coerceToStorePath(*attr.pos, *attr.value, context);
|
fromPath = state.coerceToStorePath(*attr.pos, *attr.value, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (attr.name == "from")
|
else if (attr.name == "fromStore")
|
||||||
from = state.forceStringNoCtx(*attr.value, *attr.pos);
|
fromStoreUrl = state.forceStringNoCtx(*attr.value, *attr.pos);
|
||||||
|
|
||||||
else
|
else
|
||||||
throw Error({
|
throw Error({
|
||||||
|
@ -26,36 +26,36 @@ static void prim_fetchClosure(EvalState & state, const Pos & pos, Value * * args
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!storePath)
|
if (!fromPath)
|
||||||
throw Error({
|
throw Error({
|
||||||
.msg = hintfmt("attribute '%s' is missing in call to 'fetchClosure'", "storePath"),
|
.msg = hintfmt("attribute '%s' is missing in call to 'fetchClosure'", "fromPath"),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!from)
|
if (!fromStoreUrl)
|
||||||
throw Error({
|
throw Error({
|
||||||
.msg = hintfmt("attribute '%s' is missing in call to 'fetchClosure'", "from"),
|
.msg = hintfmt("attribute '%s' is missing in call to 'fetchClosure'", "fromStore"),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME: only allow some "trusted" store types (like BinaryCacheStore).
|
// FIXME: only allow some "trusted" store types (like BinaryCacheStore).
|
||||||
auto srcStore = openStore(*from);
|
auto fromStore = openStore(*fromStoreUrl);
|
||||||
|
|
||||||
copyClosure(*srcStore, *state.store, RealisedPath::Set { *storePath });
|
copyClosure(*fromStore, *state.store, RealisedPath::Set { *fromPath });
|
||||||
|
|
||||||
/* In pure mode, require a CA path. */
|
/* In pure mode, require a CA path. */
|
||||||
if (evalSettings.pureEval) {
|
if (evalSettings.pureEval) {
|
||||||
auto info = state.store->queryPathInfo(*storePath);
|
auto info = state.store->queryPathInfo(*fromPath);
|
||||||
if (!info->isContentAddressed(*state.store))
|
if (!info->isContentAddressed(*state.store))
|
||||||
throw Error({
|
throw Error({
|
||||||
.msg = hintfmt("in pure mode, 'fetchClosure' requires a content-addressed path, which '%s' isn't",
|
.msg = hintfmt("in pure mode, 'fetchClosure' requires a content-addressed path, which '%s' isn't",
|
||||||
state.store->printStorePath(*storePath)),
|
state.store->printStorePath(*fromPath)),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto storePathS = state.store->printStorePath(*storePath);
|
auto fromPathS = state.store->printStorePath(*fromPath);
|
||||||
v.mkString(storePathS, {storePathS});
|
v.mkString(fromPathS, {fromPathS});
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPrimOp primop_fetchClosure({
|
static RegisterPrimOp primop_fetchClosure({
|
||||||
|
|
Loading…
Reference in a new issue