Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework new-build failure reporting to include build logs #3686

Merged
merged 7 commits into from
Aug 11, 2016

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented Aug 10, 2016

This is the follow-up to #3665 and should address all the issues raised there.

Reporting build logs is important as we otherwise have no real info for why deps failed to build. It does make the presentation more difficult however because build logs can be long and in principle there can be several, which means it can take up more than a single screen in a console. The first thing users notice is typically the last few messages, so in the case that we're presenting long build logs then its important to also include a short summary at the end.

So our approach is this: for packages where we want to show a build log, we dump those first, in full, each with a header to indicate which package it is, log file name (for later reference), plus any extra detail we have from the phase of the failure or the exception. Then after all build logs we end with a short summary of the failure(s). For packages where we do not show a build log (e.g. local packages that dump live to the console) we only present a summary at the end, but we include a little more detail than for the packages that had a build log since this is the only thing we report for them. So we include details of the exception.

The PR starts with a few patches to rename things and rearrange the plumbing to get the info to the right place.

I think these names are now a bit more induitive / less confusing and a
bit more consistent.

We now have BuildOutcome(s) to mean either failure or a build result,
and BuildResult to mean the result of a non-failing build.
We're going to alter and extend the BuildResult and BuildFailure types
for the new-build code, so we cannot share those types with the old
install code.

This patch doesn't change the structure, just redefines them locally and
switches uses to record style so we can add new fields easily.
In both cases it's optional and only added when the log file is used.
This will be used later in reporting the build outcomes.
The PlanningFailed case does not happen. The ReplFailed, HaddocksFailed
cases were previously covered by BuildFailed but they're worth
disinguishing.
Reporting build logs is important as we otherwise have no real info for
why deps failed to build. It does make the presentation more difficult
however because build logs can be long and in principle there can be
several, which means it can take up more than a single screen in a
console. The first thing users notice is typically the last few
messages, so in the case that we're presenting long build logs then its
important to also include a short summary at the end.

So our approach is this: for packages where we want to show a build log,
we dump those first, in full, each with a header to indicate which
package it is, log file name (for later reference), plus any extra
detail we have from the phase of the failure or the exception. Then
after all build logs we end with a short summary of the failure(s). For
packages where we do not show a build log (e.g. local packages that dump
live to the console) we only present a summary at the end, but we
include a little more detail than for the packages that had a build log
since this is the only thing we report for them. So we include details
of the exception.
@dcoutts
Copy link
Contributor Author

dcoutts commented Aug 10, 2016

Compare the output from #3394:

$ cabal new-build
In order, the following will be built (use -v for more details):
zip-archive-0.3.0.2
pandoc-1.17.0.3
pandoc-citeproc-0.9.1.1
hakyll-4.8.3.0
blag-0.1.0.0
Configuring zip-archive-0.3.0.2...

with the output from a similar test case now (provoking a failure in zip-archive-0.3.0.2)

$ cabal new-build
Resolving dependencies...
In order, the following will be built (use -v for more details):
digest-0.0.1.2
zip-archive-0.3.0.2
blag-0.1.0.0
Downloading zip-archive-0.3.0.2...
Configuring digest-0.0.1.2...
Building digest-0.0.1.2...
Configuring zip-archive-0.3.0.2...

Failed to build zip-archive-0.3.0.2. The failure occurred during the configure
step.
Build log ( /home/duncan/.cabal/logs/zip-archive-0.3.0.2.log ):
[1 of 1] Compiling Main             ( /home/duncan/prgs/tst/dist-newstyle/tmp/zip-archive-10110/zip-archive-0.3.0.2/dist/setup/setup.hs, /home/duncan/prgs/tst/dist-newstyle/tmp/zip-archive-10110/zip-archive-0.3.0.2/dist/setup/Main.o )
Linking /home/duncan/prgs/tst/dist-newstyle/tmp/zip-archive-10110/zip-archive-0.3.0.2/dist/setup/setup ...
Configuring zip-archive-0.3.0.2...
setup: The following installed packages are broken because other packages they
depend on are missing. These broken packages must be rebuilt before they can
be used.
package text-1.2.2.1 is broken due to missing package
array-0.5.0.0-470385a50d2b78598af85cfe9d988e1b,
base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1,
binary-0.7.1.0-f867dbbb69966feb9f5c4ef7695a70a5,
bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5,
deepseq-1.3.0.2-63a1ab91b7017a28bb5d04cb1b5d2d02

cabal: Failed to build zip-archive-0.3.0.2 (which is required by blag)

@dcoutts
Copy link
Contributor Author

dcoutts commented Aug 10, 2016

Is it sufficiently clear from the summary at the end that there are further details above? Should we explicitly point to it? e.g.

cabal: Failed to build zip-archive-0.3.0.2 (which is required by blag). See
the build log above for details.

@23Skidoo
Copy link
Member

Should we explicitly point to it? e.g.

cabal: Failed to build zip-archive-0.3.0.2 (which is required by blag). See
the build log above for details.

+1, I think this is a good idea.

@@ -612,7 +663,8 @@ rebuildTargets verbosity
installPlan pkgsBuildStatus $ \downloadMap ->

-- For each package in the plan, in dependency order, but in parallel...
InstallPlan.execute jobControl keepGoing (DependentFailed . packageId)
InstallPlan.execute jobControl keepGoing
(BuildFailure Nothing . DependentFailed . packageId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably is more forward looking to have a mkBuildFailureNoLog function instead.

@ezyang
Copy link
Contributor

ezyang commented Aug 10, 2016

OK, looks good to me.

@ezyang
Copy link
Contributor

ezyang commented Aug 11, 2016

@dcoutts If you restart the AppVeyor build it should work now.

Make annotateFailure take a maybe log file, and add a
annotateFailureNoLog for the other case. This is a little more future
proof and simplifies things at the call sites.
@23Skidoo
Copy link
Member

LGTM as well.

@dcoutts dcoutts merged commit 6309f82 into haskell:master Aug 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants