rpms/apt/devel apt-0.5.15lorg3.94-extlua.patch, NONE, 1.1 apt.spec, 1.57, 1.58

Lubomir Rintel lkundrak at fedoraproject.org
Tue Dec 16 08:39:11 UTC 2008


Author: lkundrak

Update of /cvs/pkgs/rpms/apt/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5158

Modified Files:
	apt.spec 
Added Files:
	apt-0.5.15lorg3.94-extlua.patch 
Log Message:
* Mon Dec 15 2008 Lubomir Rintel <lkundrak at v3.sk> - 0.5.15lorg3.94-6
- Fix internal lua crash, link against system lua 5.1


apt-0.5.15lorg3.94-extlua.patch:

--- NEW FILE apt-0.5.15lorg3.94-extlua.patch ---
>From rpm-devel-owner at rpm5.org  Sun Jun 15 12:10:28 2008
From: Bernhard =?iso-8859-1?q?Rosenkr=E4nzer?= <bero at arklinux.org>
To: Jeff Johnson <n3npq at mac.com>
Subject: Re: rpm 5.1.2: apt-get crash with lua, and forgetting --target parameters
Date: Sun, 15 Jun 2008 12:03:30 +0200
Cc: rpm-devel at rpm5.org
References: <200806111625.26347.bero at arklinux.org> <6463CD2F-9D2B-41F5-8622-6617EDA0CD34 at mac.com> <200806141645.00922.bero at arklinux.ch>
In-Reply-To: <200806141645.00922.bero at arklinux.ch>
Message-Id: <200806151203.31292.bero at arklinux.org>

On Saturday 14 June 2008 16.44:57 Bernhard Rosenkr=E4nzer wrote:
> In the particular case of apt, there's another thing I just noticed -- both
> rpm and apt come with an internalized version of lua.
> Chances are the simple symbol clash caused by this is what causes the
> crash. Guess switching both over to using system lua (or at least making
> apt use rpm's version) is the best fix.

That did it -- if anyone is interested, here's a patch to link apt against
system lua 5.1.x, that makes it work with rpm5 if the latter is compiled with
external lua as well.

It doesn't fix genpkglist crashing though, so that must be a different
problem.

ttyl
bero

--- apt-0.5.15lorg3.94a/apt-pkg/luaiface.cc.lua~	2008-01-12 10:45:07.000000000 +0100
+++ apt-0.5.15lorg3.94a/apt-pkg/luaiface.cc	2008-06-14 21:26:46.000000000 +0200
@@ -17,12 +17,12 @@
 #ifdef APT_WITH_LUA
 
 extern "C" {
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-#include "lposix.h"
-#include "lrexlib.h"
-#include "linit.h"
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+#if LUA_VERSION_NUM < 501
+#error lua 5.1 required
+#endif
 }
 
 #include <apt-pkg/depcache.h>
@@ -52,12 +52,9 @@ extern "C" {
    } while (0)
 
 #define checkudata(ctype, target, n) \
-   do { \
-      ctype *_tmp = (ctype *) luaL_checkudata(L, n, #ctype); \
-      if (_tmp != NULL) \
-	 target = *_tmp; \
-      else \
-	 target = NULL; \
+   do { ctype *_tmp; target = NULL; \
+      if ( !lua_isnil(L, n) && (_tmp = (ctype *) luaL_checkudata(L, n, #ctype)) ) \
+	    target = *_tmp; \
    } while (0)
 
 Lua *_GetLuaObj()
@@ -78,26 +75,13 @@ Lua::Lua()
 {
    _config->CndSet("Dir::Bin::scripts", PKGDATADIR "/scripts");
 
-   const luaL_reg lualibs[] = {
-      {"base", luaopen_base},
-      {"table", luaopen_table},
-      {"io", luaopen_io},
-      {"string", luaopen_string},
-      {"math", luaopen_math},
-      {"debug", luaopen_debug},
-      {"loadlib", luaopen_loadlib},
-      {"posix", luaopen_posix},
-      {"rex", luaopen_rex},
-      {"init", luaopen_init},
-      {"apt", luaopen_apt},
-      {NULL, NULL}
-   };
    L = lua_open();
-   const luaL_reg *lib = lualibs;
-   for (; lib->name; lib++) {
-      lib->func(L);  /* open library */
-      lua_settop(L, 0);  /* discard any results */
-   }
+   luaL_openlibs(L);
+
+   lua_pushcfunction(L, luaopen_apt);
+   lua_pushstring(L, "apt");
+   lua_call(L, 1, 0);
+
    luaL_newmetatable(L, "pkgCache::Package*");
    lua_pushstring(L, "__eq");
    lua_pushcfunction(L, AptLua_pkgcomp);
@@ -198,7 +182,7 @@ bool Lua::RunScripts(const char *ConfLis
    lua_pushnil(L);
    lua_rawset(L, LUA_GLOBALSINDEX);
 
-   lua_pop(L, 1);
+   lua_settop(L, 0);
 
    return true;
 }
--- apt-0.5.15lorg3.94a/apt-pkg/Makefile.am.lua~	2008-01-12 10:45:07.000000000 +0100
+++ apt-0.5.15lorg3.94a/apt-pkg/Makefile.am	2008-06-14 21:28:25.000000000 +0200
@@ -10,10 +10,9 @@ libapt_pkg_la_LDFLAGS = -version-info 3:
 
 AM_CPPFLAGS = -DLIBDIR=\"$(libdir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
 AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" -DAPT_DOMAIN=\"$(PACKAGE)\"
-AM_CPPFLAGS += -I$(top_srcdir)/lua/include -I$(top_srcdir)/lua/local
 
 if WITH_LUA
-libapt_pkg_la_LIBADD += $(top_builddir)/lua/liblua.la
+libapt_pkg_la_LIBADD += -llua
 endif
 
 libapt_pkg_la_SOURCES = \
--- apt-0.5.15lorg3.94a/configure.ac.lua~	2008-01-12 11:11:39.000000000 +0100
+++ apt-0.5.15lorg3.94a/configure.ac	2008-06-14 21:27:50.000000000 +0200
@@ -311,7 +311,6 @@ dnl ah_GCC3DEP
 
 AC_CONFIG_FILES([
 	  Makefile
-	  lua/Makefile
 	  apt-pkg/Makefile
 	  apt-pkg/libapt-pkg.pc
 	  methods/Makefile
--- apt-0.5.15lorg3.94a/Makefile.am.lua~	2008-01-12 10:45:07.000000000 +0100
+++ apt-0.5.15lorg3.94a/Makefile.am	2008-06-14 21:28:01.000000000 +0200
@@ -1,5 +1,5 @@
 
-SUBDIRS = lua apt-pkg methods cmdline tools doc po
+SUBDIRS = apt-pkg methods cmdline tools doc po
 SUBDIRS += test
 
 ACLOCAL_AMFLAGS = -I m4 -I buildlib



Index: apt.spec
===================================================================
RCS file: /cvs/pkgs/rpms/apt/devel/apt.spec,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- apt.spec	29 Nov 2008 16:36:36 -0000	1.57
+++ apt.spec	16 Dec 2008 08:38:40 -0000	1.58
@@ -6,7 +6,7 @@
 Summary: Debian's Advanced Packaging Tool with RPM support
 Name: apt
 Version: 0.5.15lorg3.94
-Release: 5%{?dist}
+Release: 6%{?dist}
 Group: System Environment/Base
 URL: http://apt-rpm.org/
 # SourceLicense: GPLv2+ except lua/ which is MIT
@@ -40,6 +40,8 @@
 Patch3: apt-0.5.15lorg3.94-gcc43.patch
 # for rpm 4.6
 Patch4: apt-0.5.15lorg3.94-makebuild.patch
+# for lua 5.1
+Patch5: apt-0.5.15lorg3.94-extlua.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
@@ -62,6 +64,9 @@
 %endif
 # libxml2-devel, #183689
 BuildRequires: pkgconfig
+BuildRequires: lua-devel >= 5.1, lua-posix
+BuildRequires: autoconf, automake
+Requires: lua-posix
 Requires: gnupg
 Requires: bzip2
 Requires: fedora-release >= 4
@@ -127,6 +132,7 @@
 %patch2 -p1 -b .toolheader
 %patch3 -p1 -b .gcc43
 %patch4 -p1 -b .rpm46
+%patch5 -p1 -b .extlua
 
 install -pm 644 %{SOURCE19} comps2prio.xsl
 
@@ -134,6 +140,7 @@
 find contrib/ -type f | xargs chmod 0644
 
 %build
+autoreconf
 %configure --disable-dependency-tracking --disable-static
 
 make %{?_smp_mflags}
@@ -292,6 +299,9 @@
 
 
 %changelog
+* Mon Dec 15 2008 Lubomir Rintel <lkundrak at v3.sk> - 0.5.15lorg3.94-6
+- Fix internal lua crash, link against system lua 5.1
+
 * Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm at gmail.com> - 0.5.15lorg3.94-5
 - Rebuild for Python 2.6
 




More information about the fedora-extras-commits mailing list