diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-08-17 12:07:48 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-11-25 08:38:01 +0200 |
commit | 46b9c91ba0739c25713de52269308f8796f99298 (patch) | |
tree | dc67a5065b624814c72379930b1be13a57d85e61 | |
parent | e7785e99004e2518e746382aa6040f557fee76fd (diff) | |
download | rpm-46b9c91ba0739c25713de52269308f8796f99298.tar.gz |
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
(cherry picked from commit d8cde273e5523364df4f4f9ae7ad3374cf02e549)
-rw-r--r-- | build/spec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/build/spec.c b/build/spec.c index ca9710761..19974ef55 100644 --- a/build/spec.c +++ b/build/spec.c @@ -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); |