pkgbase: report errors via metalog reader exit status

Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37482
This commit is contained in:
Ed Maste 2022-11-23 16:40:22 -05:00
parent ff0c7816db
commit f93d92f43d

View File

@ -86,13 +86,14 @@ function main(args)
local sess = Analysis_session(filename, verbose, w_notagdirs) local sess = Analysis_session(filename, verbose, w_notagdirs)
local errors
if printall then if printall then
io.write('--- PACKAGE REPORTS ---\n') io.write('--- PACKAGE REPORTS ---\n')
io.write(sess.pkg_report_full()) io.write(sess.pkg_report_full())
io.write('--- LINTING REPORTS ---\n') io.write('--- LINTING REPORTS ---\n')
print_lints(sess) errors = print_lints(sess)
elseif checkonly then elseif checkonly then
print_lints(sess) errors = print_lints(sess)
elseif pkgonly then elseif pkgonly then
io.write(sess.pkg_report_simple(dcount, dsize, { io.write(sess.pkg_report_simple(dcount, dsize, {
fuid and sess.pkg_issetuid or nil, fuid and sess.pkg_issetuid or nil,
@ -103,6 +104,10 @@ function main(args)
io.stderr:write('This text should not be displayed.') io.stderr:write('This text should not be displayed.')
usage() usage()
end end
if errors then
return 1
end
end end
--- @param man boolean --- @param man boolean
@ -151,6 +156,7 @@ function print_lints(sess)
local inodewarn, inodeerr = sess.inode_report() local inodewarn, inodeerr = sess.inode_report()
io.write(inodewarn) io.write(inodewarn)
io.write(inodeerr) io.write(inodeerr)
return #duperr > 0 or #inodeerr > 0
end end
--- @param t table --- @param t table
@ -520,4 +526,4 @@ function Analysis_session(metalog, verbose, w_notagdirs)
} }
end end
main(arg) os.exit(main(arg))