From ed8e64ca8525872c97f9331cb5c882b40864b84e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 8 Mar 2024 20:24:35 +0300 Subject: Add support for build auxiliary machines related manifest values --- libbbot/manifest.hxx | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 2 deletions(-) (limited to 'libbbot/manifest.hxx') diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index 5807aed..a815d3e 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -6,6 +6,7 @@ #include #include +#include // uint*_t #include #include @@ -24,15 +25,57 @@ namespace bbot { using strings = std::vector; + // The machine's role. + // + enum class machine_role: std::uint8_t + { + build, + auxiliary + }; + + LIBBBOT_EXPORT std::string + to_string (machine_role); + + LIBBBOT_EXPORT machine_role + to_machine_role (const std::string&); // May throw invalid_argument. + + inline std::ostream& + operator<< (std::ostream& os, machine_role r) + { + return os << to_string (r); + } + class LIBBBOT_EXPORT machine_header_manifest { public: std::string id; std::string name; std::string summary; + butl::optional role; + butl::optional ram_minimum; // In KiB. + butl::optional ram_maximum; // In KiB. - machine_header_manifest (std::string i, std::string n, std::string s) - : id (std::move (i)), name (std::move (n)), summary (std::move (s)) {} + // Return the effective machine role. If the role is not explicitly + // specified, then the build role is assumed. + // + machine_role + effective_role () const noexcept + { + return role ? *role : machine_role::build; + } + + machine_header_manifest (std::string i, + std::string n, + std::string s, + butl::optional r, + butl::optional rmn, + butl::optional rmx) + : id (std::move (i)), + name (std::move (n)), + summary (std::move (s)), + role (r), + ram_minimum (rmn), + ram_maximum (rmx) {} public: machine_header_manifest () = default; // VC export. @@ -106,6 +149,8 @@ namespace bbot // butl::optional fingerprint; + butl::optional auxiliary_ram; // In KiB. + machine_header_manifests machines; // Return the effective interactive build mode. If the mode is not @@ -125,6 +170,7 @@ namespace bbot butl::optional im, butl::optional il, butl::optional fp, + butl::optional ar, machine_header_manifests ms) : agent (std::move (ag)), toolchain_name (std::move (tn)), @@ -132,6 +178,7 @@ namespace bbot interactive_mode (std::move (im)), interactive_login (std::move (il)), fingerprint (std::move (fp)), + auxiliary_ram (ar), machines (std::move (ms)) {} public: @@ -149,6 +196,14 @@ namespace bbot bpkg::version version; }; + // Note: corresponds to build_auxiliary in the package manifest. + // + struct auxiliary_machine + { + std::string name; + std::string environment_name; + }; + class LIBBBOT_EXPORT task_manifest { public: @@ -174,10 +229,28 @@ namespace bbot std::string machine; // Build machine to use for building the package. + // The list of build auxiliary machines. + // + // Note that all entries in this list must have distinct environment names + // (with empty name being one of the possibilities). + // + // Also note that some auxiliary machines can potentially be used by the + // main package and some by the test packages. It is such package author's + // responsibility to make sure that the environment names specified in + // multiple package manifests do not clash. It is bbot controller's + // responsibility to verify that there is no clash, aborting the task if + // there is. + // + std::vector auxiliary_machines; + butl::target_triplet target; // Build target. butl::optional environment; // Build environment name. + // The environment variables describing the auxiliary machines. + // + butl::optional auxiliary_environment; + // Build system configuration variables (in addition to build environment // configuration variables). // @@ -218,8 +291,10 @@ namespace bbot butl::small_vector ts, butl::optional dc, std::string mn, + std::vector ams, butl::target_triplet tg, butl::optional en, + butl::optional ae, strings tc, std::string pc, butl::optional ht, @@ -234,8 +309,10 @@ namespace bbot tests (std::move (ts)), dependency_checksum (std::move (dc)), machine (std::move (mn)), + auxiliary_machines (std::move (ams)), target (std::move (tg)), environment (std::move (en)), + auxiliary_environment (std::move (ae)), target_config (std::move (tc)), package_config (std::move (pc)), host (std::move (ht)), -- cgit v1.1