Merge pull request #2710 from volth/patch-6
canBuildLocally: check for features
This commit is contained in:
		
						commit
						5886bc5996
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		|  | @ -38,6 +38,12 @@ static AutoCloseFD openSlotLock(const Machine & m, unsigned long long slot) | ||||||
|     return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true); |     return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static bool allSupportedLocally(const std::set<std::string>& requiredFeatures) { | ||||||
|  |     for (auto & feature : requiredFeatures) | ||||||
|  |         if (!settings.systemFeatures.get().count(feature)) return false; | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static int _main(int argc, char * * argv) | static int _main(int argc, char * * argv) | ||||||
| { | { | ||||||
|     { |     { | ||||||
|  | @ -97,9 +103,10 @@ static int _main(int argc, char * * argv) | ||||||
|             source >> drvPath; |             source >> drvPath; | ||||||
|             auto requiredFeatures = readStrings<std::set<std::string>>(source); |             auto requiredFeatures = readStrings<std::set<std::string>>(source); | ||||||
| 
 | 
 | ||||||
|             auto canBuildLocally = amWilling |              auto canBuildLocally = amWilling | ||||||
|                 &&  (  neededSystem == settings.thisSystem |                  &&  (  neededSystem == settings.thisSystem | ||||||
|                     || settings.extraPlatforms.get().count(neededSystem) > 0); |                      || settings.extraPlatforms.get().count(neededSystem) > 0) | ||||||
|  |                  &&  allSupportedLocally(requiredFeatures); | ||||||
| 
 | 
 | ||||||
|             /* Error ignored here, will be caught later */ |             /* Error ignored here, will be caught later */ | ||||||
|             mkdir(currentLoad.c_str(), 0777); |             mkdir(currentLoad.c_str(), 0777); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue