Avoid adding Lua sources and patches twice when recursing (ticket #82)

- parseSpec() operates on newly created empty spec structures even when
  "recursing" but the lua variables are global and need recursion
  protection to avoid adding multiple times
This commit is contained in:
Panu Matilainen 2009-08-17 12:07:48 +03:00
parent 3fc58248d2
commit d8cde273e5
1 changed files with 10 additions and 10 deletions

View File

@ -346,16 +346,16 @@ int addSource(rpmSpec spec, Package pkg, const char *field, rpmTag tag)
addMacro(spec->macros, buf, NULL, p->fullSource, RMIL_SPEC);
free(buf);
#ifdef WITH_LUA
{
rpmlua lua = NULL; /* global state */
const char * what = (flag & RPMBUILD_ISPATCH) ? "patches" : "sources";
rpmluaPushTable(lua, what);
rpmluav var = rpmluavNew();
rpmluavSetListMode(var, 1);
rpmluavSetValue(var, RPMLUAV_STRING, body);
rpmluaSetVar(lua, var);
var = rpmluavFree(var);
rpmluaPop(lua);
if (!spec->recursing) {
rpmlua lua = NULL; /* global state */
const char * what = (flag & RPMBUILD_ISPATCH) ? "patches" : "sources";
rpmluaPushTable(lua, what);
rpmluav var = rpmluavNew();
rpmluavSetListMode(var, 1);
rpmluavSetValue(var, RPMLUAV_STRING, body);
rpmluaSetVar(lua, var);
var = rpmluavFree(var);
rpmluaPop(lua);
}
#endif
body = _free(body);