mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Merge pull request #13259 from NixOS/mergify/bp/2.29-maintenance/pr-13256
Fix nlohmann error in fromStructuredAttrs() (backport #13256)
This commit is contained in:
commit
d761dad79c
4 changed files with 13 additions and 6 deletions
|
@ -211,8 +211,13 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
auto e = optionalValueAt(parsed->structuredAttrs, "exportReferencesGraph");
|
auto e = optionalValueAt(parsed->structuredAttrs, "exportReferencesGraph");
|
||||||
if (!e || !e->is_object())
|
if (!e || !e->is_object())
|
||||||
return ret;
|
return ret;
|
||||||
for (auto & [key, storePathsJson] : getObject(*e)) {
|
for (auto & [key, value] : getObject(*e)) {
|
||||||
ret.insert_or_assign(key, storePathsJson);
|
if (value.is_array())
|
||||||
|
ret.insert_or_assign(key, value);
|
||||||
|
else if (value.is_string())
|
||||||
|
ret.insert_or_assign(key, StringSet{value});
|
||||||
|
else
|
||||||
|
throw Error("'exportReferencesGraph' value is not an array or a string");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto s = getOr(env, "exportReferencesGraph", "");
|
auto s = getOr(env, "exportReferencesGraph", "");
|
||||||
|
|
|
@ -176,13 +176,13 @@ protected:
|
||||||
void getFile(const std::string & path,
|
void getFile(const std::string & path,
|
||||||
Callback<std::optional<std::string>> callback) noexcept override
|
Callback<std::optional<std::string>> callback) noexcept override
|
||||||
{
|
{
|
||||||
|
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkEnabled();
|
checkEnabled();
|
||||||
|
|
||||||
auto request(makeRequest(path));
|
auto request(makeRequest(path));
|
||||||
|
|
||||||
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
|
||||||
|
|
||||||
getFileTransfer()->enqueueFileTransfer(request,
|
getFileTransfer()->enqueueFileTransfer(request,
|
||||||
{[callbackPtr, this](std::future<FileTransferResult> result) {
|
{[callbackPtr, this](std::future<FileTransferResult> result) {
|
||||||
try {
|
try {
|
||||||
|
@ -198,7 +198,7 @@ protected:
|
||||||
}});
|
}});
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
callback.rethrow();
|
callbackPtr->rethrow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,8 @@ void Store::queryMissing(const std::vector<DerivedPath> & targets,
|
||||||
auto parsedDrv = StructuredAttrs::tryParse(drv->env);
|
auto parsedDrv = StructuredAttrs::tryParse(drv->env);
|
||||||
DerivationOptions drvOptions;
|
DerivationOptions drvOptions;
|
||||||
try {
|
try {
|
||||||
|
// FIXME: this is a lot of work just to get the value
|
||||||
|
// of `allowSubstitutes`.
|
||||||
drvOptions = DerivationOptions::fromStructuredAttrs(
|
drvOptions = DerivationOptions::fromStructuredAttrs(
|
||||||
drv->env,
|
drv->env,
|
||||||
parsedDrv ? &*parsedDrv : nullptr);
|
parsedDrv ? &*parsedDrv : nullptr);
|
||||||
|
|
|
@ -21,7 +21,7 @@ mkDerivation {
|
||||||
"b"
|
"b"
|
||||||
"c"
|
"c"
|
||||||
];
|
];
|
||||||
exportReferencesGraph.refs = [ dep ];
|
exportReferencesGraph.refs = dep;
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
touch ''${outputs[out]}; touch ''${outputs[dev]}
|
touch ''${outputs[out]}; touch ''${outputs[dev]}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue