scripts: target_config_lib: prepend target default package list from openwrt/tmp/.targetinfo

Device-specific package additions could generate `CONFIG_PACKAGE_...=m`
lines, which would override `CONFIG_PACKAGE_...=y` lines inserted by
OpenWrt for default packages (as Gluon did not know about these default
packages). This resulted in the unintended removal of such packages from
other devices that did not contain the same package in their device
package lists.

Avoid this issue by explicitly adding OpenWrt's target default package
list to the front of Gluon's target package list.
This commit is contained in:
Matthias Schiffer 2022-08-23 22:59:55 +02:00
parent ca21952737
commit d20f8d41a0
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -154,12 +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()
handle_target_pkgs(lib.target_packages) handle_target_pkgs(concat_list(get_default_pkgs(), lib.target_packages))
for _, dev in ipairs(lib.devices) do for _, dev in ipairs(lib.devices) do
local device_pkgs = {} local device_pkgs = {}