lua 5.2 fixes from upstream
This commit is contained in:
parent
34ff1a94bc
commit
52532da53c
117
0001-Finish-lua-5.2-support-trac-865.patch
Normal file
117
0001-Finish-lua-5.2-support-trac-865.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From 96807d2f3dcec583ca54b503e7fc70014115e308 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Dewender <rpm@JonnyJD.net>
|
||||
Date: Thu, 4 Apr 2013 17:23:43 +0200
|
||||
Subject: [PATCH] Finish lua 5.2 support, trac #865
|
||||
|
||||
Lua52 support was started with ac959fed0082cb253d45c7a04866e8654e962442.
|
||||
|
||||
Compilation tested with Lua 5.2.1 and Lua 5.1.5.
|
||||
|
||||
The short typerror() snippet is taken from luaL_typerror in Lua 5.1.5
|
||||
(MIT license)
|
||||
|
||||
Signed-off-by: Johannes Dewender <rpm@JonnyJD.net>
|
||||
---
|
||||
luaext/lposix.c | 21 +++++++++++++++------
|
||||
rpmio/rpmlua.c | 8 ++++++++
|
||||
2 files changed, 23 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/luaext/lposix.c b/luaext/lposix.c
|
||||
index f3c787e..a59be3e 100644
|
||||
--- a/luaext/lposix.c
|
||||
+++ b/luaext/lposix.c
|
||||
@@ -58,6 +58,15 @@ static const char *filetype(mode_t m)
|
||||
|
||||
typedef int (*Selector)(lua_State *L, int i, const void *data);
|
||||
|
||||
+/* implemented as luaL_typerror until lua 5.1, dropped in 5.2
|
||||
+ * (C) 1994-2012 Lua.org, PUC-Rio. MIT license
|
||||
+ */
|
||||
+static int typerror (lua_State *L, int narg, const char *tname) {
|
||||
+ const char *msg = lua_pushfstring(L, "%s expected, got %s",
|
||||
+ tname, luaL_typename(L, narg));
|
||||
+ return luaL_argerror(L, narg, msg);
|
||||
+}
|
||||
+
|
||||
static int doselection(lua_State *L, int i, const char *const S[], Selector F, const void *data)
|
||||
{
|
||||
if (lua_isnone(L, i))
|
||||
@@ -139,7 +148,7 @@ static uid_t mygetuid(lua_State *L, int i)
|
||||
return (p==NULL) ? -1 : p->pw_uid;
|
||||
}
|
||||
else
|
||||
- return luaL_typerror(L, i, "string or number");
|
||||
+ return typerror(L, i, "string or number");
|
||||
}
|
||||
|
||||
static gid_t mygetgid(lua_State *L, int i)
|
||||
@@ -154,7 +163,7 @@ static gid_t mygetgid(lua_State *L, int i)
|
||||
return (g==NULL) ? -1 : g->gr_gid;
|
||||
}
|
||||
else
|
||||
- return luaL_typerror(L, i, "string or number");
|
||||
+ return typerror(L, i, "string or number");
|
||||
}
|
||||
|
||||
|
||||
@@ -573,7 +582,7 @@ static int Pgetpasswd(lua_State *L) /** getpasswd(name or id) */
|
||||
else if (lua_isstring(L, 1))
|
||||
p = getpwnam(lua_tostring(L, 1));
|
||||
else
|
||||
- luaL_typerror(L, 1, "string or number");
|
||||
+ typerror(L, 1, "string or number");
|
||||
if (p==NULL)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
@@ -590,7 +599,7 @@ static int Pgetgroup(lua_State *L) /** getgroup(name or id) */
|
||||
else if (lua_isstring(L, 1))
|
||||
g = getgrnam(lua_tostring(L, 1));
|
||||
else
|
||||
- luaL_typerror(L, 1, "string or number");
|
||||
+ typerror(L, 1, "string or number");
|
||||
if (g==NULL)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
@@ -709,10 +718,10 @@ static int Puname(lua_State *L) /** uname([string]) */
|
||||
luaL_buffinit(L, &b);
|
||||
for (s=luaL_optstring(L, 1, "%s %n %r %v %m"); *s; s++)
|
||||
if (*s!='%')
|
||||
- luaL_putchar(&b, *s);
|
||||
+ luaL_addchar(&b, *s);
|
||||
else switch (*++s)
|
||||
{
|
||||
- case '%': luaL_putchar(&b, *s); break;
|
||||
+ case '%': luaL_addchar(&b, *s); break;
|
||||
case 'm': luaL_addstring(&b,u.machine); break;
|
||||
case 'n': luaL_addstring(&b,u.nodename); break;
|
||||
case 'r': luaL_addstring(&b,u.release); break;
|
||||
diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c
|
||||
index 86d0408..0576318 100644
|
||||
--- a/rpmio/rpmlua.c
|
||||
+++ b/rpmio/rpmlua.c
|
||||
@@ -7,14 +7,22 @@
|
||||
#include <lposix.h>
|
||||
#include <lrexlib.h>
|
||||
|
||||
+/* replaced in 5.1 */
|
||||
#ifndef lua_open
|
||||
#define lua_open() luaL_newstate()
|
||||
#endif
|
||||
|
||||
+/* defined as lua_objlen in 5.1 */
|
||||
#ifndef lua_strlen
|
||||
#define lua_strlen(L,i) lua_rawlen(L, (i))
|
||||
#endif
|
||||
|
||||
+/* deprecated in 5.1, defined as lua_objlen in 5.1 */
|
||||
+#ifndef luaL_getn
|
||||
+#define luaL_getn(L,i) ((int)lua_rawlen(L, i))
|
||||
+#endif
|
||||
+
|
||||
+/* define added in 5.2 */
|
||||
#ifndef lua_pushglobaltable
|
||||
#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
|
||||
#endif
|
||||
--
|
||||
1.8.1.3
|
||||
|
9
rpm.spec
9
rpm.spec
@ -21,7 +21,7 @@
|
||||
Summary: The RPM package management system
|
||||
Name: rpm
|
||||
Version: %{rpmver}
|
||||
Release: %{?snapver:0.%{snapver}.}2%{?dist}
|
||||
Release: %{?snapver:0.%{snapver}.}3%{?dist}
|
||||
Group: System Environment/Base
|
||||
Url: http://www.rpm.org/
|
||||
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
|
||||
@ -45,6 +45,8 @@ Patch5: rpm-4.9.90-armhfp.patch
|
||||
Patch6: rpm-4.9.0-armhfp-logic.patch
|
||||
|
||||
# Patches already in upstream
|
||||
# http://www.rpm.org/ticket/865
|
||||
Patch100: 0001-Finish-lua-5.2-support-trac-865.patch
|
||||
|
||||
# These are not yet upstream
|
||||
Patch301: rpm-4.6.0-niagara.patch
|
||||
@ -223,6 +225,8 @@ packages on a system.
|
||||
%patch3 -p1 -b .no-man-dirs
|
||||
%patch4 -p1 -b .use-gpg2
|
||||
|
||||
%patch100 -p1 -b .lua-5.2
|
||||
|
||||
%patch301 -p1 -b .niagara
|
||||
%patch302 -p1 -b .geode
|
||||
%patch304 -p1 -b .ldflags
|
||||
@ -455,6 +459,9 @@ exit 0
|
||||
%doc COPYING doc/librpm/html/*
|
||||
|
||||
%changelog
|
||||
* Fri May 10 2013 Tom Callaway <spot@fedoraproject.org> - 4.11.0.1-3
|
||||
- lua 5.2 fix from upstream
|
||||
|
||||
* Mon Mar 25 2013 Panu Matilainen <pmatilai@redhat.com> - 4.11.0.1-2
|
||||
- make rpm-build depend on virtual system-rpm-config provide
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user