diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-19 16:25:36 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-19 16:28:58 +0300 |
commit | f42795b9a9b435f9db94922eba47e44fa18f56e5 (patch) | |
tree | 80b2523414100a1bc0e5f1c7a30d30f8c47253f5 | |
parent | 668d33eb875572f6c2dec08b5908381558bc91b7 (diff) |
Add system_package_status to system_repository entries
-rw-r--r-- | bpkg/pkg-build.cxx | 46 | ||||
-rw-r--r-- | bpkg/system-repository.cxx | 8 | ||||
-rw-r--r-- | bpkg/system-repository.hxx | 13 |
3 files changed, 49 insertions, 18 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 254adb9..154fde9 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1539,7 +1539,7 @@ namespace bpkg pkg_options options; strings config_vars; - // If schema is sys then this member indicated whether the constraint + // If schema is sys then this member indicates whether the constraint // came from the system package manager (not NULL) or user/fallback // (NULL). // @@ -1765,17 +1765,16 @@ namespace bpkg // if (sp == nullptr || !sp->authoritative) { - //@@ Need to note if this is "queried" system package which, if - // selected, must be passed to pkg_install(). Also save the - // system_version to show in the plan? + //@@ Also save the system_version to show in the plan? db->system_repository->insert (nm, *vc->min_version, - true /* authoritative */); + true /* authoritative */, + sps); } } - return move (*vc); + return make_pair (move (*vc), sps); }; // Create the parsed package argument. Issue diagnostics and fail if the @@ -1796,8 +1795,14 @@ namespace bpkg if (db == nullptr) assert (sc == package_scheme::sys && os.dependency ()); - pkg_arg r { - db, sc, move (nm), move (vc), string (), move (os), move (vs)}; + pkg_arg r {db, + sc, + move (nm), + move (vc), + string () /* value */, + move (os), + move (vs), + nullptr /* system_status */}; // Verify that the package database is specified in the multi-config // mode, unless this is a system dependency package. @@ -1818,9 +1823,14 @@ namespace bpkg { assert (stubs != nullptr); - r.constraint = add_system_package ( - db, r.name, move (r.constraint), stubs); + auto sp (add_system_package (db, + r.name, + move (r.constraint), + nullptr /* system_package_status */, + stubs)); + r.constraint = move (sp.first); + r.system_status = sp.second; break; } case package_scheme::none: break; // Nothing to do. @@ -1842,7 +1852,8 @@ namespace bpkg nullopt /* constraint */, move (v), move (os), - move (vs)}; + move (vs), + nullptr /* system_status */}; }; vector<pkg_arg> pkg_args; @@ -2230,7 +2241,7 @@ namespace bpkg !compare_options (a.options, pa.options) || a.config_vars != pa.config_vars)) fail << "duplicate package " << pa.name << - info << "first mentioned as " << arg_string (r.first->second) << + info << "first mentioned as " << arg_string (a) << info << "second mentioned as " << arg_string (pa); return !r.second; @@ -2601,7 +2612,8 @@ namespace bpkg ? move (pa.options.checkout_root ()) : optional<dir_path> ()), pa.options.checkout_purge (), - move (pa.config_vars)}); + move (pa.config_vars), + pa.system_status}); continue; } @@ -2661,7 +2673,7 @@ namespace bpkg // if (pa.constraint) { - for (;;) + for (;;) // Breakout loop. { if (ap != nullptr) // Must be that version, see above. break; @@ -3278,7 +3290,11 @@ namespace bpkg // The system package may only have an exact/wildcard version // specified. // - add_system_package (&db, p.name, p.constraint, nullptr /* stubs */); + add_system_package (&db, + p.name, + p.constraint, + p.system_status, + nullptr /* stubs */); enter (db, p); }; diff --git a/bpkg/system-repository.cxx b/bpkg/system-repository.cxx index d7a47b7..c308ddb 100644 --- a/bpkg/system-repository.cxx +++ b/bpkg/system-repository.cxx @@ -6,9 +6,12 @@ namespace bpkg { const version& system_repository:: - insert (const package_name& name, const version& v, bool authoritative) + insert (const package_name& name, + const version& v, + bool authoritative, + const system_package_status* s) { - auto p (map_.emplace (name, system_package {v, authoritative})); + auto p (map_.emplace (name, system_package {v, authoritative, s})); if (!p.second) { @@ -22,6 +25,7 @@ namespace bpkg { sp.authoritative = authoritative; sp.version = v; + sp.system_status = s; } } diff --git a/bpkg/system-repository.hxx b/bpkg/system-repository.hxx index f33d622..8171a0c 100644 --- a/bpkg/system-repository.hxx +++ b/bpkg/system-repository.hxx @@ -12,6 +12,8 @@ #include <bpkg/types.hxx> #include <bpkg/utility.hxx> +#include <bpkg/system-package-manager.hxx> + namespace bpkg { // A map of discovered system package versions. The information can be @@ -30,13 +32,22 @@ namespace bpkg version_type version; bool authoritative; + + // If the information is authoritative then this member indicates whether + // the version came from the system package manager (not NULL) or + // user/fallback (NULL). + // + const system_package_status* system_status; }; class system_repository { public: const version& - insert (const package_name& name, const version&, bool authoritative); + insert (const package_name& name, + const version&, + bool authoritative, + const system_package_status* = nullptr); const system_package* find (const package_name& name) |