> -----Original Message-----
> From: Eduardo Ochs [mailto:eduardoo...@gmail.com]
> Sent: zondag 11 oktober 2015 0:21
> To: luarocks-developers@lists.sourceforge.net
> Subject: [Luarocks-developers] Running luarocks interactively
> 
> Hi all,
> 
> I am trying to understand more about luarocks by running it from the
> lua5.1 interpreter... I added this to my $LUA_INIT file,
> 
>   loadluarocks = function ()
>       package.path =
> "/usr/share/lua/5.1//?.lua;/usr/share/lua/5.1//?/init.lua;"..package.path
>       command_line = require("luarocks.command_line")
>       program_name = "luarocks"
>       program_description = "LuaRocks main command-line interface"
>       commands          = {}
>       commands.help     = require("luarocks.help")
>       commands.pack     = require("luarocks.pack")
>       commands.unpack   = require("luarocks.unpack")
>       commands.build    = require("luarocks.build")
>       commands.install  = require("luarocks.install")
>       commands.search   = require("luarocks.search")
>       commands.list     = require("luarocks.list")
>       commands.remove   = require("luarocks.remove")
>       commands.make     = require("luarocks.make")
>       commands.download = require("luarocks.download")
>       commands.path     = require("luarocks.path")
>       commands.show     = require("luarocks.show")
>       commands.new_version = require("luarocks.new_version")
>     end
> 
> so that I can do things like this:
> 
>   Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
>   > loadluarocks()
>   > command_line.run_command("help")
> 
> and replace functions dynamically, adding print-like statements to
> them.
> 
> One thing that I find very frustrating about luarocks is that I've
> never managed to learn how to run it more verbosely... for example, if
> I run this from from a shell,
> 
>   sudo luarocks remove lpeg
>   sudo luarocks install lpeg
> 
> then the output shows how to build lpeg without luarocks - something
> like:
> 
>   Installing http://luarocks.org/repositories/rocks/lpeg-1.0.0-1.src.rock...
>   Using http://luarocks.org/repositories/rocks/lpeg-1.0.0-1.src.rock...
> switching to 'build' mode
>   Archive:  /tmp/luarocks_luarocks-rock-lpeg-1.0.0-1-1133/lpeg-1.0.0-
> 1.src.rock
>     inflating: lpeg-1.0.0-1.rockspec
>     inflating: lpeg-1.0.0.tar.gz
>   gcc -O2 -fPIC -I/usr/include/lua5.1 -c lpcap.c -o lpcap.o
>   gcc -O2 -fPIC -I/usr/include/lua5.1 -c lpcode.c -o lpcode.o
>   gcc -O2 -fPIC -I/usr/include/lua5.1 -c lpprint.c -o lpprint.o
>   gcc -O2 -fPIC -I/usr/include/lua5.1 -c lptree.c -o lptree.o
>   gcc -O2 -fPIC -I/usr/include/lua5.1 -c lpvm.c -o lpvm.o
>   gcc -shared -o lpeg.so -L/usr/local/lib lpcap.o lpcode.o lpprint.o
> lptree.o lpvm.o
>   Updating manifest for /usr/local/lib/luarocks/rocks
> 
>   lpeg 1.0.0-1 is now built and installed in /usr/local/ (license: MIT/X11)
> 
> but I would like to make that output even more verbose, showing the
> "chdir"s, the calls to tar and unzip, and the "cp"s - and, ideally,
> but that may be much harder, to have a way to make luarocks run like
> "make -n", showing the commands that it would run, but without running
> them...
> 
> Any help or hints would be VERY appreciated. I understand very little
> of the sources right now...

LuaRocks works mostly through os commands, so if you monkey-patch `io.popen` 
and `os.execute` you should catch most of it. (that is also how `--verbose` 
works as Daurnimator pointed out already)

The tricky part is the system dependent part, eg. based on what is already 
installed (info from the manifest) it might do different things.

hth
Thijs


> 
>   Cheers =),
>     Eduardo Ochs
>     eduardoo...@gmail.com
>     http://angg.twu.net/
> 
> ----------------------------------------------------------------------------
> --
> _______________________________________________
> Luarocks-developers mailing list
> Luarocks-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/luarocks-developers

------------------------------------------------------------------------------
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to