diff options
Diffstat (limited to 'bbot/machine-manifest.cxx')
-rw-r--r-- | bbot/machine-manifest.cxx | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/bbot/machine-manifest.cxx b/bbot/machine-manifest.cxx index 0292824..bddf4d5 100644 --- a/bbot/machine-manifest.cxx +++ b/bbot/machine-manifest.cxx @@ -1,14 +1,14 @@ // file : bbot/machine-manifest.cxx -*- C++ -*- -// license : TBC; see accompanying LICENSE file +// license : MIT; see accompanying LICENSE file #include <bbot/machine-manifest.hxx> #include <sstream> -#include <libbutl/tab-parser.mxx> -#include <libbutl/string-parser.mxx> -#include <libbutl/manifest-parser.mxx> -#include <libbutl/manifest-serializer.mxx> +#include <libbutl/tab-parser.hxx> +#include <libbutl/string-parser.hxx> +#include <libbutl/manifest-parser.hxx> +#include <libbutl/manifest-serializer.hxx> using namespace std; using namespace butl; @@ -41,7 +41,7 @@ namespace bbot { if (t == "kvm") return machine_type::kvm; else if (t == "nspawn") return machine_type::nspawn; - else throw invalid_argument ("invalid machine type '" + t + "'"); + else throw invalid_argument ("invalid machine type '" + t + '\''); } // machine_manifest @@ -326,24 +326,36 @@ namespace bbot if (!machine.mac) bad_name ("mac address must be present in machine manifest"); - nv = p.next (); - if (nv.empty ()) - bad_value ("toolchain manifest expected"); + if (machine.effective_role () == machine_role::build) + { + nv = p.next (); + if (nv.empty ()) + bad_value ("toolchain manifest expected"); - toolchain = toolchain_manifest (p, nv, iu); + toolchain = toolchain_manifest (p, nv, iu); - nv = p.next (); - if (nv.empty ()) - bad_value ("bootstrap manifest expected"); + nv = p.next (); + if (nv.empty ()) + bad_value ("bootstrap manifest expected"); - bootstrap = bootstrap_manifest (p, nv, iu); + bootstrap = bootstrap_manifest (p, nv, iu); - // Make sure this is the end. - // - nv = p.next (); - if (!nv.empty ()) - throw parsing (p.name (), nv.name_line, nv.name_column, - "single bootstrapped machine manifest expected"); + // Make sure this is the end. + // + nv = p.next (); + if (!nv.empty ()) + throw parsing (p.name (), nv.name_line, nv.name_column, + "single bootstrapped machine manifest expected"); + } + else + { + // Make sure this is the end. + // + nv = p.next (); + if (!nv.empty ()) + throw parsing (p.name (), nv.name_line, nv.name_column, + "single machine manifest expected"); + } } void bootstrapped_machine_manifest:: @@ -359,8 +371,12 @@ namespace bbot "mac address must be present in machine manifest"); machine.serialize (s); - toolchain.serialize (s); - bootstrap.serialize (s); + + if (machine.effective_role () == machine_role::build) + { + toolchain.serialize (s); + bootstrap.serialize (s); + } s.next ("", ""); // End of stream. } |