diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-10-29 00:29:29 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-10-29 00:38:50 +0100 |
commit | 6eb98f5845e7977b4f9d56bb9c72ae80b3e53392 (patch) | |
tree | f3df74764085ef62d9a86e89d3bf325b6133fc19 /main | |
parent | 7a7e76737d3ce6e792a37122ae57f513bd197da1 (diff) | |
download | aports-6eb98f5845e7977b4f9d56bb9c72ae80b3e53392.tar.bz2 aports-6eb98f5845e7977b4f9d56bb9c72ae80b3e53392.tar.xz |
main/pllua: change upstream to pllua-ng and upgrade to 2.0
The original project is not compatible with PostgreSQL 11.0 and is
not maintained anymore.
Diffstat (limited to 'main')
-rw-r--r-- | main/pllua/APKBUILD | 25 | ||||
-rw-r--r-- | main/pllua/fix-on-32bit.patch | 33 | ||||
-rw-r--r-- | main/pllua/fix-postgres10.patch | 209 |
3 files changed, 13 insertions, 254 deletions
diff --git a/main/pllua/APKBUILD b/main/pllua/APKBUILD index f59fa526b1..68f0cdcc85 100644 --- a/main/pllua/APKBUILD +++ b/main/pllua/APKBUILD @@ -1,29 +1,32 @@ # Contributor: Michael Mason <ms13sp@gmail.com> +# Contributor: Jakub Jirutka <jakub@jirutka.cz> # Maintainer: Michael Mason <ms13sp@gmail.com> pkgname=pllua -pkgver=1.1.0 -pkgrel=1 +_pkgname=pllua-ng +pkgver=2.0 +_pkgver="REL_${pkgver//./_}" +pkgrel=0 pkgdesc="Procedural language for PostgreSQL using Lua" -url="https://github.com/pllua/pllua" +url="https://github.com/RhodiumToad/pllua-ng" arch="all" license="MIT" depends="postgresql" # LuaJIT does not support s390x. case "$CARCH" in s390x) _lua=lua5.3;; - *) _lua=luajit;; + *) _lua=luajit; _luajit=luajit;; esac makedepends="postgresql-dev $_lua-dev" -source="$pkgname-$pkgver.tar.gz::https://github.com/pllua/$pkgname/archive/v$pkgver.tar.gz - fix-on-32bit.patch - fix-postgres10.patch" -builddir="$srcdir/$pkgname-$pkgver" options="!check" # tests require running PostgreSQL +subpackages="$pkgname-dev" +source="https://github.com/RhodiumToad/$_pkgname/archive/$_pkgver/$_pkgname-$_pkgver.tar.gz" +builddir="$srcdir/$_pkgname-$_pkgver" build() { cd "$builddir" - make LUA_INCDIR=$(pkgconf --variable=includedir $_lua) \ + make ${_luajit:+"LUAJIT=$_luajit"} \ + LUA_INCDIR=$(pkgconf --variable=includedir $_lua) \ LUALIB=$(pkgconf --libs $_lua) \ USE_PGXS=1 } @@ -33,6 +36,4 @@ package() { make USE_PGXS=1 DESTDIR="$pkgdir" install } -sha512sums="bd882a5782d72b24aaca81f6678eefae191bbf53b7e8152f3d83b1b89e49d6a1c9a17be5edbc7673ff6b4f48426cf3b4ee5c6b8349555ed55078fb1e7cc6829d pllua-1.1.0.tar.gz -cf415243d0e99af2976f03261b80272ea7eb297711dc0a3386817d0b48f77aeb26b70741c594b7b8a089eb2b550e226bfd45e5077949be8e9fa0a36395ce3de1 fix-on-32bit.patch -2ea14f3415f3cb3ba425cb850feb38718c29e48b3c2b6cb98297e48ea5cec29f65356df4b3ee13fe3513d99d0014782d9591d8a044a667de6a8e9d3bd43ff460 fix-postgres10.patch" +sha512sums="fa933c07460d7b292b7837b0b32601a7932d6037fb87db64e84e676d6a8487491750be365727ae4da1706081a733a435f8960b5d417d9ca446d32938aaf2e1a9 pllua-ng-REL_2_0.tar.gz" diff --git a/main/pllua/fix-on-32bit.patch b/main/pllua/fix-on-32bit.patch deleted file mode 100644 index fda3f78052..0000000000 --- a/main/pllua/fix-on-32bit.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 904a53bcc696a683f4a114d05400e5315e0ae70d Mon Sep 17 00:00:00 2001 -From: eugwne <eugeney.sergeev@gmail.com> -Date: Mon, 10 Jul 2017 19:51:01 +0300 -Subject: [PATCH] 64 lua -> pg 32bit system - -Patch-Source: https://github.com/pllua/pllua/commit/904a53bcc696a683f4a114d05400e5315e0ae70d ---- - plluaapi.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/plluaapi.c b/plluaapi.c -index f47a3b9..d0a1b4d 100644 ---- a/plluaapi.c -+++ b/plluaapi.c -@@ -1095,8 +1095,18 @@ Datum luaP_todatum (lua_State *L, Oid type, int typmod, bool *isnull, int idx) { - dat = Int32GetDatum(lua_tointeger(L, idx)); - break; - case INT8OID: -+#ifdef USE_FLOAT8_BYVAL - dat = Int64GetDatum(get64lua(L, idx)); - break; -+#else -+ { -+ int64* value = (int64*)SPI_palloc(sizeof(int64)); -+ *value = get64lua(L, idx); -+ dat = PointerGetDatum(value); -+ break; -+ } -+#endif -+ - case TEXTOID: { - const char *s = lua_tostring(L, idx); - if (s == NULL) elog(ERROR, diff --git a/main/pllua/fix-postgres10.patch b/main/pllua/fix-postgres10.patch deleted file mode 100644 index c77c00f65c..0000000000 --- a/main/pllua/fix-postgres10.patch +++ /dev/null @@ -1,209 +0,0 @@ -From 3fcf91f71b8a8a6ceb46b59b132ed8d7cc81eb63 Mon Sep 17 00:00:00 2001 -From: eugwne <eugeney.sergeev@gmail.com> -Date: Mon, 2 Oct 2017 20:13:36 +0300 -Subject: [PATCH] text pgtype to oid - -Patch-Source: https://github.com/pllua/pllua/commit/3fcf91f71b8a8a6ceb46b59b132ed8d7cc81eb63 - -diff --git a/expected/error_info.out b/expected/error_info.out -index f29edb0..32be0fa 100644 ---- a/expected/error_info.out -+++ b/expected/error_info.out -@@ -117,3 +117,10 @@ CONTEXT: - stack traceback(trusted): - [C]: in function 'error' - [string "anonymous"]:2: in main chunk -+do $$ -+local status, err = subtransaction(function() local _ = fromstring('no_type_text','qwerty') end) -+if (err) then -+ print(err) -+end -+$$ language pllua -+INFO: type "no_type_text" does not exist -diff --git a/expected/pgfunctest.out b/expected/pgfunctest.out -index 81a225e..fc058c4 100644 ---- a/expected/pgfunctest.out -+++ b/expected/pgfunctest.out -@@ -52,14 +52,12 @@ begin - raise exception '%', $1; - end - $$ language plpgsql; -+\set VERBOSITY 'terse' - do $$ - pgfunc('pg_temp.throw_error(text)',{only_internal=false})("exception test") - $$ language pllua; - ERROR: exception test --CONTEXT: --stack traceback(trusted): -- [C]: ? -- [string "anonymous"]:2: in main chunk -+\set VERBOSITY 'default' - do $$ - local f = pgfunc('pg_temp.throw_error(text)',{only_internal=false}) - print(pcall(f, "exception test")) -diff --git a/pllua.c b/pllua.c -index 4ef2f3b..2139eb3 100644 ---- a/pllua.c -+++ b/pllua.c -@@ -150,7 +150,7 @@ void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) { - } - #endif - --int pg_to_regtype(char *typ_name) -+Oid pg_to_regtype(const char *typ_name) - { - - Oid result; -@@ -161,14 +161,17 @@ int pg_to_regtype(char *typ_name) - */ - - #if PG_VERSION_NUM < 90400 -- parseTypeString(typ_name, &result, &typmod); -+ PG_TRY(); -+ { -+ parseTypeString(typ_name, &result, &typmod); -+ } -+ PG_CATCH(); -+ { -+ result = InvalidOid; -+ } -+ PG_END_TRY(); - #else -- parseTypeString(typ_name, &result, &typmod, true); -+ parseTypeString(typ_name, &result, &typmod, true); - #endif -- -- -- if (OidIsValid(result)) -- return result; -- else -- return -1; -+ return result; - } -diff --git a/pllua.h b/pllua.h -index 0a9fe99..d8d5df6 100644 ---- a/pllua.h -+++ b/pllua.h -@@ -40,7 +40,6 @@ void luaP_pushtuple_trg (lua_State *L, TupleDesc desc, HeapTuple tuple, - HeapTuple luaP_totuple (lua_State *L); - HeapTuple luaP_casttuple (lua_State *L, TupleDesc tupdesc); - /* SPI */ --Oid luaP_gettypeoid (const char *type_name); - void luaP_pushdesctable(lua_State *L, TupleDesc desc); - void luaP_registerspi(lua_State *L); - void luaP_pushcursor (lua_State *L, Portal cursor); -diff --git a/plluaapi.c b/plluaapi.c -index d0a1b4d..adbe9e4 100644 ---- a/plluaapi.c -+++ b/plluaapi.c -@@ -452,16 +452,22 @@ static int luaP_warning (lua_State *L) { - #undef PLLUA_REPORT - - static int luaP_fromstring (lua_State *L) { -- int oid = luaP_gettypeoid(luaL_checkstring(L, 1)); -- const char *s = luaL_checkstring(L, 2); -- luaP_Typeinfo *ti = luaP_gettypeinfo(L, oid); -- int inoid = oid; -- Datum v; -- /* from getTypeIOParam in lsyscache.c */ -- if (ti->type == TYPTYPE_BASE && OidIsValid(ti->elem)) inoid = ti->elem; -- v = InputFunctionCall(&ti->input, (char *) s, inoid, 0); /* typmod = 0 */ -- luaP_pushdatum(L, v, oid); -- return 1; -+ const char *type_name = luaL_checkstring(L, 1); -+ Oid oid = pg_to_regtype(type_name); -+ if (oid == InvalidOid) { -+ return luaL_error(L,"type \"%s\" does not exist",type_name); -+ } else { -+ const char *s = luaL_checkstring(L, 2); -+ luaP_Typeinfo *ti = luaP_gettypeinfo(L, oid); -+ Oid inoid = oid; -+ Datum v; -+ -+ /* from getTypeIOParam in lsyscache.c */ -+ if (ti->type == TYPTYPE_BASE && OidIsValid(ti->elem)) inoid = ti->elem; -+ v = InputFunctionCall(&ti->input, (char *) s, inoid, 0); /* typmod = 0 */ -+ luaP_pushdatum(L, v, oid); -+ } -+ return 1; - } - - #ifdef PLLUA_DEBUG -diff --git a/plluacommon.h b/plluacommon.h -index dc7a5fa..c2f9852 100644 ---- a/plluacommon.h -+++ b/plluacommon.h -@@ -93,6 +93,6 @@ int pllua_getmaster_index(lua_State *L); - ___m = MemoryContextSwitchTo(___mcxt) - - #define MTOPG MemoryContextSwitchTo(___m);} --int pg_to_regtype(char *typ_name); -+Oid pg_to_regtype(const char *typ_name); - - #endif // PLLUACOMMON_H -diff --git a/plluaspi.c b/plluaspi.c -index c50d107..f87280f 100644 ---- a/plluaspi.c -+++ b/plluaspi.c -@@ -958,21 +958,6 @@ static int luaP_rowsplan (lua_State *L) { - - - /* ======= SPI ======= */ -- --Oid luaP_gettypeoid (const char *type_name) { --#if PG_VERSION_NUM < 80300 -- List *namelist = stringToQualifiedNameList(type_name, NULL); -- HeapTuple typetup = typenameType(NULL, makeTypeNameFromNameList(namelist)); --#else -- List *namelist = stringToQualifiedNameList(type_name); -- HeapTuple typetup = typenameType(NULL, makeTypeNameFromNameList(namelist), NULL); --#endif -- Oid typeoid = HeapTupleGetOid(typetup); -- ReleaseSysCache(typetup); -- list_free(namelist); -- return typeoid; --} -- - static int luaP_prepare (lua_State *L) { - int nargs, cursoropt; - const char *q = luaL_checkstring(L, 1); -@@ -995,7 +980,7 @@ static int luaP_prepare (lua_State *L) { - int k = lua_tointeger(L, -2); - if (k > 0) { - const char *s = luaL_checkstring(L, -1); -- Oid type = luaP_gettypeoid(s); -+ Oid type = pg_to_regtype(s); - if (type == InvalidOid) - return luaL_error(L, "invalid type to plan: %s", s); - p->type[k - 1] = type; -diff --git a/sql/error_info.sql b/sql/error_info.sql -index 3a8ed85..aef7e7c 100644 ---- a/sql/error_info.sql -+++ b/sql/error_info.sql -@@ -71,3 +71,10 @@ do $$ - error() - $$language pllua; - -+do $$ -+local status, err = subtransaction(function() local _ = fromstring('no_type_text','qwerty') end) -+if (err) then -+ print(err) -+end -+$$ language pllua -+ -diff --git a/sql/pgfunctest.sql b/sql/pgfunctest.sql -index 40c5350..65eaf33 100644 ---- a/sql/pgfunctest.sql -+++ b/sql/pgfunctest.sql -@@ -47,9 +47,11 @@ raise exception '%', $1; - end - $$ language plpgsql; - -+\set VERBOSITY 'terse' - do $$ - pgfunc('pg_temp.throw_error(text)',{only_internal=false})("exception test") - $$ language pllua; -+\set VERBOSITY 'default' - - do $$ - local f = pgfunc('pg_temp.throw_error(text)',{only_internal=false}) |