Hi Ayoub,
On 03.07.24 08:57, '
ayoub...@googlemail.com' via swupdate wrote:
> I saw there were a bunch of LUA Changes recently from the 2024.05 to
> 2024.05.2 probably one of them introduced a regression.
>
I see - it seems the bootenv functions are not registered anymore.
I wrote a simple patch to fix this, I think we can simply add the
bootenv to the list of functions provided by the library. Anyway, added
Christian in CC, in last time we have both made several changes to the
Lua interface, and it is better to take a look together.
Can you at least test this on your side ?
From c6126e1d7e84946bb9f19eafa7a8236dcff36160 Mon Sep 17 00:00:00 2001
From: Stefano Babic <
stefan...@swupdate.org>
Date: Wed, 3 Jul 2024 10:37:35 +0200
Subject: [PATCH] BUG: bootenv functions not available
commit f8153 introduced a regression bug. The bootenv functions are not
registered anymore and they cannot be called from scripts. They were
handled separately, but after switching to a Lua Session State, there is
no need for this and the function can be added together with the rest of
the interface.
Signed-off-by: Stefano Babic <
stefan...@swupdate.org>
---
corelib/lua_interface.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 74590ab6..86c2112d 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -1195,10 +1195,6 @@ static const luaL_Reg l_swupdate[] = {
{ "getversion", lua_get_swupdate_version },
{ "progress", lua_notify_progress },
{ "emmcbootpart", l_get_emmc_bootpart },
- { NULL, NULL }
-};
-
-static const luaL_Reg l_swupdate_bootenv[] = {
{ "get_bootenv", l_get_bootenv },
{ "set_bootenv", l_set_bootenv },
{ "get_selection", l_get_selection },
@@ -1319,7 +1315,6 @@ static int l_handler_wrapper(struct img_type *img,
void *data,
}
struct dict **udbootenv = lua_newuserdata(L, sizeof(struct dict*));
*udbootenv = img->bootloader;
- luaL_setfuncs(L, l_swupdate_bootenv, 1);
lua_pop(L, 1);
}
@@ -1549,7 +1544,6 @@ lua_State *lua_session_init(struct dict *bootenv)
luaL_requiref(L, "swupdate", luaopen_swupdate, 1 );
struct dict **udbootenv = lua_newuserdata(L, sizeof(struct dict*));
*udbootenv = bootenv;
- luaL_setfuncs(L, l_swupdate_bootenv, 1);
lua_pop(L, 1); /* remove unused copy left on stack */
lua_handlers_init(L);
--
2.34.1
Best regards,
Stefano
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
swupdate+u...@googlegroups.com
> <mailto:
swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/swupdate/fb8ab8cb-bff3-4d6b-a4bb-f26896699f93n%40googlegroups.com <
https://groups.google.com/d/msgid/swupdate/fb8ab8cb-bff3-4d6b-a4bb-f26896699f93n%40googlegroups.com?utm_medium=email&utm_source=footer>.