8b64517f1b
Always allow options set to builtin (=y) when modular setting (=m) is
expected. This can happen when a package is added explicitly (in a
target defintion or site.mk) that is also pulled in as a dependency of
another builtin package.
Fixes: 9e23534ec3
("build: rework config generation")
Fixes: #2046
48 lines
754 B
Lua
Executable File
48 lines
754 B
Lua
Executable File
local errors = false
|
|
|
|
local function fail(msg)
|
|
if not errors then
|
|
errors = true
|
|
io.stderr:write('Configuration failed:', '\n')
|
|
end
|
|
|
|
io.stderr:write(' * ', msg, '\n')
|
|
end
|
|
|
|
local function match_config(expected, actual)
|
|
if expected == actual then
|
|
return true
|
|
end
|
|
|
|
if expected:gsub('=m$', '=y') == actual then
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
local function check_config(config)
|
|
for line in io.lines('openwrt/.config') do
|
|
if match_config(config, line) then
|
|
return true
|
|
end
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
|
|
local lib = dofile('scripts/target_config_lib.lua')
|
|
|
|
for _, config in pairs(lib.configs) do
|
|
if config.required then
|
|
if not check_config(config:format()) then
|
|
fail(config.required)
|
|
end
|
|
end
|
|
end
|
|
|
|
if errors then
|
|
os.exit(1)
|
|
end
|