aboutsummaryrefslogtreecommitdiff
path: root/bbot/bootstrap-manifest
blob: c29406a46fc4a5afef9f7ca95b61009bcaa22db0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// file      : bbot/bootstrap-manifest -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BBOT_BOOTSTRAP_MANIFEST
#define BBOT_BOOTSTRAP_MANIFEST

#include <map>

#include <butl/manifest-forward>

#include <bbot/types>
#include <bbot/utility>

#include <bbot/manifest> // machine_manifest

namespace bbot
{
  // Toolchain manifest.
  //
  class toolchain_manifest
  {
  public:

    // Toolchain id (SHAXXX).
    //
    string id;

  public:
    toolchain_manifest () = default; // VC export.
    toolchain_manifest (butl::manifest_parser&, bool ignore_unknown = false);
    toolchain_manifest (butl::manifest_parser&,
                        butl::manifest_name_value start,
                        bool ignore_unknown = false);

    void
    serialize (butl::manifest_serializer&) const;
  };

  // Bootstrap result manifest. Uploaded by the worker to the agent's TFTP
  // server.
  //
  class bootstrap_manifest
  {
  public:

    // Map of packages to their (numeric) versions that were used inside the
    // bootstrapped machine. Used to make sure bbot agent/worker use the same
    // versions. For example:
    //
    // libbbot-version: 1010100  # 1.1.1
    // bbot-version:    1010200  # 1.1.2
    //
    std::map<string, uint64_t> versions;

  public:
    bootstrap_manifest () = default; // VC export.
    bootstrap_manifest (butl::manifest_parser&, bool ignore_unknown = false);
    bootstrap_manifest (butl::manifest_parser&,
                        butl::manifest_name_value start,
                        bool ignore_unknown = false);

    void
    serialize (butl::manifest_serializer&) const;
  };

  // The manifest stored in <name>-<toolchain>/ consists of the machine
  // manifest (original), toolchain manifest, and bootstrap manifest.
  //
  class bootstrapped_machine_manifest
  {
  public:
    machine_manifest   machine;
    toolchain_manifest toolchain;
    bootstrap_manifest bootstrap;

  public:
    bootstrapped_machine_manifest () = default; // VC export.
    bootstrapped_machine_manifest (butl::manifest_parser&,
                                   bool ignore_unknown = false);

    void
    serialize (butl::manifest_serializer&) const;
  };
}

#endif // BBOT_BOOTSTRAP_MANIFEST