mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
Factor out Machine::systemSupported
There's just enough logic (the `"builtin"` special case) that makes this worthy of its own method.
This commit is contained in:
parent
870acc2892
commit
0aa85088de
@ -137,9 +137,8 @@ static int main_build_remote(int argc, char * * argv)
|
||||
for (auto & m : machines) {
|
||||
debug("considering building on remote machine '%s'", m.storeUri);
|
||||
|
||||
if (m.enabled
|
||||
&& (neededSystem == "builtin"
|
||||
|| m.systemTypes.count(neededSystem) > 0) &&
|
||||
if (m.enabled &&
|
||||
m.systemSupported(neededSystem) &&
|
||||
m.allSupported(requiredFeatures) &&
|
||||
m.mandatoryMet(requiredFeatures))
|
||||
{
|
||||
|
@ -38,6 +38,11 @@ Machine::Machine(decltype(storeUri) storeUri,
|
||||
sshPublicHostKey(sshPublicHostKey)
|
||||
{}
|
||||
|
||||
bool Machine::systemSupported(const std::string & system) const
|
||||
{
|
||||
return system == "builtin" || (systemTypes.count(system) > 0);
|
||||
}
|
||||
|
||||
bool Machine::allSupported(const std::set<std::string> & features) const
|
||||
{
|
||||
return std::all_of(features.begin(), features.end(),
|
||||
|
@ -19,6 +19,12 @@ struct Machine {
|
||||
const std::string sshPublicHostKey;
|
||||
bool enabled = true;
|
||||
|
||||
/**
|
||||
* @return Whether `system` is either `"builtin"` or in
|
||||
* `systemTypes`.
|
||||
*/
|
||||
bool systemSupported(const std::string & system) const;
|
||||
|
||||
/**
|
||||
* @return Whether `features` is a subset of the union of `supportedFeatures` and
|
||||
* `mandatoryFeatures`
|
||||
|
Loading…
Reference in New Issue
Block a user