diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2015-06-17 12:04:40 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-23 11:47:40 +0100 |
commit | a990d21aec317b637fe974d935aa80ebfbaa3645 (patch) | |
tree | b6c565e50b075b3ca327b38503e5a6354dbfb97a /meta | |
parent | db34474679587502fe0b6a0a5cd72351e29991a2 (diff) | |
download | poky-a990d21aec317b637fe974d935aa80ebfbaa3645.tar.gz |
rpm: Fix lua 'print' statement capture
The print statement should capture the output and send it to the script
processing engine, and not display it directly to the screen.
Note, this is only a bug if 'lua' support has been enabled in the RPM
recipe's PACKAGECONFIG.
This patch is from: http://rpm5.org/cvs/patchset?cn=17671
(From OE-Core rev: 6bc0e8207d0e7b1d6f2eac8ed1b75a3fd9fab87b)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/rpm-lua-fix-print.patch | 104 | ||||
-rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.14.bb | 1 |
2 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-lua-fix-print.patch b/meta/recipes-devtools/rpm/rpm/rpm-lua-fix-print.patch new file mode 100644 index 0000000000..7ab49e97e2 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/rpm-lua-fix-print.patch | |||
@@ -0,0 +1,104 @@ | |||
1 | Lua 'print' statement is not working properly inside of RPM 5 | ||
2 | |||
3 | The print statement should capture the output and send it to the script | ||
4 | processing engine, and not display it directly to the screen. | ||
5 | |||
6 | This patch is from: http://rpm5.org/cvs/patchset?cn=17671 | ||
7 | |||
8 | Upstream-Status: backport (patchset 17671 from rpm5.org) | ||
9 | |||
10 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
11 | |||
12 | Index: rpm-5.4.14/CHANGES | ||
13 | =================================================================== | ||
14 | --- rpm-5.4.14.orig/CHANGES | ||
15 | +++ rpm-5.4.14/CHANGES | ||
16 | @@ -1,3 +1,4 @@ | ||
17 | + - jbj: lua: fix: resurrect output capture with lua-5.2. | ||
18 | - jbj: verify: fix: broken logic for %ghost avoidance (Mark Hatle). | ||
19 | |||
20 | 5.4.13 -> 5.4.14: | ||
21 | Index: rpm-5.4.14/rpmio/rpmlua.c | ||
22 | =================================================================== | ||
23 | --- rpm-5.4.14.orig/rpmio/rpmlua.c | ||
24 | +++ rpm-5.4.14/rpmio/rpmlua.c | ||
25 | @@ -175,7 +175,7 @@ rpmlua rpmluaNew(void) | ||
26 | }; | ||
27 | /*@=readonlytrans =nullassign @*/ | ||
28 | /*@observer@*/ /*@unchecked@*/ | ||
29 | - const luaL_Reg *lib = lualibs; | ||
30 | + const luaL_Reg *lib; | ||
31 | char *path_buf; | ||
32 | char *path_next; | ||
33 | char *path; | ||
34 | @@ -190,31 +190,34 @@ rpmlua rpmluaNew(void) | ||
35 | |||
36 | luaL_openlibs(L); | ||
37 | |||
38 | - for (; lib->name; lib++) { | ||
39 | + for (lib = lualibs; lib->name; lib++) { | ||
40 | luaL_requiref(L, lib->name, lib->func, 1); | ||
41 | + lua_pop(L, 1); | ||
42 | } | ||
43 | |||
44 | { const char * _lua_path = rpmGetPath(rpmluaPath, NULL); | ||
45 | if (_lua_path != NULL) { | ||
46 | +#if defined(LUA_GLOBALSINDEX) | ||
47 | lua_pushliteral(L, "LUA_PATH"); | ||
48 | lua_pushstring(L, _lua_path); | ||
49 | + lua_rawset(L, LUA_GLOBALSINDEX); | ||
50 | +#else | ||
51 | + lua_pushstring(L, _lua_path); | ||
52 | + lua_setglobal(L, "LUA_PATH"); | ||
53 | +#endif | ||
54 | _lua_path = _free(_lua_path); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | #if defined(LUA_GLOBALSINDEX) | ||
59 | - lua_rawset(L, LUA_GLOBALSINDEX); | ||
60 | -#else | ||
61 | - lua_pushglobaltable(L); | ||
62 | -#endif | ||
63 | lua_pushliteral(L, "print"); | ||
64 | lua_pushcfunction(L, rpm_print); | ||
65 | - | ||
66 | -#if defined(LUA_GLOBALSINDEX) | ||
67 | lua_rawset(L, LUA_GLOBALSINDEX); | ||
68 | #else | ||
69 | - lua_pushglobaltable(L); | ||
70 | + lua_pushcfunction(L, rpm_print); | ||
71 | + lua_setglobal(L, "print"); | ||
72 | #endif | ||
73 | + | ||
74 | rpmluaSetData(lua, "lua", lua); | ||
75 | |||
76 | /* load all standard RPM Lua script files */ | ||
77 | @@ -351,6 +354,9 @@ void rpmluaSetVar(rpmlua _lua, rpmluav v | ||
78 | #if defined(LUA_GLOBALSINDEX) | ||
79 | if (lua->pushsize == 0) | ||
80 | lua_pushvalue(L, LUA_GLOBALSINDEX); | ||
81 | +#else | ||
82 | + if (lua->pushsize == 0) | ||
83 | + lua_pushglobaltable(L); | ||
84 | #endif | ||
85 | if (pushvar(L, var->keyType, &var->key) != -1) { | ||
86 | if (pushvar(L, var->valueType, &var->value) != -1) | ||
87 | @@ -1039,14 +1045,15 @@ static int rpm_print (lua_State *L) | ||
88 | lua_getglobal(L, "tostring"); | ||
89 | for (i = 1; i <= n; i++) { | ||
90 | const char *s; | ||
91 | + size_t l; | ||
92 | lua_pushvalue(L, -1); /* function to be called */ | ||
93 | lua_pushvalue(L, i); /* value to print */ | ||
94 | lua_call(L, 1, 1); | ||
95 | - s = lua_tostring(L, -1); /* get result */ | ||
96 | + s = lua_tolstring(L, -1, &l); /* get result */ | ||
97 | if (s == NULL) | ||
98 | return luaL_error(L, "`tostring' must return a string to `print'"); | ||
99 | if (lua->storeprint) { | ||
100 | - size_t sl = lua_rawlen(L, -1); | ||
101 | + size_t sl = l; | ||
102 | if ((size_t)(lua->printbufused+sl+1) > lua->printbufsize) { | ||
103 | lua->printbufsize += sl+512; | ||
104 | lua->printbuf = (char *) xrealloc(lua->printbuf, lua->printbufsize); | ||
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.14.bb b/meta/recipes-devtools/rpm/rpm_5.4.14.bb index 75b1ae22cc..eac3b8f455 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.14.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.14.bb | |||
@@ -92,6 +92,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.14-0.20131024.src.rpm;e | |||
92 | file://rpm-realpath.patch \ | 92 | file://rpm-realpath.patch \ |
93 | file://0001-using-poptParseArgvString-to-parse-the-_gpg_check_pa.patch \ | 93 | file://0001-using-poptParseArgvString-to-parse-the-_gpg_check_pa.patch \ |
94 | file://no-ldflags-in-pkgconfig.patch \ | 94 | file://no-ldflags-in-pkgconfig.patch \ |
95 | file://rpm-lua-fix-print.patch \ | ||
95 | " | 96 | " |
96 | 97 | ||
97 | # Uncomment the following line to enable platform score debugging | 98 | # Uncomment the following line to enable platform score debugging |