diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2021-12-15 12:34:52 +0200 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2022-07-01 10:52:14 +0200 |
commit | bbf7066cf1fefbcf563b9b9349b6e95c07a51996 (patch) | |
tree | 59fe25b91a2d943d90e46655eac0ce36992fc5f5 | |
parent | 0cfce5dc433fc94c1cad60b0619d27084119ba29 (diff) | |
download | rpm-bbf7066cf1fefbcf563b9b9349b6e95c07a51996.tar.gz |
Further improve build warning/error summary
Suppress summary output entirely on --quiet where the summary is wholly
redundant, and non-sensical (as witnessed by the test-case outputs)
at that because the summary title is omitted due to its NOTICE log level.
A build may have warnings without having any errors, lift the warnings
summary out of the rc-condition.
Finally, condense the output a bit, two empty lines at front seems a bit
excessive.
(cherry picked from commit 3d46bc95c5ebd61330921f131af51fa4b88f2512)
-rw-r--r-- | build/build.c | 14 | ||||
-rw-r--r-- | tests/rpmbuild.at | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/build/build.c b/build/build.c index 2ef6d0204..6d6c413ca 100644 --- a/build/build.c +++ b/build/build.c @@ -432,17 +432,21 @@ exit: free(cookie); spec->rootDir = NULL; - if (rc != RPMRC_OK && rc != RPMRC_MISSINGBUILDREQUIRES) { + /* Suppress summaries on --quiet */ + if (rpmIsNormal()) { unsigned maskWarn = RPMLOG_MASK(RPMLOG_WARNING); unsigned maskErrs = RPMLOG_UPTO(RPMLOG_ERR); if (rpmlogGetNrecsByMask(maskWarn)) { - rpmlog(RPMLOG_NOTICE, _("\n\nRPM build warnings:\n")); + rpmlog(RPMLOG_NOTICE, _("\nRPM build warnings:\n")); rpmlogPrintByMask(NULL, maskWarn); } - if (rpmlogGetNrecsByMask(maskErrs)) { - rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n")); - rpmlogPrintByMask(NULL, maskErrs); + + if (rc != RPMRC_OK && rc != RPMRC_MISSINGBUILDREQUIRES) { + if (rpmlogGetNrecsByMask(maskErrs)) { + rpmlog(RPMLOG_NOTICE, _("\nRPM build errors:\n")); + rpmlogPrintByMask(NULL, maskErrs); + } } } diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index ebb5affcc..30d8e6895 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -279,8 +279,6 @@ runroot rpmbuild \ [], [error: Installed (but unpackaged) file(s) found: /toot - Installed (but unpackaged) file(s) found: - /toot ]) AT_CLEANUP @@ -493,7 +491,6 @@ runroot rpmbuild -bb --quiet \ [1], [], [error: Illegal char '*' (0x2a) in: * - Illegal char '*' (0x2a) in: * ]) AT_CLEANUP |