aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-07-01 16:22:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-07-31 14:38:50 +0300
commit9a4a925ca599cfaf27e88118011cc2f1cb8d9325 (patch)
tree74ab40975afb0210d28614d45e32b222c122c561
parentd4a9ce97de6630d76d7b144489bfa42e83b81abd (diff)
Some diagnostics/tracing cleanups
-rw-r--r--bpkg/pkg-build.cxx32
-rw-r--r--bpkg/pkg-checkout.cxx5
-rw-r--r--bpkg/pkg-fetch.cxx5
-rw-r--r--bpkg/pkg-unpack.cxx5
4 files changed, 35 insertions, 12 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 0372685..c6776c2 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -849,7 +849,13 @@ namespace bpkg
//
using sp_set = set<config_selected_package>;
- vector<pair<version, sp_set>> unsatisfiable;
+ // If there are no available package versions which don't satisfy some
+ // dependents, then it is left absent. Otherwise, it is filled with the
+ // unsatisfiable versions together with the respective unsatisfied
+ // dependents, unless we are in the ignore unsatisfiable mode, in which
+ // case it is empty.
+ //
+ optional<vector<pair<version, sp_set>>> unsatisfiable;
bool stub (false);
@@ -1023,8 +1029,11 @@ namespace bpkg
if (!satisfactory)
{
+ if (!unsatisfiable)
+ unsatisfiable = vector<pair<version, sp_set>> ();
+
if (!ignore_unsatisfiable)
- unsatisfiable.emplace_back (av, move (unsatisfied_dependents));
+ unsatisfiable->emplace_back (av, move (unsatisfied_dependents));
// If the dependency is expected to be configured as system, then bail
// out, as an available package version will always resolve to the
@@ -1201,17 +1210,22 @@ namespace bpkg
if (ignore_unsatisfiable)
{
l5 ([&]{trace << package_string (nm, dvc, dsys) << ddb
- << (unsatisfiable.empty ()
+ << (!unsatisfiable
? ": no source"
: ": unsatisfiable");});
return no_change ();
}
+ // If not in the ignore-unsatisfiable mode the unsatisfiable list is
+ // either absent or non-empty.
+ //
+ assert (!unsatisfiable || !unsatisfiable->empty ());
+
// If there are no unsatisfiable versions then the package is not present
// (or is not available in source) in its dependents' repositories.
//
- if (unsatisfiable.empty ())
+ if (!unsatisfiable)
{
diag_record dr (fail);
@@ -1255,9 +1269,9 @@ namespace bpkg
// dependents each.
//
size_t nv (0);
- for (const auto& u: unsatisfiable)
+ for (const auto& u: *unsatisfiable)
{
- dr << info << package_string (nm, u.first) << " doesn't satisfy";
+ dr << info << package_string (nm, u.first, dsys) << " doesn't satisfy";
const sp_set& ps (u.second);
@@ -1276,12 +1290,12 @@ namespace bpkg
if (i != n)
dr << " and " << n - i << " more";
- if (++nv == 3 && unsatisfiable.size () != 4)
+ if (++nv == 3 && unsatisfiable->size () != 4)
break;
}
- if (nv != unsatisfiable.size ())
- dr << info << "and " << unsatisfiable.size () - nv << " more";
+ if (nv != unsatisfiable->size ())
+ dr << info << "and " << unsatisfiable->size () - nv << " more";
dr << endf;
}
diff --git a/bpkg/pkg-checkout.cxx b/bpkg/pkg-checkout.cxx
index 81efdc2..6bf9443 100644
--- a/bpkg/pkg-checkout.cxx
+++ b/bpkg/pkg-checkout.cxx
@@ -167,9 +167,12 @@ namespace bpkg
fail << "package " << n << " " << v
<< " is not available from a version control-based repository";
- if (verb > 1)
+ if (verb > 1 && !simulate)
text << "checking out " << pl->location.leaf () << " "
<< "from " << pl->repository_fragment->name;
+ else
+ l4 ([&]{trace << pl->location.leaf () << " from "
+ << pl->repository_fragment->name << pdb;});
const repository_location& rl (pl->repository_fragment->location);
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 837c968..8126e69 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -252,9 +252,12 @@ namespace bpkg
fail << "package " << n << " " << v
<< " is not available from an archive-based repository";
- if (verb > 1)
+ if (verb > 1 && !simulate)
text << "fetching " << pl->location.leaf () << " "
<< "from " << pl->repository_fragment->name;
+ else
+ l4 ([&]{trace << pl->location.leaf () << " from "
+ << pl->repository_fragment->name << pdb;});
auto_rmfile arm;
path an (pl->location.leaf ());
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index 22ff02f..8437ea6 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -317,9 +317,12 @@ namespace bpkg
fail << "package " << n << " " << v
<< " is not available from a directory-based repository";
- if (verb > 1)
+ if (verb > 1 && !simulate)
text << "unpacking " << pl->location.leaf () << " "
<< "from " << pl->repository_fragment->name;
+ else
+ l4 ([&]{trace << pl->location.leaf () << " from "
+ << pl->repository_fragment->name << pdb;});
const repository_location& rl (pl->repository_fragment->location);