build: target_lib: allow to specify multiple factory_ext values

By passing a table instead of a single string, multiple different
extensions can be specified, each refering to a separate image file
generated by OpenWrt.

This is not supported for sysupgrade (as there can only be a single
image in the format expected by OpenWrt).
This commit is contained in:
Matthias Schiffer 2020-05-31 01:16:57 +02:00
parent 8c386719eb
commit 7279c4017e
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -202,6 +202,14 @@ function F.packages(pkgs)
end
M.packages = F.packages
local function as_table(v)
if type(v) == 'table' then
return v
else
return {v}
end
end
function F.device(image, name, options)
options = merge(default_options, options)
@ -233,15 +241,17 @@ function F.device(image, name, options)
end
if options.factory then
add_image {
image = image,
name = name,
subdir = 'factory',
in_suffix = options.factory,
out_suffix = '',
extension = options.factory_ext,
aliases = options.aliases,
}
for _, ext in ipairs(as_table(options.factory_ext)) do
add_image {
image = image,
name = name,
subdir = 'factory',
in_suffix = options.factory,
out_suffix = '',
extension = ext,
aliases = options.aliases,
}
end
end
for _, extra_image in ipairs(options.extra_images) do
add_image {