summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO32
-rw-r--r--PKGBUILD35
-rw-r--r--pgmoon-lua53-compat.patch361
3 files changed, 31 insertions, 397 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 580914a54990..e21b8d61faec 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,37 +1,39 @@
pkgbase = lua-pgmoon
- pkgver = 1.11.0
- pkgrel = 2
+ pkgver = 1.12.0
+ pkgrel = 1
url = https://github.com/leafo/pgmoon
arch = any
license = MIT
- source = lua-pgmoon-1.11.0.tar.gz::https://github.com/leafo/pgmoon/archive/v1.11.0.tar.gz
- source = pgmoon-lua53-compat.patch
- md5sums = fbfa084ff9947b1d2552357dde2e25c8
- md5sums = b25c48ed67c2b70011333eaa1f8292c3
+ source = lua-pgmoon-1.12.0.tar.gz::https://github.com/leafo/pgmoon/archive/v1.12.0.tar.gz
+ md5sums = 324b85cea48fd7650cd67ec354b8a783
pkgname = lua-pgmoon
pkgdesc = PostgreSQL driver written in pure Lua for Lua 5.4
+ depends = lua
depends = lua-lpeg
optdepends = lua-cqueues: asynchronous connectivity
optdepends = lua-socket: synchronous connectivity
pkgname = lua51-pgmoon
pkgdesc = PostgreSQL driver written in pure Lua for Lua 5.1
- depends = lua-lpeg
+ depends = lua51
+ depends = lua51-lpeg
depends = lua51-bitop
- optdepends = lua-cqueues: asynchronous connectivity
- optdepends = lua-socket: synchronous connectivity
+ optdepends = lua51-cqueues: asynchronous connectivity
+ optdepends = lua51-socket: synchronous connectivity
pkgname = lua52-pgmoon
pkgdesc = PostgreSQL driver written in pure Lua for Lua 5.2
- depends = lua-lpeg
+ depends = lua52
+ depends = lua52-lpeg
depends = lua52-bitop
- optdepends = lua-cqueues: asynchronous connectivity
- optdepends = lua-socket: synchronous connectivity
+ optdepends = lua52-cqueues: asynchronous connectivity
+ optdepends = lua52-socket: synchronous connectivity
pkgname = lua53-pgmoon
pkgdesc = PostgreSQL driver written in pure Lua for Lua 5.3
- depends = lua-lpeg
- optdepends = lua-cqueues: asynchronous connectivity
- optdepends = lua-socket: synchronous connectivity
+ depends = lua53
+ depends = lua53-lpeg
+ optdepends = lua53-cqueues: asynchronous connectivity
+ optdepends = lua53-socket: synchronous connectivity
diff --git a/PKGBUILD b/PKGBUILD
index 246b9afc915b..90f88a348c36 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,24 +2,17 @@
pkgname=('lua-pgmoon' 'lua51-pgmoon' 'lua52-pgmoon' 'lua53-pgmoon')
_pkgbase='pgmoon'
-pkgver=1.11.0
-pkgrel=2
+pkgver=1.12.0
+pkgrel=1
arch=('any')
url='https://github.com/leafo/pgmoon'
license=('MIT')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/leafo/pgmoon/archive/v$pkgver.tar.gz"
-"${_pkgbase}-lua53-compat.patch")
-md5sums=('fbfa084ff9947b1d2552357dde2e25c8'
-'b25c48ed67c2b70011333eaa1f8292c3')
-
-prepare() {
- cd "${_pkgbase}-$pkgver"
- patch --forward --strip=1 --input="${srcdir}/${_pkgbase}-lua53-compat.patch"
-}
+source=("$pkgname-$pkgver.tar.gz::https://github.com/leafo/pgmoon/archive/v$pkgver.tar.gz")
+md5sums=('324b85cea48fd7650cd67ec354b8a783')
package_lua-pgmoon() {
pkgdesc='PostgreSQL driver written in pure Lua for Lua 5.4'
- depends=('lua-lpeg')
+ depends=('lua' 'lua-lpeg')
optdepends=('lua-cqueues: asynchronous connectivity'
'lua-socket: synchronous connectivity')
@@ -31,9 +24,9 @@ package_lua-pgmoon() {
package_lua51-pgmoon() {
pkgdesc='PostgreSQL driver written in pure Lua for Lua 5.1'
- depends=('lua-lpeg' 'lua51-bitop')
- optdepends=('lua-cqueues: asynchronous connectivity'
- 'lua-socket: synchronous connectivity')
+ depends=('lua51' 'lua51-lpeg' 'lua51-bitop')
+ optdepends=('lua51-cqueues: asynchronous connectivity'
+ 'lua51-socket: synchronous connectivity')
cd "pgmoon-$pkgver"
install -Dm644 pgmoon.lua "$pkgdir/usr/share/lua/5.1/pgmoon.lua"
@@ -43,9 +36,9 @@ package_lua51-pgmoon() {
package_lua52-pgmoon() {
pkgdesc='PostgreSQL driver written in pure Lua for Lua 5.2'
- depends=('lua-lpeg' 'lua52-bitop')
- optdepends=('lua-cqueues: asynchronous connectivity'
- 'lua-socket: synchronous connectivity')
+ depends=('lua52' 'lua52-lpeg' 'lua52-bitop')
+ optdepends=('lua52-cqueues: asynchronous connectivity'
+ 'lua52-socket: synchronous connectivity')
cd "pgmoon-$pkgver"
install -Dm644 pgmoon.lua "$pkgdir/usr/share/lua/5.2/pgmoon.lua"
@@ -55,9 +48,9 @@ package_lua52-pgmoon() {
package_lua53-pgmoon() {
pkgdesc='PostgreSQL driver written in pure Lua for Lua 5.3'
- depends=('lua-lpeg')
- optdepends=('lua-cqueues: asynchronous connectivity'
- 'lua-socket: synchronous connectivity')
+ depends=('lua53' 'lua53-lpeg')
+ optdepends=('lua53-cqueues: asynchronous connectivity'
+ 'lua53-socket: synchronous connectivity')
cd "pgmoon-$pkgver"
install -Dm644 pgmoon.lua "$pkgdir/usr/share/lua/5.3/pgmoon.lua"
diff --git a/pgmoon-lua53-compat.patch b/pgmoon-lua53-compat.patch
deleted file mode 100644
index 17cd8c34f0df..000000000000
--- a/pgmoon-lua53-compat.patch
+++ /dev/null
@@ -1,361 +0,0 @@
-From ff188f9cab8f1310fb91c984bc532fd42fe91671 Mon Sep 17 00:00:00 2001
-From: John Regan <john@jrjrtech.com>
-Date: Mon, 23 Nov 2020 08:02:44 -0500
-Subject: [PATCH 1/2] lua compatibility fixes
-
-fixes affected_rows always nil on Lua 5.2+
-
-fixes tests always failing on Lua 5.2+
----
- pgmoon/init.lua | 2 +-
- pgmoon/init.moon | 2 +-
- spec/pgmoon_spec.moon | 7 +++++--
- 3 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/pgmoon/init.lua b/pgmoon/init.lua
-index 4ebe466..ebd1413 100644
---- a/pgmoon/init.lua
-+++ b/pgmoon/init.lua
-@@ -362,7 +362,7 @@ do
- local command, affected_rows
- if command_complete then
- command = command_complete:match("^%w+")
-- affected_rows = tonumber(command_complete:match("%d+%z$"))
-+ affected_rows = tonumber(command_complete:match("(%d+)%z$"))
- end
- if row_desc then
- if not (data_rows) then
-diff --git a/pgmoon/init.moon b/pgmoon/init.moon
-index c9f91a4..f1be491 100644
---- a/pgmoon/init.moon
-+++ b/pgmoon/init.moon
-@@ -330,7 +330,7 @@ class Postgres
-
- if command_complete
- command = command_complete\match "^%w+"
-- affected_rows = tonumber command_complete\match "%d+%z$"
-+ affected_rows = tonumber command_complete\match "(%d+)%z$"
-
- if row_desc
- return {} unless data_rows
-diff --git a/spec/pgmoon_spec.moon b/spec/pgmoon_spec.moon
-index 46af904..8cebec0 100644
---- a/spec/pgmoon_spec.moon
-+++ b/spec/pgmoon_spec.moon
-@@ -23,8 +23,11 @@ describe "pgmoon with server", ->
- local pg
-
- setup ->
-- assert 0 == os.execute "dropdb -h '#{HOST}' -p '#{PORT}' --if-exists -U '#{USER}' '#{DB}'"
-- assert 0 == os.execute "createdb -h '#{HOST}' -p '#{PORT}' -U '#{USER}' '#{DB}'"
-+ r = { os.execute "dropdb -h '#{HOST}' -p '#{PORT}' --if-exists -U '#{USER}' '#{DB}'" }
-+ assert 0 == r[#r]
-+
-+ r = { os.execute "createdb -h '#{HOST}' -p '#{PORT}' -U '#{USER}' '#{DB}'" }
-+ assert 0 == r[#r]
-
- pg = Postgres {
- database: DB
-
-From 42773d45291258f809dfeb32146c34ccd690e0b0 Mon Sep 17 00:00:00 2001
-From: John Regan <john@jrjrtech.com>
-Date: Mon, 23 Nov 2020 08:04:42 -0500
-Subject: [PATCH 2/2] add new lua 5.3+ bit module
-
----
- pgmoon-dev-1.rockspec | 2 +-
- pgmoon/bit.lua | 55 ++++++++++++++++++++++++++
- pgmoon/bit.moon | 70 ++++++++++++++++++++++++++++++++
- pgmoon/init.lua | 2 +-
- pgmoon/init.moon | 3 +-
- spec/pgmoon_spec.moon | 92 +++++++++++++++++++++++++++++++++++++++++++
- 6 files changed, 221 insertions(+), 3 deletions(-)
- create mode 100644 pgmoon/bit.lua
- create mode 100644 pgmoon/bit.moon
-
-diff --git a/pgmoon-dev-1.rockspec b/pgmoon-dev-1.rockspec
-index 52f505e..f672764 100644
---- a/pgmoon-dev-1.rockspec
-+++ b/pgmoon-dev-1.rockspec
-@@ -15,7 +15,6 @@ description = {
-
- dependencies = {
- "lua >= 5.1",
-- "luabitop",
- "lpeg",
- }
-
-@@ -24,6 +23,7 @@ build = {
- modules = {
- ["pgmoon"] = "pgmoon/init.lua",
- ["pgmoon.arrays"] = "pgmoon/arrays.lua",
-+ ["pgmoon.bit"] = "pgmoon/bit.lua",
- ["pgmoon.cqueues"] = "pgmoon/cqueues.lua",
- ["pgmoon.crypto"] = "pgmoon/crypto.lua",
- ["pgmoon.hstore"] = "pgmoon/hstore.lua",
-diff --git a/pgmoon/bit.lua b/pgmoon/bit.lua
-new file mode 100644
-index 0000000..102f944
---- /dev/null
-+++ b/pgmoon/bit.lua
-@@ -0,0 +1,55 @@
-+local rshift, lshift, band, ok, _
-+local string_loader
-+string_loader = function(str)
-+ local sent = false
-+ return function()
-+ if sent then
-+ return nil
-+ end
-+ sent = true
-+ return str
-+ end
-+end
-+ok, band = pcall(load(string_loader([[ return function(a,b)
-+ a = a & b
-+ if a > 0x7FFFFFFF then
-+ -- extend the sign bit
-+ a = ~0xFFFFFFFF | a
-+ end
-+ return a
-+ end
-+]])))
-+if ok then
-+ _, lshift = pcall(load(string_loader([[ return function(x,y)
-+ -- limit to 32-bit shifts
-+ y = y % 32
-+ x = x << y
-+ if x > 0x7FFFFFFF then
-+ -- extend the sign bit
-+ x = ~0xFFFFFFFF | x
-+ end
-+ return x
-+ end
-+ ]])))
-+ _, rshift = pcall(load(string_loader([[ return function(x,y)
-+ y = y % 32
-+ -- truncate to 32-bit before applying shift
-+ x = x & 0xFFFFFFFF
-+ x = x >> y
-+ if x > 0x7FFFFFFF then
-+ x = ~0xFFFFFFFF | x
-+ end
-+ return x
-+ end
-+ ]])))
-+else
-+ do
-+ local _obj_0 = require("bit")
-+ rshift, lshift, band = _obj_0.rshift, _obj_0.lshift, _obj_0.band
-+ end
-+end
-+return {
-+ rshift = rshift,
-+ lshift = lshift,
-+ band = band
-+}
-diff --git a/pgmoon/bit.moon b/pgmoon/bit.moon
-new file mode 100644
-index 0000000..f2a2cc6
---- /dev/null
-+++ b/pgmoon/bit.moon
-@@ -0,0 +1,70 @@
-+local rshift, lshift, band, ok, _
-+local string_loader
-+
-+
-+-- lua5.1 has separate 'loadstring' and 'load'
-+-- functions ('load' doesn't accept strings).
-+-- This provides a function that 'load' can use,
-+-- and will work on all versions of lua
-+
-+string_loader = (str) ->
-+ sent = false
-+ return ->
-+ if sent then
-+ return nil
-+ sent = true
-+ return str
-+
-+
-+-- use load to treat as a string to prevent
-+-- parse errors under lua < 5.3
-+
-+-- luajit uses 32-bit integers for bitwise ops, but lua5.3+
-+-- uses 32-bit or 64-bit integers, so these wrappers will
-+-- truncate results and/or extend the sign, as appropriate
-+-- to match luajit's behavior.
-+ok, band = pcall(load(string_loader([[
-+ return function(a,b)
-+ a = a & b
-+ if a > 0x7FFFFFFF then
-+ -- extend the sign bit
-+ a = ~0xFFFFFFFF | a
-+ end
-+ return a
-+ end
-+]])))
-+
-+if ok then
-+ _, lshift = pcall(load(string_loader([[
-+ return function(x,y)
-+ -- limit to 32-bit shifts
-+ y = y % 32
-+ x = x << y
-+ if x > 0x7FFFFFFF then
-+ -- extend the sign bit
-+ x = ~0xFFFFFFFF | x
-+ end
-+ return x
-+ end
-+ ]])))
-+ _, rshift = pcall(load(string_loader([[
-+ return function(x,y)
-+ y = y % 32
-+ -- truncate to 32-bit before applying shift
-+ x = x & 0xFFFFFFFF
-+ x = x >> y
-+ if x > 0x7FFFFFFF then
-+ x = ~0xFFFFFFFF | x
-+ end
-+ return x
-+ end
-+ ]])))
-+else
-+ import rshift, lshift, band from require "bit"
-+
-+return {
-+ rshift: rshift
-+ lshift: lshift
-+ band: band
-+}
-+
-diff --git a/pgmoon/init.lua b/pgmoon/init.lua
-index ebd1413..9dce4c3 100644
---- a/pgmoon/init.lua
-+++ b/pgmoon/init.lua
-@@ -3,7 +3,7 @@ local insert
- insert = table.insert
- local rshift, lshift, band
- do
-- local _obj_0 = require("bit")
-+ local _obj_0 = require("pgmoon.bit")
- rshift, lshift, band = _obj_0.rshift, _obj_0.lshift, _obj_0.band
- end
- local unpack = table.unpack or unpack
-diff --git a/pgmoon/init.moon b/pgmoon/init.moon
-index f1be491..a21641d 100644
---- a/pgmoon/init.moon
-+++ b/pgmoon/init.moon
-@@ -1,6 +1,7 @@
- socket = require "pgmoon.socket"
- import insert from table
--import rshift, lshift, band from require "bit"
-+
-+import rshift, lshift, band from require "pgmoon.bit"
-
- unpack = table.unpack or unpack
-
-diff --git a/spec/pgmoon_spec.moon b/spec/pgmoon_spec.moon
-index 8cebec0..4116cc7 100644
---- a/spec/pgmoon_spec.moon
-+++ b/spec/pgmoon_spec.moon
-@@ -11,6 +11,98 @@ DB = "pgmoon_test"
- psql = ->
- os.execute "psql -h '#{HOST}' -p '#{PORT}' -U '#{USER}'"
-
-+describe "bit library compatibility", ->
-+ import band, lshift, rshift from require "pgmoon.bit"
-+
-+ it "lshift works the same as luabitop", ->
-+ assert 255 == lshift(0xff,0)
-+ assert 65535 == lshift(0xffff,0)
-+ assert 16777215 == lshift(0xffffff,0)
-+ assert -1 == lshift(0xffffffff,0)
-+ assert 65280 == lshift(0xff,8)
-+ assert 16711680 == lshift(0xff,16)
-+ assert -16777216 == lshift(0xff,24)
-+ assert 255 == lshift(0xff,32)
-+ assert 16776960 == lshift(0xffff,8)
-+ assert -65536 == lshift(0xffff,16)
-+ assert -16777216 == lshift(0xffff,24)
-+ assert 65535 == lshift(0xffff,32)
-+ assert -256 == lshift(0xffffff,8)
-+ assert -65536 == lshift(0xffffff,16)
-+ assert -16777216 == lshift(0xffffff,24)
-+ assert 16777215 == lshift(0xffffff,32)
-+ assert -256 == lshift(0xffffffff,8)
-+ assert -65536 == lshift(0xffffffff,16)
-+ assert -16777216 == lshift(0xffffffff,24)
-+ assert -1 == lshift(0xffffffff,32)
-+ assert 1 == lshift(1,0)
-+ assert 256 == lshift(1,8)
-+ assert 65536 == lshift(1,16)
-+ assert 16777216 == lshift(1,24)
-+ assert 1 == lshift(1,32)
-+ assert -1 == lshift(-1,0)
-+ assert -256 == lshift(-1,8)
-+ assert -65536 == lshift(-1,16)
-+ assert -16777216 == lshift(-1,24)
-+ assert -1 == lshift(-1,32)
-+
-+ it "rshift works the same as luabitop", ->
-+ assert 255 == rshift(0xff,0)
-+ assert 65535 == rshift(0xffff,0)
-+ assert 16777215 == rshift(0xffffff,0)
-+ assert -1 == rshift(0xffffffff,0)
-+ assert 0 == rshift(0xff,8)
-+ assert 0 == rshift(0xff,16)
-+ assert 0 == rshift(0xff,24)
-+ assert 255 == rshift(0xff,32)
-+ assert 255 == rshift(0xffff,8)
-+ assert 0 == rshift(0xffff,16)
-+ assert 0 == rshift(0xffff,24)
-+ assert 65535 == rshift(0xffff,32)
-+ assert 65535 == rshift(0xffffff,8)
-+ assert 255 == rshift(0xffffff,16)
-+ assert 0 == rshift(0xffffff,24)
-+ assert 16777215 == rshift(0xffffff,32)
-+ assert 16777215 == rshift(0xffffffff,8)
-+ assert 65535 == rshift(0xffffffff,16)
-+ assert 255 == rshift(0xffffffff,24)
-+ assert -1 == rshift(0xffffffff,32)
-+ assert 1 == rshift(1,0)
-+ assert 0 == rshift(1,8)
-+ assert 0 == rshift(1,16)
-+ assert 0 == rshift(1,24)
-+ assert 1 == rshift(1,32)
-+ assert -1 == rshift(-1,0)
-+ assert 16777215 == rshift(-1,8)
-+ assert 65535 == rshift(-1,16)
-+ assert 255 == rshift(-1,24)
-+ assert -1 == rshift(-1,32)
-+
-+ it "band works the same as luabitop", ->
-+ assert 0 == band(0xff,0)
-+ assert 0 == band(0xffff,0)
-+ assert 0 == band(0xffffff,0)
-+ assert 0 == band(0xffffffff,0)
-+ assert 255 == band(0xff,0xff)
-+ assert 65535 == band(0xffff,0xffff)
-+ assert 16777215 == band(0xffffff,0xffffff)
-+ assert -1 == band(0xffffffff,0xffffffff)
-+ assert 16777215 == band(0xffffffff,0xffffff)
-+ assert 65535 == band(0xffffffff,0xffff)
-+ assert 255 == band(0xffffffff,0xff)
-+ assert 255 == band(0xff,-1)
-+ assert 65535 == band(0xffff,-1)
-+ assert 16777215 == band(0xffffff,-1)
-+ assert -1 == band(0xffffffff,-1)
-+ assert 0 == band(-1,0)
-+ assert 255 == band(-1,0xff)
-+ assert 65535 == band(-1,0xffff)
-+ assert 16777215 == band(-1,0xffffff)
-+ assert -1 == band(-1,0xffffffff)
-+ assert -1 == band(-1,-1)
-+ assert 255 == band(0xffffffffff,0xff)
-+
-+
- describe "pgmoon with server", ->
- setup ->
- os.execute "spec/postgres.sh start"