git: f93d92f43d98 - main - pkgbase: report errors via metalog reader exit status
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Nov 2022 14:14:33 UTC
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f93d92f43d984c1d927c7c12d06ae1497d12deea commit f93d92f43d984c1d927c7c12d06ae1497d12deea Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-11-23 21:40:22 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-11-25 14:13:31 +0000 pkgbase: report errors via metalog reader exit status Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37482 --- 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))