aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index 125a8f3..06c1853 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -827,7 +827,7 @@ namespace bpkg
bool
toolchain_buildtime_dependency (const common_options& o,
const dependency_alternatives_ex& das,
- const package_name& pkg)
+ const package_name* pkg)
{
if (das.buildtime)
{
@@ -839,10 +839,10 @@ namespace bpkg
if (dn == "build2")
{
- if (d.constraint && !satisfy_build2 (o, d))
+ if (pkg != nullptr && d.constraint && !satisfy_build2 (o, d))
{
fail << "unable to satisfy constraint (" << d << ") for "
- << "package " << pkg <<
+ << "package " << *pkg <<
info << "available build2 version is " << build2_version;
}
@@ -850,10 +850,10 @@ namespace bpkg
}
else if (dn == "bpkg")
{
- if (d.constraint && !satisfy_bpkg (o, d))
+ if (pkg != nullptr && d.constraint && !satisfy_bpkg (o, d))
{
fail << "unable to satisfy constraint (" << d << ") for "
- << "package " << pkg <<
+ << "package " << *pkg <<
info << "available bpkg version is " << bpkg_version;
}
@@ -865,4 +865,18 @@ namespace bpkg
return false;
}
+
+ bool
+ has_dependencies (const common_options& o,
+ const dependencies& deps,
+ const package_name* pkg)
+ {
+ for (const auto& das: deps)
+ {
+ if (!toolchain_buildtime_dependency (o, das, pkg))
+ return true;
+ }
+
+ return false;
+ }
}