Add rpm.undefine() function to Lua interface

Funny that this should be missing after all these years. It can
be worked around by rpm.expand("%undefine foo") but that is really
klunky...
This commit is contained in:
Panu Matilainen 2017-01-19 15:31:03 +02:00
parent dae2ec1f47
commit 6988799d0f
1 changed files with 8 additions and 0 deletions

View File

@ -683,6 +683,13 @@ static int rpm_define(lua_State *L)
return 0;
}
static int rpm_undefine(lua_State *L)
{
const char *str = luaL_checkstring(L, 1);
rpmPopMacro(NULL, str);
return 0;
}
static int rpm_load(lua_State *L)
{
const char *str = luaL_checkstring(L, 1);
@ -893,6 +900,7 @@ static const luaL_Reg rpmlib[] = {
{"b64decode", rpm_b64decode},
{"expand", rpm_expand},
{"define", rpm_define},
{"undefine", rpm_undefine},
{"load", rpm_load},
{"register", rpm_register},
{"unregister", rpm_unregister},