about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-08-27T13·18+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-08-27T13·18+0000
commit766f7084188d8c0dd0595bbbfc50fbc4f9d67a50 (patch)
tree2860458de610cf2e9b39cca440332b789e44f240 /src/libutil
parente41ecbf7303a181fd37026edb72f2f23dde7e73b (diff)
* Experimental feature: allow a derivation to tell the build hook that
  it requires a certain feature on the build machine, e.g.

    requiredSystemFeatures = [ "kvm" ];

  We need this in Hydra to make sure that builds that require KVM
  support are forwarded to machines that have KVM support.  Probably
  this should also be enforced for local builds.

Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc11
-rw-r--r--src/libutil/util.hh5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 9540720fe240..2d26fc66dafe 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -966,6 +966,17 @@ Strings tokenizeString(const string & s, const string & separators)
 }
 
 
+string concatStringsSep(const string & sep, const Strings & ss)
+{
+    string s;
+    foreach (Strings::const_iterator, i, ss) {
+        if (s.size() != 0) s += sep;
+        s += *i;
+    }
+    return s;
+}
+
+
 string statusToString(int status)
 {
     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index c45ebc062ffa..27ad46904958 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -280,6 +280,11 @@ MakeError(Interrupted, BaseError)
 Strings tokenizeString(const string & s, const string & separators = " \t\n\r");
 
 
+/* Concatenate the given strings with a separator between the
+   elements. */
+string concatStringsSep(const string & sep, const Strings & ss);
+
+
 /* Convert the exit status of a child as returned by wait() into an
    error string. */
 string statusToString(int status);