git: 39c9fd8f2beb - stable/13 - pkgbase: report errors via metalog reader exit status
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Mar 2023 15:10:59 UTC
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=39c9fd8f2bebe2edfb700d0dd0458089ba687a7e commit 39c9fd8f2bebe2edfb700d0dd0458089ba687a7e Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-11-23 21:40:22 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-03-23 15:10:47 +0000 pkgbase: report errors via metalog reader exit status Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37482 (cherry picked from commit f93d92f43d984c1d927c7c12d06ae1497d12deea) --- tools/pkgbase/metalog_reader.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/pkgbase/metalog_reader.lua b/tools/pkgbase/metalog_reader.lua index 72cfcf46c95b..3e8cf8461914 100644 --- a/tools/pkgbase/metalog_reader.lua +++ b/tools/pkgbase/metalog_reader.lua @@ -86,13 +86,14 @@ function main(args) local sess = Analysis_session(filename, verbose, w_notagdirs) + local errors if printall then io.write('--- PACKAGE REPORTS ---\n') io.write(sess.pkg_report_full()) io.write('--- LINTING REPORTS ---\n') - print_lints(sess) + errors = print_lints(sess) elseif checkonly then - print_lints(sess) + errors = print_lints(sess) elseif pkgonly then io.write(sess.pkg_report_simple(dcount, dsize, { fuid and sess.pkg_issetuid or nil, @@ -103,6 +104,10 @@ function main(args) io.stderr:write('This text should not be displayed.') usage() end + + if errors then + return 1 + end end --- @param man boolean @@ -151,6 +156,7 @@ function print_lints(sess) local inodewarn, inodeerr = sess.inode_report() io.write(inodewarn) io.write(inodeerr) + return #duperr > 0 or #inodeerr > 0 end --- @param t table @@ -520,4 +526,4 @@ function Analysis_session(metalog, verbose, w_notagdirs) } end -main(arg) +os.exit(main(arg))