From 7ec5a2ef1ac80d2a3b1715e75ac4e507330de4e6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 15 Mar 2021 22:02:40 +0300 Subject: Add support for interactive-{mode,login} task request and interactive task manifest values --- libbbot/manifest.hxx | 69 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 12 deletions(-) (limited to 'libbbot/manifest.hxx') diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index daee743..c3bb6ce 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -62,14 +62,40 @@ namespace bbot using machine_header_manifests = std::vector; + // Agent's capability to perform (non-)interactive builds. + // + enum class interactive_mode: std::uint8_t + { + false_, + true_, + both + }; + + LIBBBOT_EXPORT std::string + to_string (interactive_mode); + + LIBBBOT_EXPORT interactive_mode + to_interactive_mode (const std::string&); // May throw invalid_argument. + + inline std::ostream& + operator<< (std::ostream& os, interactive_mode m) + { + return os << to_string (m); + } + class LIBBBOT_EXPORT task_request_manifest { public: + using interactive_mode_type = bbot::interactive_mode; + std::string agent; std::string toolchain_name; butl::standard_version toolchain_version; + butl::optional interactive_mode; + butl::optional interactive_login; + // Agent's public key SHA256 fingerprint. // // @@ How the fingerpring for openssl public key will be produced? Seems @@ -82,16 +108,31 @@ 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)) {} + // Return the effective interactive build mode. If the mode is not + // explicitly specified, then false is assumed. + // + interactive_mode_type + effective_interactive_mode () const noexcept + { + return interactive_mode + ? *interactive_mode + : interactive_mode_type::false_; + } + + task_request_manifest (std::string ag, + std::string tn, + butl::standard_version tv, + butl::optional im, + butl::optional il, + butl::optional fp, + machine_header_manifests ms) + : agent (std::move (ag)), + toolchain_name (std::move (tn)), + toolchain_version (std::move (tv)), + interactive_mode (std::move (im)), + interactive_login (std::move (il)), + fingerprint (std::move (fp)), + machines (std::move (ms)) {} public: task_request_manifest () = default; // VC export. @@ -146,6 +187,8 @@ namespace bbot // strings warning_regex; + butl::optional interactive; // Interactive build breakpoint. + strings unquoted_config () const; @@ -161,7 +204,8 @@ namespace bbot butl::target_triplet tg, butl::optional en, strings cf, - strings wr) + strings wr, + butl::optional ir) : name (std::move (nm)), version (std::move (vr)), repository (std::move (rl)), @@ -171,7 +215,8 @@ namespace bbot target (std::move (tg)), environment (std::move (en)), config (std::move (cf)), - warning_regex (std::move (wr)){} + warning_regex (std::move (wr)), + interactive (std::move (ir)) {} public: task_manifest () = default; // VC export. -- cgit v1.1