Skip to content

Commit

Permalink
image-customization: allow negation of selections
Browse files Browse the repository at this point in the history
This allows the negation of already activated features oder packages by
Gluon using the image-customization.

Signed-off-by: David Bauer <mail@david-bauer.net>
  • Loading branch information
blocktrron committed Dec 13, 2023
1 parent f068c7b commit 06516b0
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions scripts/image_customization_lib.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
local M = {}

local function collect_keys(t)
local ret = {}
for v in pairs(t) do
table.insert(ret, v)
end
return ret
end

local function file_exists(file)
local f = io.open(file)
if not f then
Expand All @@ -33,7 +25,7 @@ local function evaluate_device(env, dev)
-- We depend on the fact both feature and package
-- are already initialized as empty tables
for _, element in ipairs(element_list) do
selections[element_type][element] = true
table.insert(selections[element_type], element)
end
end

Expand Down Expand Up @@ -124,8 +116,8 @@ function M.get_selections(env, dev)

local eval_result = evaluate_device(env, dev)
return_object = {
features = collect_keys(eval_result.selections['feature']),
packages = collect_keys(eval_result.selections['package']),
features = eval_result.selections['feature'],
packages = eval_result.selections['package'],
}

return return_object
Expand Down

0 comments on commit 06516b0

Please sign in to comment.