about summary refs log tree commit diff
path: root/src/libstore/machines.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/machines.cc')
-rw-r--r--src/libstore/machines.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index 076c3cab3e90..d2faf45357e3 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -47,9 +47,22 @@ bool Machine::mandatoryMet(const std::set<string> & features) const {
 void parseMachines(const std::string & s, Machines & machines)
 {
     for (auto line : tokenizeString<std::vector<string>>(s, "\n;")) {
-        chomp(line);
+        trim(line);
         line.erase(std::find(line.begin(), line.end(), '#'), line.end());
         if (line.empty()) continue;
+
+        if (line[0] == '@') {
+            auto file = trim(std::string(line, 1));
+            try {
+                parseMachines(readFile(file), machines);
+            } catch (const SysError & e) {
+                if (e.errNo != ENOENT)
+                    throw;
+                debug("cannot find machines file '%s'", file);
+            }
+            continue;
+        }
+
         auto tokens = tokenizeString<std::vector<string>>(line);
         auto sz = tokens.size();
         if (sz < 1)
@@ -74,15 +87,6 @@ Machines getMachines()
 {
     Machines machines;
 
-    for (auto & file : settings.builderFiles.get()) {
-        try {
-            parseMachines(readFile(file), machines);
-        } catch (const SysError & e) {
-            if (e.errNo != ENOENT)
-                throw;
-        }
-    }
-
     parseMachines(settings.builders, machines);
 
     return machines;