aboutsummaryrefslogtreecommitdiff
path: root/bbot/bootstrap-manifest.hxx
blob: 9d583ad6710f22c22ab19148d07347f6ca6815f1 (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
// file      : bbot/bootstrap-manifest.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : TBC; see accompanying LICENSE file

#ifndef BBOT_BOOTSTRAP_MANIFEST_HXX
#define BBOT_BOOTSTRAP_MANIFEST_HXX

#include <map>

#include <butl/manifest-forward>

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

namespace bbot
{
  // 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
    //
    using versions_type = std::map<string, uint64_t>;
    versions_type versions;

    explicit
    bootstrap_manifest (versions_type v)
        : versions (move (v)) {}

  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;
  };
}

#endif // BBOT_BOOTSTRAP_MANIFEST_HXX