Hi Christian,
I am asking myself if it makes a lot of sense to have a hard split
between Lua handlers and generic Lua code (Lua scripts or embedded Lua
in sw-description). I have already dropped "CONFIG_LUA_HANDLERS. Frankly
speaking, it adds some hurdles without addinf benefits. There is no
changes in dependencies or footprint if CONFIG_LUA is set and
CONFIG_LUA_HANDLERS not, and it forbids to add in future a Lua handler
if the switch was not yet on, for example on the SWUpdate version
running in field.
Doing this, I am also thinking about some extension and changes on how
Lua code is evaluated. Currently, there is a global Lua context (for
handlers), and a specific Lua context for each code snippet. That is,
for a script, a Lua context is created before the script is started and
destroyed after its completion.
I am thinking about if it is not much better to have a Lua context for
install request: the context is instantiated when parser runs and
destroyed when the install (with success or failure) completes. Even if
having a Lua context for each script reduces dependencies, having a Lua
context for install request allows some more fancy stuff, like calling
from a later script a function defined previously (in embedded-script or
in a previous loaded code). It could be also extended to add runtime
hooks (we have just hooks at parsing time), and also a "failure-hook" in
case the install of a single artifact fails and some housekeeping should
be done. What do you mind ? Does it make sense in your opinion ?
Best regards,
Stefano