aboutsummaryrefslogtreecommitdiff
path: root/bbot
diff options
context:
space:
mode:
Diffstat (limited to 'bbot')
-rw-r--r--bbot/manifest16
-rw-r--r--bbot/manifest.cxx40
2 files changed, 22 insertions, 34 deletions
diff --git a/bbot/manifest b/bbot/manifest
index bf0471e..2cedbb6 100644
--- a/bbot/manifest
+++ b/bbot/manifest
@@ -26,15 +26,14 @@ namespace bbot
class LIBBBOT_EXPORT machine_manifest
{
public:
+ // A "machine header".
+ //
std::string id;
std::string name;
+ std::string summary;
- // Absent if inside task_request_manifest.
- //
butl::optional<machine_type> type;
- std::string summary;
-
machine_manifest (std::string i, std::string n, std::string s)
: id (std::move (i)), name (std::move (n)), summary (std::move (s)) {}
@@ -43,16 +42,11 @@ namespace bbot
machine_manifest (butl::manifest_parser&, bool ignore_unknown = false);
machine_manifest (butl::manifest_parser&,
butl::manifest_name_value start,
+ bool header_only = false,
bool ignore_unknown = false);
void
serialize (butl::manifest_serializer&) const;
-
- private:
- machine_manifest (butl::manifest_parser&,
- butl::manifest_name_value start,
- bool in_list,
- bool ignore_unknown);
};
using machine_manifests = std::vector<machine_manifest>;
@@ -72,7 +66,7 @@ namespace bbot
//
std::string fingerprint;
- machine_manifests machines;
+ machine_manifests machines; // Only machine headers.
public:
task_request_manifest () = default; // VC export.
diff --git a/bbot/manifest.cxx b/bbot/manifest.cxx
index b9c623e..a40d633 100644
--- a/bbot/manifest.cxx
+++ b/bbot/manifest.cxx
@@ -80,13 +80,7 @@ namespace bbot
}
machine_manifest::
- machine_manifest (parser& p, name_value nv, bool iu)
- : machine_manifest (p, nv, true, iu)
- {
- }
-
- machine_manifest::
- machine_manifest (parser& p, name_value nv, bool il, bool iu)
+ machine_manifest (parser& p, name_value nv, bool ho, bool iu)
{
auto bad_name = [&p, &nv] (const string& d)
{
@@ -131,9 +125,19 @@ namespace bbot
name = move (v);
}
+ else if (n == "summary")
+ {
+ if (!summary.empty ())
+ bad_name ("machine summary redefinition");
+
+ if (v.empty ())
+ bad_value ("empty machine summary");
+
+ summary = move (v);
+ }
else if (n == "type")
{
- if (il)
+ if (ho)
bad_name ("machine type not allowed");
if (type)
@@ -148,16 +152,6 @@ namespace bbot
type = static_cast<machine_type> (i - b);
}
- else if (n == "summary")
- {
- if (!summary.empty ())
- bad_name ("machine summary redefinition");
-
- if (v.empty ())
- bad_value ("empty machine summary");
-
- summary = move (v);
- }
else if (!iu)
bad_name ("unknown name '" + n + "' in machine manifest");
}
@@ -170,11 +164,11 @@ namespace bbot
if (name.empty ())
bad_value ("no machine name specified");
- if (!il && !type)
- bad_value ("no machine type specified");
-
if (summary.empty ())
bad_value ("no machine summary specified");
+
+ if (!ho && !type)
+ bad_value ("no machine type specified");
}
void machine_manifest::
@@ -186,6 +180,7 @@ namespace bbot
s.next ("", "1"); // Start of manifest.
s.next ("id", id);
s.next ("name", name);
+ s.next ("summary", summary);
if (type)
{
@@ -194,7 +189,6 @@ namespace bbot
s.next ("type", machine_type_names[v]);
}
- s.next ("summary", summary);
s.next ("", ""); // End of manifest.
}
@@ -265,7 +259,7 @@ namespace bbot
// Parse machine manifests.
//
for (nv = p.next (); !nv.empty (); nv = p.next ())
- machines.emplace_back (machine_manifest (p, nv, iu));
+ machines.emplace_back (machine_manifest (p, nv, true, iu));
if (machines.empty ())
bad_value ("no task request machines specified");