alexk / rpms / rpm

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