malmond / rpms / rpm

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