Skip to content

Commit fff8db2

Browse files
author
volth
authored
canBuildLocally: check for features
It could happen that the local builder match the system but lacks some features. Now it results a failure. The fix gracefully excludes the local builder from the set of available builders for derivation which requires the feature, so the derivation is built on remote builders only (as though it has incompatible system, like ```aarch64-linux``` when local is x86)
1 parent b71e1fb commit fff8db2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/build-remote/build-remote.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ static AutoCloseFD openSlotLock(const Machine & m, unsigned long long slot)
3838
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true);
3939
}
4040

41+
static bool allSupportedLocally(const std::set<std::string>& requiredFeatures) {
42+
for (auto & feature : requiredFeatures)
43+
if (!settings.systemFeatures.get().count(feature)) return false;
44+
return true;
45+
}
46+
4147
static int _main(int argc, char * * argv)
4248
{
4349
{
@@ -97,9 +103,10 @@ static int _main(int argc, char * * argv)
97103
source >> drvPath;
98104
auto requiredFeatures = readStrings<std::set<std::string>>(source);
99105

100-
auto canBuildLocally = amWilling
101-
&& ( neededSystem == settings.thisSystem
102-
|| settings.extraPlatforms.get().count(neededSystem) > 0);
106+
auto canBuildLocally = amWilling
107+
&& ( neededSystem == settings.thisSystem
108+
|| settings.extraPlatforms.get().count(neededSystem) > 0)
109+
&& allSupportedLocally(requiredFeatures);
103110

104111
/* Error ignored here, will be caught later */
105112
mkdir(currentLoad.c_str(), 0777);

0 commit comments

Comments
 (0)