@@ -322,6 +322,22 @@ Goal::Co DerivationGoal::haveDerivation()
322322}
323323
324324
325+ static std::string showKnownOutputs (Store & store, const Derivation & drv)
326+ {
327+ std::string msg;
328+ StorePathSet expectedOutputPaths;
329+ for (auto & i : drv.outputsAndOptPaths (store))
330+ if (i.second .second )
331+ expectedOutputPaths.insert (*i.second .second );
332+ if (!expectedOutputPaths.empty ()) {
333+ msg += " \n Output paths:" ;
334+ for (auto & p : expectedOutputPaths)
335+ msg += fmt (" \n %s" , Magenta (store.printStorePath (p)));
336+ }
337+ return msg;
338+ }
339+
340+
325341/* At least one of the output paths could not be
326342 produced using a substitute. So we have to build instead. */
327343Goal::Co DerivationGoal::gaveUpOnSubstitution ()
@@ -392,9 +408,14 @@ Goal::Co DerivationGoal::gaveUpOnSubstitution()
392408 if (nrFailed != 0 ) {
393409 if (!useDerivation)
394410 throw Error (" some dependencies of '%s' are missing" , worker.store .printStorePath (drvPath));
395- co_return done (BuildResult::DependencyFailed, {}, Error (
396- " %s dependencies of derivation '%s' failed to build" ,
397- nrFailed, worker.store .printStorePath (drvPath)));
411+ auto msg = fmt (
412+ " Cannot build '%s'.\n "
413+ " Reason: " ANSI_RED " %d %s failed" ANSI_NORMAL " ." ,
414+ Magenta (worker.store .printStorePath (drvPath)),
415+ nrFailed,
416+ nrFailed == 1 ? " dependency" : " dependencies" );
417+ msg += showKnownOutputs (worker.store , *drv);
418+ co_return done (BuildResult::DependencyFailed, {}, Error (msg));
398419 }
399420
400421 if (retrySubstitution == RetrySubstitution::YesNeed) {
@@ -955,12 +976,16 @@ Goal::Co DerivationGoal::buildDone()
955976
956977 diskFull |= cleanupDecideWhetherDiskFull ();
957978
958- auto msg = fmt (" builder for '%s' %s" ,
979+ auto msg = fmt (
980+ " Cannot build '%s'.\n "
981+ " Reason: " ANSI_RED " builder %s" ANSI_NORMAL " ." ,
959982 Magenta (worker.store .printStorePath (drvPath)),
960983 statusToString (status));
961984
985+ msg += showKnownOutputs (worker.store , *drv);
986+
962987 if (!logger->isVerbose () && !logTail.empty ()) {
963- msg += fmt (" ; \n last %d log lines:\n " , logTail.size ());
988+ msg += fmt (" \n Last %d log lines:\n " , logTail.size ());
964989 for (auto & line : logTail) {
965990 msg += " > " ;
966991 msg += line;
0 commit comments