[apt/f20] fix lua 5.2 patch, thanks to KOBAYASHI Taizo
Tom Callaway
spot at fedoraproject.org
Tue May 20 16:28:32 UTC 2014
commit 050f72d48cf635ea6e98f7a2029d3041735d875f
Author: Tom Callaway <spot at fedoraproject.org>
Date: Tue May 20 12:28:28 2014 -0400
fix lua 5.2 patch, thanks to KOBAYASHI Taizo
apt-0.5.15lorg3.95-lua-5.2.patch | 253 +++++++++++++-------------------------
apt.spec | 5 +-
2 files changed, 90 insertions(+), 168 deletions(-)
---
diff --git a/apt-0.5.15lorg3.95-lua-5.2.patch b/apt-0.5.15lorg3.95-lua-5.2.patch
index 20e032e..da34155 100644
--- a/apt-0.5.15lorg3.95-lua-5.2.patch
+++ b/apt-0.5.15lorg3.95-lua-5.2.patch
@@ -1,7 +1,6 @@
-diff -up apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc
---- apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 2013-05-10 10:34:53.794097260 -0400
-+++ apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc 2013-05-10 10:56:59.914049857 -0400
-@@ -41,6 +41,18 @@ extern "C" {
+--- apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc 2014-05-19 14:21:01.000000000 +0900
+@@ -41,6 +41,18 @@
using namespace std;
@@ -20,7 +19,7 @@ diff -up apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 apt-0.5.15lorg3.95
#define pushudata(ctype, value) \
do { \
ctype *_tmp = (ctype *) lua_newuserdata(L, sizeof(ctype)); \
-@@ -107,14 +119,14 @@ Lua::Lua()
+@@ -107,14 +119,14 @@
lua_settop(L, 0); /* discard any results */
}
#else
@@ -37,303 +36,225 @@ diff -up apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 apt-0.5.15lorg3.95
for (; lib->name; lib++) {
lua_pushcfunction(L, lib->func);
lua_pushstring(L, lib->name);
-@@ -175,13 +187,21 @@ bool Lua::RunScripts(const char *ConfLis
+@@ -174,14 +186,14 @@
+ continue;
if (Value == "interactive") {
lua_pushstring(L, "script_slot");
- lua_pushstring(L, ConfListKey);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_pushstring(L, ConfListKey);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, ConfListKey);
RunInteractive(ConfListKey);
lua_pushstring(L, "script_slot");
lua_pushnil(L);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "script_slot");
++
continue;
}
if (Value[0] == '.' || Value[0] == '/') {
-@@ -214,14 +234,21 @@ bool Lua::RunScripts(const char *ConfLis
+@@ -213,15 +225,13 @@
+ }
lua_pushstring(L, "script_slot");
- lua_pushstring(L, ConfListKey);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_pushstring(L, ConfListKey);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, ConfListKey);
InternalRunScript();
lua_pushstring(L, "script_slot");
lua_pushnil(L);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
+- lua_rawset(L, LUA_GLOBALSINDEX);
-
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_setglobal(L, "script_slot");
lua_pop(L, 1);
return true;
-@@ -359,7 +386,11 @@ void Lua::SetGlobal(const char *Name)
+@@ -359,7 +369,7 @@
{
lua_pushstring(L, Name);
lua_pushnil(L);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -368,7 +399,11 @@ void Lua::SetGlobal(const char *Name, co
+@@ -368,7 +378,7 @@
if (Value != NULL) {
lua_pushstring(L, Name);
lua_pushstring(L, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
}
Globals.push_back(Name);
}
-@@ -378,7 +413,11 @@ void Lua::SetGlobal(const char *Name, pk
+@@ -378,7 +388,7 @@
if (Value != NULL) {
lua_pushstring(L, Name);
pushudata(pkgCache::Package*, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
}
Globals.push_back(Name);
}
-@@ -393,7 +432,11 @@ void Lua::SetGlobal(const char *Name, co
+@@ -393,7 +403,7 @@
lua_pushstring(L, Value[i]);
lua_rawseti(L, -2, i+1);
}
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -408,7 +451,11 @@ void Lua::SetGlobal(const char *Name, ve
+@@ -408,7 +418,7 @@
lua_pushstring(L, Value[i]);
lua_rawseti(L, -2, i+1);
}
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -423,7 +470,11 @@ void Lua::SetGlobal(const char *Name, ve
+@@ -423,7 +433,7 @@
lua_pushstring(L, Value[i].c_str());
lua_rawseti(L, -2, i+1);
}
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -438,7 +489,11 @@ void Lua::SetGlobal(const char *Name, ve
+@@ -438,7 +448,7 @@
pushudata(pkgCache::Package*, Value[i]);
lua_rawseti(L, -2, i+1);
}
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -446,7 +501,11 @@ void Lua::SetGlobal(const char *Name, bo
+@@ -446,7 +456,7 @@
{
lua_pushstring(L, Name);
lua_pushboolean(L, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -454,7 +513,11 @@ void Lua::SetGlobal(const char *Name, do
+@@ -454,7 +464,7 @@
{
lua_pushstring(L, Name);
lua_pushnumber(L, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -463,7 +526,11 @@ void Lua::SetGlobal(const char *Name, vo
+@@ -463,7 +473,7 @@
if (Value != NULL) {
lua_pushstring(L, Name);
lua_pushlightuserdata(L, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
}
Globals.push_back(Name);
}
-@@ -472,7 +539,11 @@ void Lua::SetGlobal(const char *Name, lu
+@@ -472,7 +482,7 @@
{
lua_pushstring(L, Name);
lua_pushcfunction(L, Value);
-+#ifdef LUA_GLOBALSINDEX
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
Globals.push_back(Name);
}
-@@ -483,7 +554,11 @@ void Lua::ResetGlobals()
+@@ -483,7 +493,7 @@
I != Globals.end(); I++) {
lua_pushstring(L, I->c_str());
lua_pushnil(L);
- lua_rawset(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_setglobal(L, I->c_str());
}
Globals.clear();
}
-@@ -492,7 +567,11 @@ void Lua::ResetGlobals()
+@@ -492,7 +502,7 @@
const char *Lua::GetGlobalStr(const char *Name)
{
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
const char *Ret = NULL;
if (lua_isstring(L, -1))
Ret = lua_tostring(L, -1);
-@@ -504,7 +583,11 @@ vector<string> Lua::GetGlobalStrList(con
+@@ -504,7 +514,7 @@
{
vector<string> Ret;
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
int t = lua_gettop(L);
if (lua_istable(L, t)) {
lua_pushnil(L);
-@@ -520,8 +603,13 @@ vector<string> Lua::GetGlobalStrList(con
+@@ -520,8 +530,9 @@
double Lua::GetGlobalNum(const char *Name)
{
+
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
double Ret = 0;
if (lua_isnumber(L, -1))
Ret = lua_tonumber(L, -1);
-@@ -532,7 +620,11 @@ double Lua::GetGlobalNum(const char *Nam
+@@ -532,7 +543,7 @@
bool Lua::GetGlobalBool(const char *Name)
{
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
bool Ret = lua_toboolean(L, -1);
lua_remove(L, -1);
return Ret;
-@@ -541,7 +633,11 @@ bool Lua::GetGlobalBool(const char *Name
+@@ -541,7 +552,7 @@
void *Lua::GetGlobalPtr(const char *Name)
{
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
void *Ret = NULL;
if (lua_isuserdata(L, -1))
Ret = lua_touserdata(L, -1);
-@@ -552,7 +648,11 @@ void *Lua::GetGlobalPtr(const char *Name
+@@ -552,7 +563,7 @@
pkgCache::Package *Lua::GetGlobalPkg(const char *Name)
{
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
pkgCache::Package *Ret;
checkudata(pkgCache::Package*, Ret, -1);
lua_remove(L, -1);
-@@ -563,7 +663,11 @@ vector<pkgCache::Package*> Lua::GetGloba
+@@ -563,7 +574,7 @@
{
vector<pkgCache::Package*> Ret;
lua_pushstring(L, Name);
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, Name);
int t = lua_gettop(L);
if (lua_istable(L, t)) {
lua_pushnil(L);
-@@ -1467,7 +1571,11 @@ static int AptLua_gettext(lua_State *L)
+@@ -1467,7 +1478,7 @@
const char *str = luaL_checkstring(L, 1);
if (str != NULL) {
lua_pushliteral(L, "TEXTDOMAIN");
- lua_rawget(L, LUA_GLOBALSINDEX);
-+#ifdef LUA_GLOBALSINDEX
-+ lua_rawset(L, LUA_GLOBALSINDEX);
-+#else
-+ lua_settable(L, -3);
-+#endif
++ lua_getglobal(L, "TEXTDOMAIN");
if (lua_isstring(L, -1))
lua_pushstring(L, dgettext(lua_tostring(L, -1), str));
else
-@@ -1478,7 +1586,7 @@ static int AptLua_gettext(lua_State *L)
+@@ -1478,7 +1489,7 @@
return 0;
}
@@ -342,7 +263,7 @@ diff -up apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 apt-0.5.15lorg3.95
{"confget", AptLua_confget},
{"confgetlist", AptLua_confgetlist},
{"confset", AptLua_confset},
-@@ -1552,7 +1660,7 @@ static int AptLua_pkgcomp(lua_State *L)
+@@ -1552,7 +1563,7 @@
static int luaopen_apt(lua_State *L)
{
@@ -351,10 +272,9 @@ diff -up apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 apt-0.5.15lorg3.95
luaL_openlib(L, NULL, aptlib, 0);
return 0;
}
-diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git522/luaext/lposix.c
---- apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 2013-05-10 10:40:39.678084896 -0400
-+++ apt-0.5.15lorg3.95.git522/luaext/lposix.c 2013-05-10 11:01:24.318040405 -0400
-@@ -49,6 +49,15 @@ static const char *filetype(mode_t m)
+--- apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/luaext/lposix.c 2014-05-16 15:53:51.000000000 +0900
+@@ -49,6 +49,15 @@
typedef int (*Selector)(lua_State *L, int i, const void *data);
@@ -370,7 +290,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
static int doselection(lua_State *L, int i, const char *const S[], Selector F, const void *data)
{
if (lua_isnone(L, i))
-@@ -135,7 +144,7 @@ static uid_t mygetuid(lua_State *L, int
+@@ -135,7 +144,7 @@
return (p==NULL) ? -1 : p->pw_uid;
}
else
@@ -379,7 +299,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
}
static gid_t mygetgid(lua_State *L, int i)
-@@ -150,7 +159,7 @@ static gid_t mygetgid(lua_State *L, int
+@@ -150,7 +159,7 @@
return (g==NULL) ? -1 : g->gr_gid;
}
else
@@ -388,7 +308,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
}
-@@ -554,7 +563,7 @@ static int Pgetpasswd(lua_State *L) /**
+@@ -554,7 +563,7 @@
else if (lua_isstring(L, 1))
p = getpwnam(lua_tostring(L, 1));
else
@@ -397,7 +317,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
if (p==NULL)
lua_pushnil(L);
else
-@@ -571,7 +580,7 @@ static int Pgetgroup(lua_State *L) /**
+@@ -571,7 +580,7 @@
else if (lua_isstring(L, 1))
g = getgrnam(lua_tostring(L, 1));
else
@@ -406,7 +326,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
if (g==NULL)
lua_pushnil(L);
else
-@@ -690,10 +699,10 @@ static int Puname(lua_State *L) /** un
+@@ -690,10 +699,10 @@
luaL_buffinit(L, &b);
for (s=luaL_optstring(L, 1, "%s %n %r %v %m"); *s; s++)
if (*s!='%')
@@ -419,7 +339,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
case 'm': luaL_addstring(&b,u.machine); break;
case 'n': luaL_addstring(&b,u.nodename); break;
case 'r': luaL_addstring(&b,u.release); break;
-@@ -792,7 +801,7 @@ static int Pmkstemp(lua_State *L)
+@@ -792,7 +801,7 @@
}
@@ -428,10 +348,9 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 apt-0.5.15lorg3.95.git
{
{"access", Paccess},
{"chdir", Pchdir},
-diff -up apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 apt-0.5.15lorg3.95.git522/luaext/lrexlib.c
---- apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 2013-05-10 10:40:07.837086034 -0400
-+++ apt-0.5.15lorg3.95.git522/luaext/lrexlib.c 2013-05-10 10:40:24.532085437 -0400
-@@ -161,7 +161,7 @@ static int posix_gc (lua_State *L) {
+--- apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/luaext/lrexlib.c 2014-05-16 15:53:51.000000000 +0900
+@@ -161,7 +161,7 @@
return 0;
}
@@ -440,7 +359,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 apt-0.5.15lorg3.95.gi
{"match", posix_match},
{"gmatch", posix_gmatch},
{"__gc", posix_gc},
-@@ -285,7 +285,7 @@ static int pcre_gc (lua_State *L)
+@@ -285,7 +285,7 @@
return 0;
}
@@ -449,7 +368,7 @@ diff -up apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 apt-0.5.15lorg3.95.gi
{"match", pcre_match},
{"gmatch", pcre_gmatch},
{"__gc", pcre_gc},
-@@ -297,7 +297,7 @@ static const luaL_reg pcremeta[] = {
+@@ -297,7 +297,7 @@
/* Open the library */
diff --git a/apt.spec b/apt.spec
index 910042b..29b25cc 100644
--- a/apt.spec
+++ b/apt.spec
@@ -10,7 +10,7 @@
Summary: Debian's Advanced Packaging Tool with RPM support
Name: apt
Version: %{aptver}
-Release: 9.%{snapver}.1%{?dist}
+Release: 10.%{snapver}.1%{?dist}
Group: System Environment/Base
URL: http://apt-rpm.org/
# SourceLicense: GPLv2+ except lua/ which is MIT
@@ -361,6 +361,9 @@ fi
%changelog
+* Tue May 20 2014 Tom Callaway <spot at fedoraproject.org> - 0.5.14lorg3.95-10.git522.1
+- updated lua fix
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5.15lorg3.95-9.git522.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
More information about the scm-commits
mailing list