Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ffbs
ffbs-gluon
Commits
3d9e60c7
Commit
3d9e60c7
authored
1 year ago
by
David Bauer
Browse files
Options
Downloads
Patches
Plain Diff
build: allow modification of device build-properties
Signed-off-by:
David Bauer
<
mail@david-bauer.net
>
parent
3d07353c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/image_customization_lib.lua
+55
-12
55 additions, 12 deletions
scripts/image_customization_lib.lua
scripts/target_config_lib.lua
+10
-15
10 additions, 15 deletions
scripts/target_config_lib.lua
scripts/target_lib.lua
+55
-15
55 additions, 15 deletions
scripts/target_lib.lua
with
120 additions
and
42 deletions
scripts/image_customization_lib.lua
+
55
−
12
View file @
3d9e60c7
...
...
@@ -8,10 +8,23 @@ local function collect_keys(t)
return
ret
end
local
function
evaluate_device
(
files
,
env
,
dev
)
local
function
file_exists
(
file
)
local
f
=
io.open
(
file
)
if
not
f
then
return
false
end
f
:
close
()
return
true
end
local
function
get_customization_file_name
(
env
)
return
env
.
GLUON_SITEDIR
..
'/image-customization'
end
local
function
evaluate_device
(
env
,
dev
)
local
selections
=
{}
local
funcs
=
{}
local
device_
disabled
=
false
local
device_
overrides
=
{}
local
function
add_elements
(
element_type
,
element_list
)
for
_
,
element
in
ipairs
(
element_list
)
do
...
...
@@ -23,6 +36,10 @@ local function evaluate_device(files, env, dev)
end
end
local
function
add_override
(
ovr_key
,
ovr_value
)
device_overrides
[
ovr_key
]
=
ovr_value
end
function
funcs
.
features
(
features
)
add_elements
(
'feature'
,
features
)
end
...
...
@@ -31,6 +48,21 @@ local function evaluate_device(files, env, dev)
add_elements
(
'package'
,
packages
)
end
function
funcs
.
broken
(
broken
)
assert
(
type
(
broken
)
==
'boolean'
,
'Incorrect use of broken(): has to be a boolean value'
)
add_override
(
'broken'
,
broken
)
end
function
funcs
.
disable
()
add_override
(
'disabled'
,
true
)
end
function
funcs
.
disable_factory
()
add_override
(
'disable_factory'
,
true
)
end
function
funcs
.
device
(
device_names
)
assert
(
type
(
device_names
)
==
'table'
,
...
...
@@ -66,24 +98,35 @@ local function evaluate_device(files, env, dev)
end
-- Evaluate the feature definition files
for
_
,
file
in
ipairs
(
files
)
do
local
f
,
err
=
loadfile
(
file
)
if
not
f
then
error
(
'Failed to parse feature definition: '
..
err
)
end
setfenv
(
f
,
funcs
)
f
()
local
f
,
err
=
loadfile
(
get_customization_file_name
(
env
))
if
not
f
then
error
(
'Failed to parse feature definition: '
..
err
)
end
setfenv
(
f
,
funcs
)
f
()
return
{
selections
=
selections
,
device_
disabled
=
device_
disabled
,
device_
overrides
=
device_
overrides
,
}
end
function
M
.
get_selection
(
selection_type
,
files
,
env
,
dev
)
local
eval_result
=
evaluate_device
(
files
,
env
,
dev
)
function
M
.
get_selection
(
selection_type
,
env
,
dev
)
if
not
file_exists
(
get_customization_file_name
(
env
))
then
return
{}
end
local
eval_result
=
evaluate_device
(
env
,
dev
)
return
collect_keys
(
eval_result
.
selections
[
selection_type
]
or
{})
end
function
M
.
device_overrides
(
env
,
dev
)
if
not
file_exists
(
get_customization_file_name
(
env
))
then
return
{}
end
local
eval_result
=
evaluate_device
(
env
,
dev
)
return
eval_result
.
device_overrides
end
return
M
This diff is collapsed.
Click to expand it.
scripts/target_config_lib.lua
+
10
−
15
View file @
3d9e60c7
...
...
@@ -87,24 +87,19 @@ local function feature_packages(features)
end
local
function
site_specific_packages
(
dev_info
)
local
image_custoization
=
env
.
GLUON_SITEDIR
..
'/image-customization'
local
site_packages
local
feature_inherited_pkgs
local
site_features
local
site_packages
=
{}
local
feature_inherited_pkgs
=
{}
-- First read enabled features from site
site_features
=
image_customization_lib
.
get_selection
(
'feature'
,
env
,
dev_info
)
site_features
=
compact_list
(
site_features
,
false
)
if
file_exists
(
image_custoization
)
then
local
site_features
-- Create List from packages inherited from features
feature_inherited_pkgs
=
feature_packages
(
site_features
)
-- First read enabled features from site
site_features
=
image_customization_lib
.
get_selection
(
'feature'
,
{
image_custoization
},
env
,
dev_info
)
site_features
=
compact_list
(
site_features
,
false
)
-- Create List from packages inherited from features
feature_inherited_pkgs
=
feature_packages
(
site_features
)
-- Read list of packages from site
site_packages
=
image_customization_lib
.
get_selection
(
'package'
,
{
image_custoization
},
env
,
dev_info
)
end
-- Read list of packages from site
site_packages
=
image_customization_lib
.
get_selection
(
'package'
,
env
,
dev_info
)
-- Concat feature-packages with site-packages
local
pkgs
=
concat_list
(
feature_inherited_pkgs
,
site_packages
)
...
...
This diff is collapsed.
Click to expand it.
scripts/target_lib.lua
+
55
−
15
View file @
3d9e60c7
local
image_customization_lib
=
dofile
(
'scripts/image_customization_lib.lua'
)
-- Functions for use in targets/*
local
F
=
{}
...
...
@@ -55,11 +57,37 @@ function F.istrue(v)
return
(
tonumber
(
v
)
or
0
)
>
0
end
local
function
want_device
(
dev
,
options
)
if
options
.
broken
and
not
F
.
istrue
(
env
.
BROKEN
)
then
local
function
get_device_overrides
(
device_info
)
return
image_customization_lib
.
device_overrides
(
env
,
device_info
)
end
local
function
device_broken
(
device_info
,
overrides
)
if
F
.
istrue
(
env
.
BROKEN
)
then
return
false
end
if
options
.
deprecated
and
env
.
GLUON_DEPRECATED
==
'0'
then
if
overrides
[
'broken'
]
~=
nil
then
return
overrides
[
'broken'
]
==
true
elseif
device_info
.
options
.
broken
then
return
true
end
return
false
end
local
function
want_device
(
device_info
)
local
overrides
=
get_device_overrides
(
device_info
)
-- Check if device is disabled via image-customization in site
if
overrides
[
'disabled'
]
then
return
false
end
if
device_broken
(
device_info
,
overrides
)
then
return
false
end
if
device_info
.
options
.
deprecated
and
env
.
GLUON_DEPRECATED
==
'0'
then
return
false
end
...
...
@@ -67,13 +95,10 @@ local function want_device(dev, options)
return
true
end
unknown_devices
[
dev
]
=
nil
return
gluon_devices
[
dev
]
unknown_devices
[
dev
ice_info
.
image
]
=
nil
return
gluon_devices
[
dev
ice_info
.
image
]
end
local
full_deprecated
=
env
.
GLUON_DEPRECATED
==
'full'
local
function
merge
(
a
,
b
)
local
ret
=
{}
for
k
,
v
in
pairs
(
a
)
do
...
...
@@ -210,18 +235,33 @@ local function as_table(v)
end
end
function
F
.
device
(
image
,
name
,
options
)
options
=
merge
(
default_options
,
options
)
local
function
disable_factory_image
(
device_info
)
if
device_info
.
options
.
deprecated
and
env
.
GLUON_DEPRECATED
~=
'full'
then
return
true
end
if
not
want_device
(
image
,
options
)
then
return
local
overrides
=
get_device_overrides
(
device_info
)
if
overrides
[
"disable_factory"
]
then
return
true
end
table.insert
(
M
.
devices
,
{
return
false
end
function
F
.
device
(
image
,
name
,
options
)
options
=
merge
(
default_options
,
options
)
local
device_info
=
{
image
=
image
,
name
=
name
,
options
=
options
,
})
}
if
not
want_device
(
device_info
)
then
return
end
table.insert
(
M
.
devices
,
device_info
)
if
options
.
sysupgrade
then
add_image
{
...
...
@@ -236,7 +276,7 @@ function F.device(image, name, options)
}
end
if
options
.
deprecated
and
not
full_deprecated
then
if
disable_factory_image
(
device_info
)
then
return
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment