aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-25 16:01:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-25 16:01:42 +0200
commitdb495f3c771ecfe2911d55ba41ab83d22409bcc0 (patch)
tree270119003ad3bedbd23f220f549dceae8623fa38
parentffab0e52df6609050f19f0cbd31b2f7d7d2daa1b (diff)
Print reason for fetching repository unless user-added
-rw-r--r--bpkg/cfg-fetch.cxx35
1 files changed, 30 insertions, 5 deletions
diff --git a/bpkg/cfg-fetch.cxx b/bpkg/cfg-fetch.cxx
index 1fba31e..c261863 100644
--- a/bpkg/cfg-fetch.cxx
+++ b/bpkg/cfg-fetch.cxx
@@ -25,7 +25,9 @@ namespace bpkg
static void
cfg_fetch (const common_options& co,
transaction& t,
- const shared_ptr<repository>& r)
+ const shared_ptr<repository>& r,
+ const shared_ptr<repository>& root,
+ const string& reason)
{
tracer trace ("cfg_fetch(rep)");
@@ -39,8 +41,20 @@ namespace bpkg
// The fetch_*() functions below will be quiet at level 1, which
// can be quite confusing if the download hangs.
//
- if (verb >= (rl.remote () ? 1 : 2))
- text << "fetching " << r->name;
+ if (verb)
+ {
+ diag_record dr (text);
+
+ dr << "fetching " << r->name;
+
+ const auto& ua (root->complements);
+
+ if (ua.find (lazy_shared_ptr<repository> (db, r)) == ua.end ())
+ {
+ assert (!reason.empty ());
+ dr << " (" << reason << ")";
+ }
+ }
r->fetched = true; // Mark as being fetched.
@@ -89,7 +103,18 @@ namespace bpkg
// (or is already being) fetched.
//
if (!pr->fetched)
- cfg_fetch (co, t, pr);
+ {
+ string reason;
+ switch (rr)
+ {
+ case repository_role::complement: reason = "complements "; break;
+ case repository_role::prerequisite: reason = "prerequisite of "; break;
+ case repository_role::base: assert (false);
+ }
+ reason += r->name;
+
+ cfg_fetch (co, t, pr, root, reason);
+ }
// @@ What if we have duplicated? Ideally, we would like to check
// this once and as early as possible. The original idea was to
@@ -226,7 +251,7 @@ namespace bpkg
// their packages.
//
for (const lazy_shared_ptr<repository>& lp: ua)
- cfg_fetch (o, t, lp.load ());
+ cfg_fetch (o, t, lp.load (), root, ""); // No reason (user-added).
size_t rcount, pcount;
if (verb)