From 32fc535d7d9e7cea238d8769867372943c9602c1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 3 May 2017 12:34:20 +0300 Subject: Add support for toolchain name/version in task request manifest --- libbbot/manifest.cxx | 33 +++++++++++++++++++++++++++++++++ libbbot/manifest.hxx | 4 ++++ 2 files changed, 37 insertions(+) (limited to 'libbbot') 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 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)) {} -- cgit v1.1