diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-21 16:34:00 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-25 16:16:19 +0300 |
commit | 8468f0beac9b792d7e2621f1a78a485ed542fb1d (patch) | |
tree | ce5d3274ff6ef90361496eb0d6d81f912c14ab0e | |
parent | 22716755cbdbfa9b0db1dfafe73252093132ab68 (diff) |
Ignore version iteration in satisfies() overloads (GH issue #293)
-rw-r--r-- | bpkg/package-query.hxx | 1 | ||||
-rw-r--r-- | bpkg/satisfaction.cxx | 20 | ||||
-rw-r--r-- | bpkg/satisfaction.hxx | 9 |
3 files changed, 23 insertions, 7 deletions
diff --git a/bpkg/package-query.hxx b/bpkg/package-query.hxx index 98bb7a0..12456ce 100644 --- a/bpkg/package-query.hxx +++ b/bpkg/package-query.hxx @@ -93,7 +93,6 @@ namespace bpkg using config_repo_fragments = database_map<vector<shared_ptr<repository_fragment>>>; - available_packages find_available (const package_name&, const optional<version_constraint>&, diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx index cbcb5a0..4229004 100644 --- a/bpkg/satisfaction.cxx +++ b/bpkg/satisfaction.cxx @@ -34,13 +34,19 @@ namespace bpkg // if (c.min_version) { - int i (ev.compare (*c.min_version, !c.min_version->revision)); + int i (ev.compare (*c.min_version, + !c.min_version->revision, + true /* ignore_iteration */)); + s = c.min_open ? i > 0 : i >= 0; } if (s && c.max_version) { - int i (ev.compare (*c.max_version, !c.max_version->revision)); + int i (ev.compare (*c.max_version, + !c.max_version->revision, + true /* ignore_iteration */)); + s = c.max_open ? i < 0 : i <= 0; } @@ -85,7 +91,10 @@ namespace bpkg version lv (norm (*l.min_version, true /* min */, l.min_open)); version rv (norm (*r.min_version, true /* min */, r.min_open)); - int i (lv.compare (rv, false /* ignore_revision */)); + int i (lv.compare (rv, + false /* ignore_revision */, + true /* ignore_iteration */)); + if (l.min_open) // Doesn't matter if r is min_open or not. // @@ -108,7 +117,10 @@ namespace bpkg version lv (norm (*l.max_version, false /* min */, l.max_open)); version rv (norm (*r.max_version, false /* min */, r.max_open)); - int i (lv.compare (rv, false /* ignore_revision */)); + int i (lv.compare (rv, + false /* ignore_revision */, + true /* ignore_iteration */)); + if (l.max_open) // Doesn't matter if r is max_open or not. // diff --git a/bpkg/satisfaction.hxx b/bpkg/satisfaction.hxx index 8df4580..174e375 100644 --- a/bpkg/satisfaction.hxx +++ b/bpkg/satisfaction.hxx @@ -12,8 +12,13 @@ namespace bpkg { - // Note: all of the following functions expect the package version - // constraints to be complete. + // Notes: + // + // - All of the following functions expect the package version constraints + // to be complete. + // + // - The version iterations are ignored on version comparisons. + // // Return true if version satisfies the constraint. // |