aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-01-12 14:28:43 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-01-28 12:21:33 +0300
commitb90cbd6de11442500bbb6e0cdfe0bdcb286d67ec (patch)
tree22c89ff84779c8e4ccbae2b953b4110063fc52f6 /bpkg/package.cxx
parentf02e6f0bd299fc3b1dafb8c5b9bac78b78858e89 (diff)
Add support for multiple dependency alternatives
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index 9a8068c..e2a6911 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -7,6 +7,7 @@
#include <bpkg/database.hxx>
#include <bpkg/checksum.hxx>
#include <bpkg/diagnostics.hxx>
+#include <bpkg/satisfaction.hxx>
#include <bpkg/manifest-utility.hxx>
using namespace std;
@@ -764,4 +765,58 @@ namespace bpkg
r.push_back (move (pd));
return r;
}
+
+ bool
+ toolchain_buildtime_dependency (const common_options& o,
+ const dependency_alternatives_ex& das,
+ const package_name& pkg)
+ {
+ if (das.buildtime)
+ {
+ for (const dependency_alternative& da: das)
+ {
+ for (const dependency& d: da)
+ {
+ const package_name& dn (d.name);
+
+ if (dn == "build2")
+ {
+ if (d.constraint && !satisfy_build2 (o, d))
+ {
+ fail << "unable to satisfy constraint (" << d << ") for "
+ << "package " << pkg <<
+ info << "available build2 version is " << build2_version;
+ }
+
+ return true;
+ }
+ else if (dn == "bpkg")
+ {
+ if (d.constraint && !satisfy_bpkg (o, d))
+ {
+ fail << "unable to satisfy constraint (" << d << ") for "
+ << "package " << pkg <<
+ info << "available bpkg version is " << bpkg_version;
+ }
+
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool
+ evaluate_enabled (const dependency_alternative& da, const package_name& pkg)
+ {
+ // @@ DEP TMP
+ //
+ if (da.enable)
+ fail << "conditional dependency for package " << pkg <<
+ info << "conditional dependencies are not yet supported";
+
+ return true;
+ }
}