From 763307181d47f153f519f862a5d99b81e876403d Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Fri, 16 May 2014 21:04:21 +0400 Subject: [PATCH] Apply apt-0.5.15lorg2-alt-lua51.patch Added in commit cbb5c92: 0.5.15cnc5-alt2 - Added one more %triggerun to correct apt.conf, due to apt methods migration. - Applied patch from Alexey Tourbin to use systemwide lua5. - Applied patch from Sviatoslav Sviridov to workaround VendorList bug. --- apt-0.5.15lorg2-alt-lua51.patch | 112 -------------------------------- apt/Makefile.am | 2 +- apt/apt-pkg/Makefile.am | 4 +- apt/apt-pkg/luaiface.cc | 48 +++++--------- apt/configure.in | 1 - 5 files changed, 18 insertions(+), 149 deletions(-) delete mode 100644 apt-0.5.15lorg2-alt-lua51.patch diff --git a/apt-0.5.15lorg2-alt-lua51.patch b/apt-0.5.15lorg2-alt-lua51.patch deleted file mode 100644 index f4fc381..0000000 --- a/apt-0.5.15lorg2-alt-lua51.patch +++ /dev/null @@ -1,112 +0,0 @@ ---- apt-0.5.15lorg2/apt-pkg/Makefile.am- 2006-01-17 02:10:47 +0300 -+++ apt-0.5.15lorg2/apt-pkg/Makefile.am 2006-05-16 15:51:12 +0400 -@@ -6,10 +6,8 @@ libapt_pkg_la_LDFLAGS = -version-info 2: - - AM_CPPFLAGS = -DLIBDIR=\"$(libdir)\" - --INCLUDES = -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.15lorg2/apt-pkg/luaiface.cc- 2006-01-17 02:14:40 +0300 -+++ apt-0.5.15lorg2/apt-pkg/luaiface.cc 2006-05-16 17:45:03 +0400 -@@ -17,12 +17,12 @@ - #ifdef WITH_LUA - - extern "C" { --#include "lua.h" --#include "lualib.h" --#include "lauxlib.h" --#include "lposix.h" --#include "lrexlib.h" --#include "linit.h" -+#include -+#include -+#include -+#if LUA_VERSION_NUM < 501 -+#error lua 5.1 required -+#endif - } - - #include -@@ -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", "/usr/share/apt/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.15lorg2/Makefile.am- 2006-05-16 15:51:12 +0400 -+++ apt-0.5.15lorg2/Makefile.am 2006-05-16 15:51:12 +0400 -@@ -1,5 +1,5 @@ - --SUBDIRS = buildlib lua apt-pkg methods cmdline tools doc m4 po -+SUBDIRS = buildlib apt-pkg methods cmdline tools doc m4 po - - ACLOCAL_AMFLAGS = -I m4 -I buildlib - ---- apt-0.5.15lorg2/configure.in- 2006-05-16 15:51:12 +0400 -+++ apt-0.5.15lorg2/configure.in 2006-05-16 15:51:12 +0400 -@@ -252,7 +252,6 @@ AC_OUTPUT([ - Makefile - buildlib/Makefile - intl/Makefile -- lua/Makefile - apt-pkg/Makefile - methods/Makefile - cmdline/Makefile diff --git a/apt/Makefile.am b/apt/Makefile.am index 6173a15..d410113 100644 --- a/apt/Makefile.am +++ b/apt/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = buildlib lua apt-pkg methods cmdline tools doc m4 po +SUBDIRS = buildlib apt-pkg methods cmdline tools doc m4 po ACLOCAL_AMFLAGS = -I m4 -I buildlib diff --git a/apt/apt-pkg/Makefile.am b/apt/apt-pkg/Makefile.am index b307eb6..ed340b9 100644 --- a/apt/apt-pkg/Makefile.am +++ b/apt/apt-pkg/Makefile.am @@ -6,10 +6,8 @@ libapt_pkg_la_LDFLAGS = -version-info 4:0:1 -release @GLIBC_VER@-@LIBSTDCPP_VER@ AM_CPPFLAGS = -DLIBDIR=\"$(libdir)\" -INCLUDES = -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 = \ diff --git a/apt/apt-pkg/luaiface.cc b/apt/apt-pkg/luaiface.cc index a58efb1..9dc7f1b 100644 --- a/apt/apt-pkg/luaiface.cc +++ b/apt/apt-pkg/luaiface.cc @@ -17,12 +17,12 @@ #ifdef WITH_LUA extern "C" { -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -#include "lposix.h" -#include "lrexlib.h" -#include "linit.h" +#include +#include +#include +#if LUA_VERSION_NUM < 501 +#error lua 5.1 required +#endif } #include @@ -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", "/usr/share/apt/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 *ConfListKey, bool CacheChunks) lua_pushnil(L); lua_rawset(L, LUA_GLOBALSINDEX); - lua_pop(L, 1); + lua_settop(L, 0); return true; } diff --git a/apt/configure.in b/apt/configure.in index 1db8880..4dddecb 100644 --- a/apt/configure.in +++ b/apt/configure.in @@ -252,7 +252,6 @@ AC_OUTPUT([ Makefile buildlib/Makefile intl/Makefile - lua/Makefile apt-pkg/Makefile methods/Makefile cmdline/Makefile