From 53c2aa8e382dd50d09b385285bc3fa0b645ace0a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 19 Aug 2016 17:37:29 +0300 Subject: Support system packages --- bpkg/system-repository.cxx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 bpkg/system-repository.cxx (limited to 'bpkg/system-repository.cxx') diff --git a/bpkg/system-repository.cxx b/bpkg/system-repository.cxx new file mode 100644 index 0000000..b2a892d --- /dev/null +++ b/bpkg/system-repository.cxx @@ -0,0 +1,33 @@ +// file : bpkg/system-repository.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +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; + } +} -- cgit v1.1