Merge pull request #2621 from freifunk-gluon/target-default-packages
Include OpenWrt's target default package lists in config generation
This commit is contained in:
commit
928e7a9a57
1
Makefile
1
Makefile
@ -181,6 +181,7 @@ config: $(LUA) FORCE
|
|||||||
$(call CheckSite,$(conf)); \
|
$(call CheckSite,$(conf)); \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$(OPENWRTMAKE) prepare-tmpinfo
|
||||||
$(GLUON_ENV) $(LUA) scripts/target_config.lua > openwrt/.config
|
$(GLUON_ENV) $(LUA) scripts/target_config.lua > openwrt/.config
|
||||||
$(OPENWRTMAKE) defconfig
|
$(OPENWRTMAKE) defconfig
|
||||||
$(GLUON_ENV) $(LUA) scripts/target_config_check.lua
|
$(GLUON_ENV) $(LUA) scripts/target_config_check.lua
|
||||||
|
@ -123,6 +123,14 @@ local enabled_packages = {}
|
|||||||
-- Arguments: package name and config value (true: y, nil: m, false: unset)
|
-- Arguments: package name and config value (true: y, nil: m, false: unset)
|
||||||
-- Ensures precedence of y > m > unset
|
-- Ensures precedence of y > m > unset
|
||||||
local function config_package(pkg, v)
|
local function config_package(pkg, v)
|
||||||
|
-- HACK: Handle virtual default packages
|
||||||
|
local subst = {
|
||||||
|
nftables = 'nftables-nojson'
|
||||||
|
}
|
||||||
|
if subst[pkg] then
|
||||||
|
pkg = subst[pkg]
|
||||||
|
end
|
||||||
|
|
||||||
if v == false then
|
if v == false then
|
||||||
if not enabled_packages[pkg] then
|
if not enabled_packages[pkg] then
|
||||||
lib.try_config('PACKAGE_' .. pkg, false)
|
lib.try_config('PACKAGE_' .. pkg, false)
|
||||||
@ -146,13 +154,31 @@ local function handle_target_pkgs(pkgs)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_default_pkgs()
|
||||||
|
local targetinfo_target = string.gsub(openwrt_config_target, '_', '/')
|
||||||
|
local target_matches = false
|
||||||
|
for line in io.lines('openwrt/tmp/.targetinfo') do
|
||||||
|
local target_match = string.match(line, '^Target: (.+)$')
|
||||||
|
if target_match then
|
||||||
|
target_matches = (target_match == targetinfo_target)
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_packages_match = string.match(line, '^Default%-Packages: (.+)$')
|
||||||
|
if target_matches and default_packages_match then
|
||||||
|
return split(default_packages_match)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
io.stderr:write('Error: unable to get default packages for OpenWrt target ', targetinfo_target, '\n')
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
lib.include('generic')
|
lib.include('generic')
|
||||||
lib.include(target)
|
lib.include(target)
|
||||||
|
|
||||||
lib.check_devices()
|
lib.check_devices()
|
||||||
|
|
||||||
if #lib.devices > 0 then
|
handle_target_pkgs(concat_list(get_default_pkgs(), lib.target_packages))
|
||||||
handle_target_pkgs(lib.target_packages)
|
|
||||||
|
|
||||||
for _, dev in ipairs(lib.devices) do
|
for _, dev in ipairs(lib.devices) do
|
||||||
local device_pkgs = {}
|
local device_pkgs = {}
|
||||||
@ -180,20 +206,5 @@ if #lib.devices > 0 then
|
|||||||
table.concat(device_pkgs, ' ')
|
table.concat(device_pkgs, ' ')
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
-- x86 fallback: no devices
|
|
||||||
local target_pkgs = {}
|
|
||||||
local function handle_pkgs(pkgs)
|
|
||||||
target_pkgs = concat_list(target_pkgs, pkgs)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Just hardcode the class for device-less targets to 'standard'
|
|
||||||
-- - this is x86 only at the moment, and it will have devices
|
|
||||||
-- in OpenWrt 19.07 + 1 as well
|
|
||||||
handle_pkgs(lib.target_packages)
|
|
||||||
handle_pkgs(class_packages('standard'))
|
|
||||||
|
|
||||||
handle_target_pkgs(target_pkgs)
|
|
||||||
end
|
|
||||||
|
|
||||||
return lib
|
return lib
|
||||||
|
Loading…
Reference in New Issue
Block a user