5523e9
From 344f938670b8f7400ef177945cef5552783d450f Mon Sep 17 00:00:00 2001
5523e9
From: Lubos Kardos <lkardos@redhat.com>
5523e9
Date: Fri, 10 Apr 2015 17:28:17 +0200
5523e9
Subject: [PATCH] Fix adding of sources to lua variables during recursive
5523e9
 parsing of spec
5523e9
5523e9
- Before this fix sources and patches weren't added to lua variables
5523e9
  "sources" and "patches" if they were located in spec file after tag
5523e9
  "BuildArch". Now it works.(rhbz:#1084309)
5523e9
---
5523e9
 build/parsePreamble.c | 2 +-
5523e9
 build/spec.c          | 2 ++
5523e9
 2 files changed, 3 insertions(+), 1 deletion(-)
5523e9
5523e9
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
5523e9
index 21160cd..521068c 100644
5523e9
--- a/build/parsePreamble.c
5523e9
+++ b/build/parsePreamble.c
5523e9
@@ -308,7 +308,7 @@ static int addSource(rpmSpec spec, Package pkg, const char *field, rpmTagVal tag
5523e9
 	addMacro(spec->macros, buf, NULL, p->fullSource, RMIL_SPEC);
5523e9
 	free(buf);
5523e9
 #ifdef WITH_LUA
5523e9
-	if (!spec->recursing) {
5523e9
+	{
5523e9
 	    rpmlua lua = NULL; /* global state */
5523e9
 	    const char * what = (flag & RPMBUILD_ISPATCH) ? "patches" : "sources";
5523e9
 	    rpmluaPushTable(lua, what);
5523e9
diff --git a/build/spec.c b/build/spec.c
5523e9
index d06e2c1..1db5d15 100644
5523e9
--- a/build/spec.c
5523e9
+++ b/build/spec.c
5523e9
@@ -239,6 +239,8 @@ rpmSpec newSpec(void)
5523e9
     {
5523e9
     /* make sure patches and sources tables always exist */
5523e9
     rpmlua lua = NULL; /* global state */
5523e9
+    rpmluaDelVar(lua, "patches");
5523e9
+    rpmluaDelVar(lua, "sources");
5523e9
     rpmluaPushTable(lua, "patches");
5523e9
     rpmluaPushTable(lua, "sources");
5523e9
     rpmluaPop(lua);
5523e9
-- 
5523e9
2.9.3
5523e9