aboutsummaryrefslogtreecommitdiff
path: root/libbbot
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-03 12:34:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-03 12:34:20 +0300
commit32fc535d7d9e7cea238d8769867372943c9602c1 (patch)
tree29e8413dcf1cc984bddfdab966b4d714dc636ff0 /libbbot
parentf7d8a2c9a447e3071f0ed66e68ae636f1ac4a3dd (diff)
Add support for toolchain name/version in task request manifest
Diffstat (limited to 'libbbot')
-rw-r--r--libbbot/manifest.cxx33
-rw-r--r--libbbot/manifest.hxx4
2 files changed, 37 insertions, 0 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index 89412d7..c52f3e3 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -243,6 +243,31 @@ namespace bbot
agent = move (v);
}
+ else if (n == "toolchain-name")
+ {
+ if (!toolchain_name.empty ())
+ bad_name ("task request toolchain name redefinition");
+
+ if (v.empty ())
+ bad_value ("empty task request toolchain name");
+
+ toolchain_name = move (v);
+ }
+ else if (n == "toolchain-version")
+ {
+ if (!toolchain_version.empty ())
+ bad_name ("task request toolchain version redefinition");
+
+ try
+ {
+ toolchain_version = standard_version (v);
+ }
+ catch (const invalid_argument& e)
+ {
+ bad_value (string ("invalid task request toolchain version: ") +
+ e.what ());
+ }
+ }
else if (n == "fingerprint")
{
if (fingerprint)
@@ -262,6 +287,12 @@ namespace bbot
if (agent.empty ())
bad_value ("no task request agent specified");
+ if (toolchain_name.empty ())
+ bad_value ("no task request toolchain name specified");
+
+ if (toolchain_version.empty ())
+ bad_value ("no task request toolchain version specified");
+
// Parse machine header manifests.
//
for (nv = p.next (); !nv.empty (); nv = p.next ())
@@ -279,6 +310,8 @@ namespace bbot
//
s.next ("", "1"); // Start of manifest.
s.next ("agent", agent);
+ s.next ("toolchain-name", toolchain_name);
+ s.next ("toolchain-version", toolchain_version.string ());
if (fingerprint)
s.next ("fingerprint", *fingerprint);
diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx
index 025efc7..a42eeea 100644
--- a/libbbot/manifest.hxx
+++ b/libbbot/manifest.hxx
@@ -68,9 +68,13 @@ namespace bbot
machine_header_manifests machines;
task_request_manifest (std::string a,
+ std::string n,
+ butl::standard_version v,
butl::optional<std::string> f,
machine_header_manifests m)
: agent (std::move (a)),
+ toolchain_name (std::move (n)),
+ toolchain_version (std::move (v)),
fingerprint (std::move (f)),
machines (std::move (m)) {}