[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#818900: [Lua Policy] integrate debian's lua modules into Debian's Luarocks



Package: lua5.1-policy
Version: 33
Severity: wishlist
X-Debbugs-CC: debian-devel@lists.debian.org, h@hisham.hm

Hi,
(Talking about policy, hence CC'ing -devel)
(CC'ing luarocks upstream)

When I'm dealing with one of my ITP's I found that this is
a noticeable problem to Debian's lua packages. And I think
this may require some changes to our lua policy, or the dh-lua
scripts.

Luarocks is a lua module manager, just like pip to python.
However Debian's luarocks is blind to Debian's lua modules,
i.e. `luarocks list` won't list lua modules installed by dpkg,
besides, lua modules installed by dpkg won't participate
lua module dependency resolution, that's bad.

When pulling new lua modules from the internet with `luarocks`,
it will scan lua module dependency and automatically pull missing
modules and install them. For example, I need to install a lua
module that is not packaged by us, say lua-xxx, and it depends
on lua-cjson. Then `luarocks install xxx` will cause luarocks
to install a new lua-cjson module, ignoring the lua-cjson package
installed by dpkg. Why do we provide lua-cjson package?

*** What to do to make improvement? ***

IMHO following changes should be considered:

1. update default configuration file of luarocks
   /etc/luarocks/config-5.1.lua

```patch
  rocks_trees = { 
     home..[[/.luarocks]],
     [[/usr/local]],
+    [[/usr]],
  }
+ deps_mode = 'all'
```

2. let luarocks package install this directory

   /usr/lib/luarocks/rocks/

3. update lua-* packages with luarocks integration,
   e.g. update their postinst and prerm scripts.
   
   To this point I have a solution that works but is not good enough:
   (patch parts copied from my locally modified lua-cjson package)

```patch
--- /dev/null
+++ b/debian/lua-cjson.postinst
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+prepare_luarocks ()
+{
+  local rockdir
+  rockdir='/usr/lib/luarocks/rocks/lua-cjson/2.1.0-1/'
+  mkdir -p $rockdir
+  echo 'rock_manifest = {}' > $rockdir/rock_manifest
+  cp /usr/share/doc/lua-cjson/lua-cjson-2.1.0-1.rockspec $rockdir
+  if [ -x /usr/bin/luarocks-admin ]; then
+    luarocks-admin make-manifest --local-tree --tree=/usr
+  fi
+}
[...]
```

and this one

```patch
--- /dev/null
+++ b/debian/lua-cjson.prerm
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+
+remove_luarocks ()
+{
+  if [ -x /usr/bin/luarocks ]; then
+       luarocks remove lua-cjson --local-tree --tree=/usr
+  fi
+}
+
```

Thanks! :-)
-- 
 .''`.    
: :' :    
`. `'     
  `-      


Reply to: