From 110b8541dca943a5513ce2ad4e1e8863806aa56f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 17 Jan 2023 17:35:27 +0300 Subject: Add support for multiple system package versions --- bpkg/system-repository.hxx | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'bpkg/system-repository.hxx') diff --git a/bpkg/system-repository.hxx b/bpkg/system-repository.hxx index f33d622..d070c49 100644 --- a/bpkg/system-repository.hxx +++ b/bpkg/system-repository.hxx @@ -20,23 +20,38 @@ namespace bpkg // that are present in the database; in a sence it was authoritative but // on some previous run. // - // Note that in our model we assume that once an authoritative version has - // been discovered, it does not change (on this run; see caching logic in + // Note that in our model we assume that once an authoritative versions have + // been discovered, they does not change (on this run; see caching logic in // available package). // + using system_package_versions = small_vector; + struct system_package { - using version_type = bpkg::version; - - version_type version; + system_package_versions versions; bool authoritative; }; class system_repository { public: - const version& - insert (const package_name& name, const version&, bool authoritative); + // @@ Add move-insertion overloads (system_package_versions&& and + // version&&)? + // + + // Note: the system package versions are assumed to be provided in the + // preference descending order. + // + const system_package_versions& + insert (const package_name& name, + const system_package_versions&, + bool authoritative); + + const system_package_versions& + insert (const package_name& n, const version& v, bool a) + { + return insert (n, system_package_versions ({v}), a); + } const system_package* find (const package_name& name) -- cgit v1.1