aboutsummaryrefslogtreecommitdiff
path: root/libbbot/manifest.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-03-08 20:24:35 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-03-12 16:27:58 +0300
commited8e64ca8525872c97f9331cb5c882b40864b84e (patch)
tree62abb95ed6dac0a8b25c7f5123d2093d5d26628c /libbbot/manifest.hxx
parent1d30ee0f8a017be6611e2eebffc5c539a8b1d12c (diff)
Add support for build auxiliary machines related manifest values
Diffstat (limited to 'libbbot/manifest.hxx')
-rw-r--r--libbbot/manifest.hxx81
1 files changed, 79 insertions, 2 deletions
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 <string>
#include <vector>
+#include <cstdint> // uint*_t
#include <ostream>
#include <libbutl/optional.hxx>
@@ -24,15 +25,57 @@ namespace bbot
{
using strings = std::vector<std::string>;
+ // 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<machine_role> role;
+ butl::optional<std::uint64_t> ram_minimum; // In KiB.
+ butl::optional<std::uint64_t> 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<machine_role> r,
+ butl::optional<std::uint64_t> rmn,
+ butl::optional<std::uint64_t> 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<std::string> fingerprint;
+ butl::optional<std::uint64_t> 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<interactive_mode_type> im,
butl::optional<std::string> il,
butl::optional<std::string> fp,
+ butl::optional<std::uint64_t> 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_machine> auxiliary_machines;
+
butl::target_triplet target; // Build target.
butl::optional<std::string> environment; // Build environment name.
+ // The environment variables describing the auxiliary machines.
+ //
+ butl::optional<std::string> auxiliary_environment;
+
// Build system configuration variables (in addition to build environment
// configuration variables).
//
@@ -218,8 +291,10 @@ namespace bbot
butl::small_vector<bpkg::test_dependency, 1> ts,
butl::optional<std::string> dc,
std::string mn,
+ std::vector<auxiliary_machine> ams,
butl::target_triplet tg,
butl::optional<std::string> en,
+ butl::optional<std::string> ae,
strings tc,
std::string pc,
butl::optional<bool> 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)),