blob: 3d0a0c0ff0f5a67f99e7ebae84819b3e59e49e7c (
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
|
// file : bpkg/system-repository.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <bpkg/system-repository>
namespace bpkg
{
system_repository_type system_repository;
const version& system_repository_type::
insert (const string& name, const version& v, bool authoritative)
{
auto p (map_.emplace (name, system_package {v, authoritative}));
if (!p.second)
{
system_package& sp (p.first->second);
// We should not override authoritative information.
//
assert (!(authoritative && sp.authoritative));
if (authoritative >= sp.authoritative)
{
sp.authoritative = authoritative;
sp.version = v;
}
}
return p.first->second.version;
}
}
|