about summary refs log tree commit diff
path: root/scripts/build-remote.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-30T21·22-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-30T21·22-0400
commit59a26360c75f1cf5fe65fce5e3703df0b6645140 (patch)
tree0335e94c4d795df78a62b63f41ca241e9698d344 /scripts/build-remote.pl.in
parent82ae0e688c21794bea583f9b48bb3639f7e2601a (diff)
Support mandatory system features in the build hook
Mandatory features are features that MUST be present in a derivation's
requiredSystemFeatures attribute.  One application is performance
testing, where we have a dedicated machine to run performance tests
(and nothing else).  Then we would add the label "perf" to the
machine's mandatory features and to the performance testing
derivations.
Diffstat (limited to 'scripts/build-remote.pl.in')
-rwxr-xr-xscripts/build-remote.pl.in12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index da5561cd2199..e54386d424fa 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -70,13 +70,16 @@ if (defined $conf && -e $conf) {
         s/\#.*$//g;
         next if /^\s*$/;
         my @tokens = split /\s/, $_;
+        my @supportedFeatures = split(/,/, $tokens[5] || "");
+        my @mandatoryFeatures = split(/,/, $tokens[6] || "");
         push @machines,
             { hostName => $tokens[0]
             , systemTypes => [ split(/,/, $tokens[1]) ]
             , sshKeys => $tokens[2]
             , maxJobs => int($tokens[3])
             , speedFactor => 1.0 * (defined $tokens[4] ? int($tokens[4]) : 1)
-            , features => [ split(/,/, $tokens[5] || "") ]
+            , supportedFeatures => [ @supportedFeatures, @mandatoryFeatures ]
+            , mandatoryFeatures => [ @mandatoryFeatures ]
             , enabled => 1
             };
     }
@@ -90,8 +93,7 @@ my ($drvPath, $hostName, $slotLock);
 
 REQ: while (1) {
     $_ = <STDIN> || exit 0;
-    my ($amWilling, $neededSystem);
-    ($amWilling, $neededSystem, $drvPath, $requiredFeatures) = split;
+    (my $amWilling, my $neededSystem, $drvPath, my $requiredFeatures) = split;
     my @requiredFeatures = split /,/, $requiredFeatures;
 
     my $canBuildLocally = $amWilling && ($localSystem eq $neededSystem);
@@ -117,7 +119,9 @@ REQ: while (1) {
         LOOP: foreach my $cur (@machines) {
             if ($cur->{enabled}
                 && (grep { $neededSystem eq $_ } @{$cur->{systemTypes}})
-                && all(map { my $f = $_; 0 != grep { $f eq $_ } @{$cur->{features}} } @requiredFeatures))
+                && all(map { my $f = $_; 0 != grep { $f eq $_ } @{$cur->{supportedFeatures}} } (@requiredFeatures, @mandatoryFeatures))
+                && all(map { my $f = $_; 0 != grep { $f eq $_ } @requiredFeatures } @{$cur->{mandatoryFeatures}})
+                )
             {
                 $rightType = 1;