From 35e3bdadfc40738adb33e51ea84d7976059a8f54 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Jun 2022 10:14:16 +0200 Subject: Improve diagnostics: not sensible --- bpkg/package-skeleton.cxx | 2 +- bpkg/pkg-build.cxx | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bpkg/package-skeleton.cxx b/bpkg/package-skeleton.cxx index eaebf26..9e2ce0d 100644 --- a/bpkg/package-skeleton.cxx +++ b/bpkg/package-skeleton.cxx @@ -493,7 +493,7 @@ namespace bpkg catch (const build2::failed&) { r.first = false; - r.second = ds.str (); + r.second = trim (ds.str ()); } ctx_ = nullptr; diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 296a41c..72b8b7a 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -4665,10 +4665,13 @@ namespace bpkg if (!pr.first) { - // @@ TODO: improve (see the other case). - // - fail << "unable to negotiate sensible configuration\n" - << " " << pr.second; + diag_record dr (fail); + dr << "unable to negotiate sensible configuration for " + << "dependency " << p << '\n' + << " " << pr.second; + + dr << info << "negotiated configuration:\n"; + pc.print (dr, " "); } b->skeleton->dependent_config (pc); @@ -6175,6 +6178,8 @@ namespace bpkg { // Verify and set the dependent configuration for this dependency. // + // Note: see similar code for the up-negotiation case. + // { assert (b->skeleton); // Should have been init'ed above. @@ -6185,16 +6190,18 @@ namespace bpkg if (!pr.first) { - // @@ TODO: improve (print dependencies, dependents, config). - // (also in the up-negotiation case). - // - // Note that the diagnostics from the dependent will most + // Note that the diagnostics from the dependency will most // likely be in the "error ..." form (potentially with // additional info lines) and by printing it with a two-space // indentation we make it "fit" into our diag record. // - fail << "unable to negotiate sensible configuration\n" - << " " << pr.second; + diag_record dr (fail); + dr << "unable to negotiate sensible configuration for " + << "dependency " << p << '\n' + << " " << pr.second; + + dr << info << "negotiated configuration:\n"; + pc.print (dr, " "); // Note 4 spaces since in nested info. } b->skeleton->dependent_config (pc); -- cgit v1.1