From 856c55d0f8c50d0f371a546e4231e0f415975690 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 16 Jun 2022 09:43:32 +0200 Subject: Initial support for negotiation with system dependencies --- bpkg/pkg-build.cxx | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'bpkg/pkg-build.cxx') diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 318ce91..a8976ad 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1060,23 +1060,41 @@ namespace bpkg init_skeleton (const common_options& options, const shared_ptr& override = nullptr) { - const shared_ptr& ap (override != nullptr - ? override - : available); + shared_ptr ap (override != nullptr + ? override + : available); assert (!skeleton && ap != nullptr); - optional src_root (external_dir ()); + package_key pk (db, ap->id.name); - optional out_root ( - src_root && !disfigure - ? dir_path (db.get ().config) /= name ().string () - : optional ()); + if (system) + { + // @@ TODO + // + // Keep the available package if its version is "close enough" to the + // system package version. For now we will require the exact match + // but in the future we could relax this (e.g., allow the user to + // specify something like libfoo/^1.2.0 or some such). + // + ap = nullptr; + } + + optional src_root, out_root; + + if (ap != nullptr) + { + src_root = external_dir (); + out_root = (src_root && !disfigure + ? dir_path (db.get ().config) /= name ().string () + : optional ()); + } skeleton = package_skeleton ( options, - db, - ap, + move (pk), + system, + move (ap), config_vars, // @@ Maybe make optional and move? disfigure, (selected != nullptr ? &selected->config_variables : nullptr), @@ -4620,7 +4638,9 @@ namespace bpkg const package_configuration& pc ( cfg.dependency_configurations[p]); - pair pr (b->skeleton->verify_sensible (pc)); + pair pr (b->skeleton->available != nullptr + ? b->skeleton->verify_sensible (pc) + : make_pair (true, string ())); if (!pr.first) { @@ -5961,7 +5981,12 @@ namespace bpkg const package_configuration& pc ( pcfg->dependency_configurations[p]); - pair pr (b->skeleton->verify_sensible (pc)); + // Skip the verification if this is a system package + // without skeleton info. + // + pair pr (b->skeleton->available != nullptr + ? b->skeleton->verify_sensible (pc) + : make_pair (true, string ())); if (!pr.first) { -- cgit v1.1