diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-09-01 15:29:00 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-09-01 16:31:53 +0300 |
commit | a3cdcd275c5bcb63bf459b1fa031513ae8662ffa (patch) | |
tree | 0833181b472dcc15e34def9ee5437c4a97dfed2b /bpkg/pkg-build.cxx | |
parent | a7d542d11f309785decbf2027891c122ceae278c (diff) |
Make ?sys: to change preference to system
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r-- | bpkg/pkg-build.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index d88e312..a022130 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -536,8 +536,15 @@ namespace bpkg // If all that's available is a stub then we need to make sure the // package is present in the system repository and it's version - // satisfies the constraint. + // satisfies the constraint. If a source package is available but there + // is an optional system package specified on the command line and it's + // version satisfies the constraint then the system package should be + // preferred. To recognize such a case we just need to check if the + // authoritative system version is set and it satisfies the constraint. + // If the corresponding system package is non-optional it will be + // preferred anyway. // + bool system (false); if (dap->stub ()) { if (dap->system_version () == nullptr) @@ -553,6 +560,17 @@ namespace bpkg info << "sys:" << d.name << "/" << *dap->system_version () << " does not satisfy the constrains"; } + + system = true; + } + else + { + auto p (dap->system_version_authoritative ()); + + if (p.first != nullptr && + p.second && // Authoritative. + satisfies (*p.first, d.constraint)) + system = true; } // Next see if this package is already selected. If we already @@ -569,7 +587,10 @@ namespace bpkg info << "use 'pkg-purge --force' to remove"; if (satisfies (dsp->version, d.constraint)) + { rp = make_available (options, cd, db, dsp); + system = dsp->system (); + } else // Remember that we may be forcing up/downgrade; we will deal // with it below. @@ -584,7 +605,7 @@ namespace bpkg nullopt, // Hold package. nullopt, // Hold version. {}, // Constraints. - dap->stub (), // System. + system, // System. {name}, // Required by. false}; // Reconfigure. |