build: target_config_check: dedup error messages

Certain error message (for example invalid package names) were emitted
once for each device.
This commit is contained in:
Matthias Schiffer 2020-05-11 00:04:40 +02:00
parent 9379137373
commit 4540217342
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -1,13 +1,16 @@
local ret = 0 local errors = {}
local function fail(...) local function fail(...)
if ret == 0 then if not next(errors) then
ret = 1
io.stderr:write('Configuration failed:', '\n') io.stderr:write('Configuration failed:', '\n')
end end
io.stderr:write(' * ', string.format(...), '\n') local msg = string.format(...)
if not errors[msg] then
errors[msg] = true
io.stderr:write(' * ', msg, '\n')
end
end end
local function match_config(f) local function match_config(f)
@ -63,4 +66,6 @@ for config, v in pairs(lib.configs) do
end end
end end
os.exit(ret) if next(errors) then
os.exit(1)
end