summaryrefslogtreecommitdiff
path: root/build/build.c
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2020-10-08 10:45:46 +0200
committerPanu Matilainen <pmatilai@redhat.com>2021-12-15 11:53:54 +0200
commit7fd7a60ea29aab018359037058de95b116455db1 (patch)
tree0b68ae3b3921abd832eb2d5896c687f2a7f3b055 /build/build.c
parent845364186d1ddde419656fa85d9483eabf4a72e2 (diff)
downloadrpm-7fd7a60ea29aab018359037058de95b116455db1.tar.gz
Separate build warnings from error summary
Confusingly, the "RPM build errors" section also includes messages logged as warnings. That gives the false impression that they somehow contributed to the actual build failure and therefore were turned into errors. This appears to be a historical artifact; when a message passes through the logging system and is of the priority RPMLOG_WARNING or higher, we save it in a global buffer (ctx->recs), which is then simply dumped with rpmlogPrint() in the error summary. This was probably good enough when the summary was introduced (commit f2efc72, year 2000), as there were almost no warnings generated by RPM at that time, however as they became more abundant, the summary code was never revisited. There are 3 ways to fix this discrepancy: 1) Change the summary's title to "RPM build problems" 2) Remove the summary altogether 3) Don't show warnings in it Options #1 and #2 would be too disruptive. The error summary needs to stay as is, for the following reasons: - While it usually just repeats the last error, not all errors terminate a build right away, so those can get drown in the output that follows after. Examples: "File not found" in rpmInstall(), or macro expansion errors (note: we may have these terminate a build in the future). - It makes it immediately obvious that something went wrong when examining build logs, and the title "RPM build errors" undoubtedly has become the de-facto text string to search for. That leaves us with option #3. To further lessen the disruption, do keep a summary of warnings, but put them under their own heading, and only show it on build failures. That way, we restrict all the extra verbosity to error time (as it is now) and don't pollute the output of otherwise good builds. There may be packages with long-standing warnings that are not feasible to fix for any reason, and having an indented block of text resembling "RPM build errors" at the end of every build would do no good. Effectively, this commit is just cosmetic - it splits the error summary into two, without any functional or API changes (apart from two function additions). Fixes: #793
Diffstat (limited to 'build/build.c')
-rw-r--r--build/build.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/build/build.c b/build/build.c
index 5a067c830..2ef6d0204 100644
--- a/build/build.c
+++ b/build/build.c
@@ -431,11 +431,21 @@ exit:
freeStringBuf(sink);
free(cookie);
spec->rootDir = NULL;
- if (rc != RPMRC_OK && rc != RPMRC_MISSINGBUILDREQUIRES &&
- rpmlogGetNrecs() > 0) {
- rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n"));
- rpmlogPrint(NULL);
+
+ if (rc != RPMRC_OK && rc != RPMRC_MISSINGBUILDREQUIRES) {
+ unsigned maskWarn = RPMLOG_MASK(RPMLOG_WARNING);
+ unsigned maskErrs = RPMLOG_UPTO(RPMLOG_ERR);
+
+ if (rpmlogGetNrecsByMask(maskWarn)) {
+ rpmlog(RPMLOG_NOTICE, _("\n\nRPM build warnings:\n"));
+ rpmlogPrintByMask(NULL, maskWarn);
+ }
+ if (rpmlogGetNrecsByMask(maskErrs)) {
+ rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n"));
+ rpmlogPrintByMask(NULL, maskErrs);
+ }
}
+
rpmugFree();
if (missing_buildreqs && !rc) {
rc = RPMRC_MISSINGBUILDREQUIRES;