From 5b84b34eb1c4c49607a0d14706b15a6923f1ab0c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Aug 2021 11:40:35 +0200 Subject: Print diagnostics about empty configurations after "in configuration ...:" In particular, this makes sure they are separated with blank lines. --- bdep/build.txx | 31 +++++++++++++++---------------- bdep/deinit.cxx | 31 +++++++++++++++---------------- bdep/status.cxx | 36 +++++++++++++++++------------------- bdep/sync.cxx | 31 ++++++++++++++++++------------- 4 files changed, 65 insertions(+), 64 deletions(-) diff --git a/bdep/build.txx b/bdep/build.txx index 7d17088..c546559 100644 --- a/bdep/build.txx +++ b/bdep/build.txx @@ -94,35 +94,34 @@ namespace bdep ps.push_back (s.name.string ().c_str ()); } + // If we are printing multiple configurations, separate them with a + // blank line and print the configuration name/directory. + // + if (verb && cfgs.size () > 1) + { + text << (first ? "" : "\n") + << "in configuration " << *c << ':'; + + first = false; + } + if (ps.empty ()) { if (verb) { diag_record dr (info); - dr << "skipping configuration " << *c; - if (c->packages.empty ()) - dr << info << "configuration is empty"; + dr << "no packages "; else - dr << info << "none of specified packages initialized in this " - << "configuration"; + dr << "none of specified packages "; + + dr << "initialized in configuration " << *c << ", skipping"; } continue; } - // If we are printing multiple configurations, separate them with a - // blank line and print the configuration name/directory. - // - if (verb && cfgs.size () > 1) - { - text << (first ? "" : "\n") - << "in configuration " << *c << ':'; - - first = false; - } - // Pre-sync the configuration to avoid triggering the build system hook // (see sync for details). // diff --git a/bdep/deinit.cxx b/bdep/deinit.cxx index 00eba45..90447ad 100644 --- a/bdep/deinit.cxx +++ b/bdep/deinit.cxx @@ -166,35 +166,34 @@ namespace bdep ps.push_back (s.name.string ()); } + // If we are printing multiple configurations, separate them with a + // blank line and print the configuration name/directory. + // + if (verb && cfgs.size () > 1) + { + text << (first ? "" : "\n") + << "in configuration " << *c << ':'; + + first = false; + } + if (ps.empty ()) { if (verb) { diag_record dr (info); - dr << "skipping configuration " << *c; - if (c->packages.empty ()) - dr << info << "configuration is empty"; + dr << "no packages "; else - dr << info << "none of specified packages initialized in this " - << "configuration"; + dr << "none of specified packages "; + + dr << "initialized in configuration " << *c << ", skipping"; } continue; } - // If we are printing multiple configurations, separate them with a - // blank line and print the configuration name/directory. - // - if (verb && cfgs.size () > 1) - { - text << (first ? "" : "\n") - << "in configuration " << *c << ':'; - - first = false; - } - transaction t (db.begin ()); // Remove collected packages from the configuration. diff --git a/bdep/status.cxx b/bdep/status.cxx index fc07698..b64a9a4 100644 --- a/bdep/status.cxx +++ b/bdep/status.cxx @@ -96,15 +96,6 @@ namespace bdep bool first (true); for (const shared_ptr& c: cfgs) { - if (c->packages.empty ()) - { - if (verb) - info << "skipping configuration " << *c << - info << "configuration is empty"; - - continue; - } - // Collect the packages to print, unless the dependency packages are // specified. // @@ -131,16 +122,6 @@ namespace bdep }) != ps.end ()) pkgs.push_back (s.name.string ()); } - - if (pkgs.empty ()) - { - if (verb) - info << "skipping configuration " << *c << - info << "none of specified packages initialized in this " - << "configuration"; - - continue; - } } // If we are printing multiple configurations, separate them with a @@ -154,6 +135,23 @@ namespace bdep first = false; } + if (c->packages.empty () || (pkgs.empty () && dep_pkgs.empty ())) + { + if (verb) + { + diag_record dr (info); + + if (c->packages.empty ()) + dr << "no packages "; + else + dr << "none of specified packages "; + + dr << "initialized in configuration " << *c << ", skipping"; + } + + continue; + } + bool fetch (o.fetch () || o.fetch_full ()); if (fetch) diff --git a/bdep/sync.cxx b/bdep/sync.cxx index 3ab3ab4..e4e302b 100644 --- a/bdep/sync.cxx +++ b/bdep/sync.cxx @@ -1516,24 +1516,16 @@ namespace bdep continue; } - // Skipping empty ones. + // Skipping empty ones (part one). // // Note that we would normally be printing that for build-time // dependency configurations (which normally will not have any - // initialized packages) and that would be annying. So we suppress it in - // case of the default configuration fallback (but also check and warn - // if all of them were empty below). + // initialized packages) and that would be annoying. So we suppress it + // in case of the default configuration fallback (but also check and + // warn if all of them were empty below). // - if (c != nullptr && c->packages.empty ()) - { - if (verb && !default_fallback) - info << "skipping configuration " << *c << - info << "configuration is empty"; - + if (c != nullptr && c->packages.empty () && default_fallback) continue; - } - - empty = false; // If we are synchronizing multiple configurations, separate them with a // blank line and print the configuration name/directory. @@ -1542,6 +1534,19 @@ namespace bdep text << (i == 0 ? "" : "\n") << "in configuration " << *c << ':'; + // Skipping empty ones (part two). + // + if (c != nullptr && c->packages.empty ()) + { + if (verb) + info << "no packages initialized in configuration " << *c + << ", skipping"; + + continue; + } + + empty = false; + bool fetch (o.fetch () || o.fetch_full ()); if (fetch) -- cgit v1.1