build: add class-packages for targets without devices

When adding device classes, targets without devices such as x86 were not
handled. As site and feature packages are included on such a per-device
decision, x86 images ended up without most packages.

Include a class setting for a target and include the class-packages
target-wide when this setting is configured.

Fixes 9c52365077 ("build: introduce device classes")
This commit is contained in:
David Bauer 2020-03-27 19:08:13 +01:00 committed by David Bauer
parent 17db337d95
commit c9f90c3ef8
4 changed files with 20 additions and 3 deletions

View File

@ -85,6 +85,7 @@ files["package/**/luasrc/lib/gluon/ebtables/*"] = {
files["targets/*"] = { files["targets/*"] = {
read_globals = { read_globals = {
"class",
"config", "config",
"defaults", "defaults",
"device", "device",

View File

@ -31,12 +31,21 @@ END_MAKE
]], lib.escape(image))) ]], lib.escape(image)))
end end
lib.include('generic') local function handle_target_pkgs(pkgs)
for pkg in string.gmatch(extra_packages, '%S+') do local packages = string.gmatch(pkgs, '%S+')
lib.packages {pkg} for pkg in packages do
lib.packages {pkg}
end
end end
lib.include('generic')
handle_target_pkgs(extra_packages)
lib.include(target) lib.include(target)
if lib.target_class ~= nil then
handle_target_pkgs(class_packages[lib.target_class])
end
lib.check_devices() lib.check_devices()

View File

@ -23,6 +23,7 @@ assert(env.GLUON_DEPRECATED)
M.site_code = assert(assert(dofile('scripts/site_config.lua')('site.conf')).site_code) M.site_code = assert(assert(dofile('scripts/site_config.lua')('site.conf')).site_code)
M.target_packages = {} M.target_packages = {}
M.target_class = nil
M.configs = {} M.configs = {}
M.devices = {} M.devices = {}
M.images = {} M.images = {}
@ -153,6 +154,10 @@ function F.config(...)
M.configs[string.format(...)] = 2 M.configs[string.format(...)] = 2
end end
function F.class(target_class)
M.target_class = target_class
end
function F.packages(pkgs) function F.packages(pkgs)
for _, pkg in ipairs(pkgs) do for _, pkg in ipairs(pkgs) do
table.insert(M.target_packages, pkg) table.insert(M.target_packages, pkg)

View File

@ -1,6 +1,8 @@
config 'CONFIG_VDI_IMAGES=y' config 'CONFIG_VDI_IMAGES=y'
config 'CONFIG_VMDK_IMAGES=y' config 'CONFIG_VMDK_IMAGES=y'
class 'standard'
packages { packages {
'kmod-3c59x', 'kmod-3c59x',
'kmod-8139cp', 'kmod-8139cp',