aboutsummaryrefslogtreecommitdiff
path: root/bpkg/satisfaction.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/satisfaction.cxx')
-rw-r--r--bpkg/satisfaction.cxx46
1 files changed, 24 insertions, 22 deletions
diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx
index 52def32..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.
//
@@ -128,12 +140,10 @@ namespace bpkg
return s;
}
- static version build2_version;
+ version build2_version;
- void
- satisfy_build2 (const common_options& o,
- const package_name& pkg,
- const dependency& d)
+ bool
+ satisfy_build2 (const common_options& o, const dependency& d)
{
assert (d.name == "build2");
@@ -180,18 +190,13 @@ namespace bpkg
fail << "unable to determine build2 version of " << name_b (o);
}
- if (!satisfies (build2_version, d.constraint))
- fail << "unable to satisfy constraint (" << d << ") for package "
- << pkg <<
- info << "available build2 version is " << build2_version;
+ return satisfies (build2_version, d.constraint);
}
- static version bpkg_version;
+ version bpkg_version;
- void
- satisfy_bpkg (const common_options&,
- const package_name& pkg,
- const dependency& d)
+ bool
+ satisfy_bpkg (const common_options&, const dependency& d)
{
assert (d.name == "bpkg");
@@ -200,9 +205,6 @@ namespace bpkg
if (bpkg_version.empty ())
bpkg_version = version (BPKG_VERSION_STR);
- if (!satisfies (bpkg_version, d.constraint))
- fail << "unable to satisfy constraint (" << d << ") for package "
- << pkg <<
- info << "available bpkg version is " << bpkg_version;
+ return satisfies (bpkg_version, d.constraint);
}
}