aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-08-25 20:24:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-08-30 15:57:58 +0300
commit00a83b2ab6ca84776dfb5bec1679863c1896a813 (patch)
tree5d0e1a96fb5ab5ba1bb32620c1eb265fc519d122 /bpkg/package.cxx
parente30e71dee35d8e7b1a1c4759bc839533521033e8 (diff)
Consider repository information from ultimate dependent databases rather then from just main database
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx61
1 files changed, 44 insertions, 17 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index e0101fb..e458a86 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -217,13 +217,11 @@ namespace bpkg
//
assert (!prereq || chain.empty ());
- auto i (find_if (chain.begin (), chain.end (),
- [&rf] (const shared_ptr<repository_fragment>& i) -> bool
- {
- return i == rf;
- }));
-
- if (i != chain.end ())
+ if (find_if (chain.begin (), chain.end (),
+ [&rf] (const shared_ptr<repository_fragment>& i) -> bool
+ {
+ return i == rf;
+ }) != chain.end ())
return nullptr;
chain.emplace_back (rf);
@@ -390,26 +388,55 @@ namespace bpkg
}
void
- check_any_available (database& db, transaction&, const diag_record* dr)
+ check_any_available (const linked_databases& dbs,
+ transaction&,
+ const diag_record* drp)
{
- const dir_path& c (db.config_orig);
+ bool rep (false);
+ bool pkg (false);
+ for (database& db: dbs)
+ {
+ if (db.query_value<repository_count> () != 0)
+ {
+ rep = true;
+
+ if (db.query_value<available_package_count> () != 0)
+ {
+ pkg = true;
+ break;
+ }
+ }
+ }
- if (db.query_value<repository_count> () == 0)
+ if (pkg)
+ return;
+
+ diag_record d;
+ const diag_record& dr (drp != nullptr ? *drp << info : d << fail);
+
+ if (dbs.size () == 1)
+ dr << "configuration " << dbs[0].get ().config_orig << " has ";
+ else
+ dr << "specified configurations have ";
+
+ if (!rep)
{
- diag_record d;
- (dr != nullptr ? *dr << info : d << fail)
- << "configuration " << c << " has no repositories" <<
+ dr << "no repositories" <<
info << "use 'bpkg rep-add' to add a repository";
}
- else if (db.query_value<available_package_count> () == 0)
+ else
{
- diag_record d;
- (dr != nullptr ? *dr << info : d << fail)
- << "configuration " << c << " has no available packages" <<
+ dr << "no available packages" <<
info << "use 'bpkg rep-fetch' to fetch available packages list";
}
}
+ void
+ check_any_available (database& db, transaction& t, const diag_record* dr)
+ {
+ return check_any_available (linked_databases ({db}), t, dr);
+ }
+
string
package_string (const package_name& n, const version& v, bool system)
{