aboutsummaryrefslogtreecommitdiffstats
path: root/community/luarocks
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-01-01 18:01:21 +0100
committerJakub Jirutka <jakub@jirutka.cz>2018-01-01 18:03:27 +0100
commit78738e70d186a73de523a72de316d7acd30a65b2 (patch)
tree87013c267fe13b0a7b7cf05174996e326536fd86 /community/luarocks
parent40f16916072f70bb59b15390136f6a2f781e1348 (diff)
downloadaports-78738e70d186a73de523a72de316d7acd30a65b2.tar.bz2
aports-78738e70d186a73de523a72de316d7acd30a65b2.tar.xz
community/luarocks: add support for /usr/share/lua/common
Diffstat (limited to 'community/luarocks')
-rw-r--r--community/luarocks/APKBUILD8
-rw-r--r--community/luarocks/config.lua17
-rw-r--r--community/luarocks/fix-tree-rocks_dir.patch147
-rw-r--r--community/luarocks/luarocks5.1.trigger4
-rw-r--r--community/luarocks/luarocks5.2.trigger4
-rw-r--r--community/luarocks/luarocks5.3.trigger4
6 files changed, 175 insertions, 9 deletions
diff --git a/community/luarocks/APKBUILD b/community/luarocks/APKBUILD
index 93b142af79..2ec621c665 100644
--- a/community/luarocks/APKBUILD
+++ b/community/luarocks/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=luarocks
pkgver=2.4.3
-pkgrel=0
+pkgrel=1
pkgdesc="Deployment and management system for Lua modules"
url="http://www.luarocks.org/"
arch="noarch"
@@ -12,6 +12,7 @@ makedepends=""
subpackages=""
triggers=""
source="http://luarocks.org/releases/$pkgname-$pkgver.tar.gz
+ fix-tree-rocks_dir.patch
config.lua"
builddir="$srcdir/$pkgname-$pkgver"
@@ -59,7 +60,7 @@ _subpackage() {
pkgdesc="Deployment and management system for Lua $lver modules"
install_if="lua$lver $pkgname=$pkgver-r$pkgrel"
depends="lua$lver"
- triggers="$subpkgname.trigger=/usr/lib/luarocks/rocks-$lver/*"
+ triggers="$subpkgname.trigger=/usr/lib/luarocks/rocks-$lver/*:/usr/lib/luarocks/rocks-common/*"
cd "$builddir-$lver"
@@ -80,4 +81,5 @@ _subpackage() {
}
sha512sums="a4efe19e650772594db107218422333d462a843561f37787744244d359bb6337dfbcfd143f5f7c407725409f54754f3bf7552423cbb31c4633d9960af1d2f9bf luarocks-2.4.3.tar.gz
-c41bf3f8491e25d69ce0fee379203cc3721f2c79bb9ff652488aa2d66bc1e4613bd59d331cf17b9f18521d4f63539ce946b6a39038dc844083463c2c96f71811 config.lua"
+22ca5efa62c592c8395ca8c9ce3c938b5e41cf7d149f45d3666a5370d27e3e8c01d1712217c456d7b54163e375d9841d5f9213b25f4237b0bf3ab498c02864fb fix-tree-rocks_dir.patch
+1f75705af3b1ef57386234195a5d496d554c95473e5b0c0a3319e3c0f905519397b92603c5596d363818df7d94f886b898ba12a3880d3e982d1c63b74c50febe config.lua"
diff --git a/community/luarocks/config.lua b/community/luarocks/config.lua
index 2b6c029f94..25e6d11717 100644
--- a/community/luarocks/config.lua
+++ b/community/luarocks/config.lua
@@ -1,6 +1,17 @@
rocks_trees = {
- { name = 'user', root = home..'/.luarocks' },
- { name = 'distro-modules', root = '/usr' },
- { name = 'system', root = '/usr/local' },
+ -- User-local Lua and Lua/C modules.
+ { name = 'user',
+ root = home..'/.luarocks' },
+ -- System-wide Lua and Lua/C modules for specific Lua version installed by apk.
+ { name = 'distro-modules',
+ root = '/usr' },
+ -- System-wide Lua modules compatible with Lua 5.1-5.3 installed by apk.
+ { name = 'distro-modules-common',
+ root = '/usr',
+ lua_dir = '/usr/share/lua/common',
+ rocks_dir = '/usr/lib/luarocks/rocks-common' },
+ -- System-wide Lua and Lua/C modules installed by user.
+ { name = 'system',
+ root = '/usr/local' },
}
deps_mode = 'all'
diff --git a/community/luarocks/fix-tree-rocks_dir.patch b/community/luarocks/fix-tree-rocks_dir.patch
new file mode 100644
index 0000000000..3a4c1f2e91
--- /dev/null
+++ b/community/luarocks/fix-tree-rocks_dir.patch
@@ -0,0 +1,147 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 01 Jan 2017 17:59:00 +0200
+Subject: [PATCH] Fix support for tree.rocks_dir
+
+LuaRocks allows to specify "tree" using just "root" which is a prefix
+prepended to default locations such as /lib/luarocks/rocks (rocks_dir),
+/share/lua/5.x (lua_dir) etc. Later they added option to specify
+rocks_dir, lua_dir, bin_dir... directly. The problem is that it's kinda
+broken, some methods does not respect these options and always
+construct these paths from "root".
+
+This patch hopefuly fixes this problem.
+
+We need it for /usr/lib/luarocks/rocks-common where we install
+rock_manifests for Lua modules compatible with Lua 5.1-5.3.
+See also config.lua.
+
+--- a/src/luarocks/command_line.lua
++++ b/src/luarocks/command_line.lua
+@@ -35,9 +35,14 @@
+ end
+
+ local function replace_tree(flags, tree)
+- tree = dir.normalize(tree)
++ if type(tree) == "table" then
++ path.use_tree(tree)
++ tree = dir.normalize(tree.root)
++ else
++ tree = dir.normalize(tree)
++ path.use_tree(tree)
++ end
+ flags["tree"] = tree
+- path.use_tree(tree)
+ end
+
+ local function is_ownership_ok(directory)
+@@ -137,7 +142,7 @@
+ if not tree.root then
+ die("Configuration error: tree '"..tree.name.."' has no 'root' field.")
+ end
+- replace_tree(flags, tree.root)
++ replace_tree(flags, tree)
+ named = true
+ break
+ end
+--- a/src/luarocks/path.lua
++++ b/src/luarocks/path.lua
+@@ -18,7 +18,9 @@
+ end
+
+ function path.rocks_dir(tree)
+- if type(tree) == "string" then
++ if not tree then
++ return cfg.rocks_dir
++ elseif type(tree) == "string" then
+ return dir.path(tree, cfg.rocks_subdir)
+ else
+ assert(type(tree) == "table")
+@@ -83,7 +85,6 @@
+ -- the package (and by extension, the path) exists.
+ function path.versions_dir(name, tree)
+ assert(type(name) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name)
+ end
+
+@@ -96,7 +97,6 @@
+ function path.install_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version)
+ end
+
+@@ -109,7 +109,6 @@
+ function path.rockspec_file(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, name.."-"..version..".rockspec")
+ end
+
+@@ -122,7 +121,6 @@
+ function path.rock_manifest_file(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "rock_manifest")
+ end
+
+@@ -135,7 +133,6 @@
+ function path.lib_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "lib")
+ end
+
+@@ -148,7 +145,6 @@
+ function path.lua_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "lua")
+ end
+
+@@ -161,7 +157,6 @@
+ function path.doc_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "doc")
+ end
+
+@@ -174,7 +169,6 @@
+ function path.conf_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "conf")
+ end
+
+@@ -188,7 +182,6 @@
+ function path.bin_dir(name, version, tree)
+ assert(type(name) == "string")
+ assert(type(version) == "string")
+- tree = tree or cfg.root_dir
+ return dir.path(path.rocks_dir(tree), name, version, "bin")
+ end
+
+@@ -303,11 +296,15 @@
+ end
+
+ function path.use_tree(tree)
+- cfg.root_dir = tree
++ cfg.root_dir = path.rocks_tree_to_string(tree)
+ cfg.rocks_dir = path.rocks_dir(tree)
+ cfg.deploy_bin_dir = path.deploy_bin_dir(tree)
+ cfg.deploy_lua_dir = path.deploy_lua_dir(tree)
+ cfg.deploy_lib_dir = path.deploy_lib_dir(tree)
++ -- Workaround for outdated methods that ignore cfg.rocks_dir.
++ if tree.rocks_dir then
++ cfg.rocks_subdir = tree.rocks_dir:match("^" .. util.matchquote(cfg.root_dir) .. "(.*)$")
++ end
+ end
+
+ --- Apply a given function to the active rocks trees based on chosen dependency mode.
diff --git a/community/luarocks/luarocks5.1.trigger b/community/luarocks/luarocks5.1.trigger
index 1769aad4e0..29a1e6d38d 100644
--- a/community/luarocks/luarocks5.1.trigger
+++ b/community/luarocks/luarocks5.1.trigger
@@ -1,5 +1,7 @@
#!/bin/sh
-luarocks-admin-5.1 make-manifest --local-tree --tree=/usr >/dev/null 2>&1
+for tree in distro-modules distro-modules-common; do
+ luarocks-admin-5.1 make-manifest --local-tree --tree=$tree >/dev/null 2>&1
+done
exit 0
diff --git a/community/luarocks/luarocks5.2.trigger b/community/luarocks/luarocks5.2.trigger
index 2f727a5ee9..e16c36f7a9 100644
--- a/community/luarocks/luarocks5.2.trigger
+++ b/community/luarocks/luarocks5.2.trigger
@@ -1,5 +1,7 @@
#!/bin/sh
-luarocks-admin-5.2 make-manifest --local-tree --tree=/usr >/dev/null 2>&1
+for tree in distro-modules distro-modules-common; do
+ luarocks-admin-5.2 make-manifest --local-tree --tree=$tree >/dev/null 2>&1
+done
exit 0
diff --git a/community/luarocks/luarocks5.3.trigger b/community/luarocks/luarocks5.3.trigger
index 1b751b090d..c1a8eede58 100644
--- a/community/luarocks/luarocks5.3.trigger
+++ b/community/luarocks/luarocks5.3.trigger
@@ -1,5 +1,7 @@
#!/bin/sh
-luarocks-admin-5.3 make-manifest --local-tree --tree=/usr >/dev/null 2>&1
+for tree in distro-modules distro-modules-common; do
+ luarocks-admin-5.3 make-manifest --local-tree --tree=$tree >/dev/null 2>&1
+done
exit 0