lua-users home
lua-l archive

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



On May 27, 2014 9:20 PM, "Sean Conner" <sean@conman.org> wrote:
>
>
>   I've successfully packaged up LuaRocks in a LEM file:
>
>           _LEM      MIT       Lua 5.1-5.2   0.1      _LEM
>                     MIT       Lua 5.1-5.2   2.1      _APP/luarocks
>                     MIT       Lua 5.1-5.2   2.1      _APP/luarocks-admin
>                     MIT       Lua 5.1-5.2   2.1      _MODULES/luarocks.add
>
>                 ...
>
>                     MIT       Lua 5.1-5.2   2.1      _MODULES/luarocks.unpack
>                     MIT       Lua 5.1-5.2   2.1      _MODULES/luarocks.util
>                     MIT       Lua 5.1-5.2   2.1      _MODULES/luarocks.validate
>                     MIT       Lua 5.1-5.2   2.1      _MODULES/luarocks.write_rockspec
>                                                      _FILES/config-5.1.lua
>                                                      _FILES/config.lua
>
> and you can tell I changed the layout a bit.  I've put application specific
> files under _APP/, the modules themselves under _MODULES/ and files the
> application uses under _FILES/.  The _APP files and _MODULES/ are loaded
> directly from the LEM (seeing how they're all Lua scripts) which was the
> original intent [1].  And I can run it from there:
>
> [spc]lucy:~/projects/LEM>./tstlem.lua luarocks.lem luarocks list
>
> Installed rocks:
> ----------------
>
> date
>    2.1.0-2 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> lpeg
>    0.12-1 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> luarocks
>    2.1.2-1 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> luuid
>    20120501-1 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> org.conman.uuid
>    1.2.0-1 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> uuid
>    0.2-1 (installed) - /home/spc/.luarocks/lib/luarocks/rocks
>
> But there are still issues.  One, I can't serve up the files from the LEM
> file---I have to write those out.  It's not enough to simply monkeypatch
> io.open()---there's dofile() and loadfile() as well (found that out the hard
> way).  And I'm not sure if I want to exactly monkeypatch Lua.  One problem:
> what if LuaRocks did [2]:
>
>         f = io.open("config.lua","r+")
>
> which opens f in read/write mode.  Does that imply the file is updated in
> the LEM file?  It's compressed in the LEM.  That means f:seek() won't work,
> unless we inflate it, which either means we keep the entire file in memory,
> or we inflate it to disk.  Right now I'm inflating everything under _FILES
> to a temporary directory, then removing that after the program finishes [3].
>
> And that leads to issue two:  persistent data.  In the LEM?  On disk?
> Depends on the app?
>
> Issue three: version numbers.  The actual version of LuaRocks I am using is 2.1.2-1.
> Is just using 2.1 good enough?  Do we need three numbers?  Four?  What do
> they all mean?
>
> Issue four:  Aside from Aaron B, Kevin Martin and Lorenzo Donati, is there
> anyone else intereted in a Lua application distribution file format?

I am interested, but it needs to be cross platform. I need Linux, Windows and Mac support.

I made something similar, but not fancy like a zip. I converted all binaries into Lua and used 'amalg.lua' and srLua to then run the binary after it was built. It was very hard to get everything right, especially Windows stupidly loading files as text in Lua's dofile(). It made me have to write a custom loader that wrote the files to disk first before executing. Then cleanup after. So if all that could be improved that would be very helpful.
--
Regards,
Ryan