Commit 78738e70 authored by Jakub Jirutka's avatar Jakub Jirutka

community/luarocks: add support for /usr/share/lua/common

parent 40f16916
......@@ -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"
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'
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.
#!/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
#!/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
#!/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment