blob: 8df4580463fd6969365e75cc92e334318e8d645e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// file : bpkg/satisfaction.hxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#ifndef BPKG_SATISFACTION_HXX
#define BPKG_SATISFACTION_HXX
#include <bpkg/types.hxx>
#include <bpkg/utility.hxx>
#include <bpkg/package.hxx>
#include <bpkg/common-options.hxx>
namespace bpkg
{
// Note: all of the following functions expect the package version
// constraints to be complete.
// Return true if version satisfies the constraint.
//
bool
satisfies (const version&, const version_constraint&);
inline bool
satisfies (const version& v, const optional<version_constraint>& c)
{
return !c || satisfies (v, *c);
}
// Return true if any version that satisfies l also satisfies r, or, in
// other words, l is stricter than or equal to r. Or, in yet other words,
// l is a subset of r.
//
bool
satisfies (const version_constraint& l, const version_constraint& r);
inline bool
satisfies (const optional<version_constraint>& l,
const optional<version_constraint>& r)
{
return l ? (!r || satisfies (*l, *r)) : !r;
}
// Special build-time dependencies.
//
extern version build2_version; // Set on the first satisfy_build2() call.
bool
satisfy_build2 (const common_options&, const dependency&);
extern version bpkg_version; // Set on the first satisfy_bpkg() call.
bool
satisfy_bpkg (const common_options&, const dependency&);
}
#endif // BPKG_SATISFACTION_HXX
|