Fix --profile with multiple opaque paths
This commit is contained in:
parent
d89472a912
commit
a9bbfaa851
1 changed files with 6 additions and 8 deletions
|
@ -128,27 +128,25 @@ void MixProfile::updateProfile(const Buildables & buildables)
|
||||||
{
|
{
|
||||||
if (!profile) return;
|
if (!profile) return;
|
||||||
|
|
||||||
std::optional<StorePath> result;
|
std::vector<StorePath> result;
|
||||||
|
|
||||||
for (auto & buildable : buildables) {
|
for (auto & buildable : buildables) {
|
||||||
std::visit(overloaded {
|
std::visit(overloaded {
|
||||||
[&](BuildableOpaque bo) {
|
[&](BuildableOpaque bo) {
|
||||||
result = bo.path;
|
result.push_back(bo.path);
|
||||||
},
|
},
|
||||||
[&](BuildableFromDrv bfd) {
|
[&](BuildableFromDrv bfd) {
|
||||||
for (auto & output : bfd.outputs) {
|
for (auto & output : bfd.outputs) {
|
||||||
if (result)
|
result.push_back(output.second);
|
||||||
throw Error("'--profile' requires that the arguments produce a single store path, but there are multiple");
|
|
||||||
result = output.second;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}, buildable);
|
}, buildable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result)
|
if (result.size() != 1)
|
||||||
throw Error("'--profile' requires that the arguments produce a single store path, but there are none");
|
throw Error("'--profile' requires that the arguments produce a single store path, but there are %d", result.size());
|
||||||
|
|
||||||
updateProfile(*result);
|
updateProfile(result[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
MixDefaultProfile::MixDefaultProfile()
|
MixDefaultProfile::MixDefaultProfile()
|
||||||
|
|
Loading…
Reference in a new issue