From c9f90c3ef8021faa72f69272eb55a44e9f05e206 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 27 Mar 2020 19:08:13 +0100 Subject: [PATCH] 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 9c52365077be ("build: introduce device classes") --- .luacheckrc | 1 + scripts/target_config_lib.lua | 15 ++++++++++++--- scripts/target_lib.lua | 5 +++++ targets/x86.inc | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 36299c6d..06bda7bc 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -85,6 +85,7 @@ files["package/**/luasrc/lib/gluon/ebtables/*"] = { files["targets/*"] = { read_globals = { + "class", "config", "defaults", "device", diff --git a/scripts/target_config_lib.lua b/scripts/target_config_lib.lua index 3f1c3585..e2abb76b 100644 --- a/scripts/target_config_lib.lua +++ b/scripts/target_config_lib.lua @@ -31,12 +31,21 @@ END_MAKE ]], lib.escape(image))) end - lib.include('generic') - for pkg in string.gmatch(extra_packages, '%S+') do - lib.packages {pkg} + local function handle_target_pkgs(pkgs) + local packages = string.gmatch(pkgs, '%S+') + for pkg in packages do + lib.packages {pkg} + end end + + lib.include('generic') + handle_target_pkgs(extra_packages) lib.include(target) + if lib.target_class ~= nil then + handle_target_pkgs(class_packages[lib.target_class]) + end + lib.check_devices() diff --git a/scripts/target_lib.lua b/scripts/target_lib.lua index 1785c3b3..b923777f 100644 --- a/scripts/target_lib.lua +++ b/scripts/target_lib.lua @@ -23,6 +23,7 @@ assert(env.GLUON_DEPRECATED) M.site_code = assert(assert(dofile('scripts/site_config.lua')('site.conf')).site_code) M.target_packages = {} +M.target_class = nil M.configs = {} M.devices = {} M.images = {} @@ -153,6 +154,10 @@ function F.config(...) M.configs[string.format(...)] = 2 end +function F.class(target_class) + M.target_class = target_class +end + function F.packages(pkgs) for _, pkg in ipairs(pkgs) do table.insert(M.target_packages, pkg) diff --git a/targets/x86.inc b/targets/x86.inc index 9536e805..461f4839 100644 --- a/targets/x86.inc +++ b/targets/x86.inc @@ -1,6 +1,8 @@ config 'CONFIG_VDI_IMAGES=y' config 'CONFIG_VMDK_IMAGES=y' +class 'standard' + packages { 'kmod-3c59x', 'kmod-8139cp',