lua-users home
lua-l archive

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


On Thu, Nov 24, 2011 at 4:00 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Thu, Nov 24, 2011 at 10:55 AM, Hisham <hisham.hm@gmail.com> wrote:
>> On Thu, Nov 24, 2011 at 12:42 PM, Javier Guerra Giraldez
>> <javier@guerrag.com> wrote:
>>> i've tried that a few times, but what i get is a non-standard tree and
>>> a preloader. it was a few months ago, so i don't remember the
>>> details;
>>
>> Well, it was certainly many months ago! LuaRocks supports standard
>> trees without preloaders since October 2009.
>
> no, it definitely was 2011.  in fact, i tried it precisely because i
> remembered some (old) comments here said that.

A LuaRocks tree is like any other Lua tree: PREFIX/lib/lua/5.1/ for
binaries, PREFIX/share/lua/5.1/ for Lua files. By default it install
systemwide to /usr/local, which is the same as the Lua default. If you
configured it to any other path, you need to set LUA_PATH and
LUA_CPATH accordingly, with no magic at all, _or_ you can use the
provided loader which just does that for you. As a convenience, one
can also run " eval `luarocks path` " from the shell and have LUA_PATH
and LUA_CPATH adjusted automatically if desired.

>>> but could that be because
>>>
>>> - how luarocks itself was installed / configured?
>>
>> The default setup installs to standard tree under /usr/local. To
>> install to a user-specific ~/.luarocks tree you can use the --local
>> flag (this switching used to be automatic according to permissions,
>> but since December 2010 it's explicit: if it runs without permissions
>> to install in the system tree, it fails and you have to pass --local).
>
> is there some FAQ about this?  one that doesn't assume i already know
> the luarocks way, but specifically for "don't mess with my system"
> people?

It informs the user in the error message:

$ luarocks install luasocket
Error: Your user does not have write permissions in /usr/local/
-- you may want to run as a privileged user or use your local tree with --local.

$ sudo luarocks install luasocket
...(succeeds)...

>>> also, how can i tell luarocks that i already have something installed,
>>> not from a rock but as a standard module?
>>
>> I can add that to the wishlist: I could add a feature to allow you to
>> tell LuaRocks that a given version of a given rock doesn't need to be
>> fetched as a dependency (and it would be up to the user to ensure the
>> version is properly installed and compatible), but that's as far as
>> one could go.
>> Would that be desirable?
>>
>> Detecting what is installed in the system is impossible, due to the
>> lack of standardized versioning in modules.
>
> if it shows the dependencies, i can just ignore what i already have.
> or maybe a "don't care about versions, if it's require()able, it's
> fine" mode.

The latter is not possible because it can't figure out which packages
you have just by looking at the module files in the system. There's no
1-to-1 mapping between modules and rocks; some rocks provide many
modules and have different names (eg. luasocket vs. socket.core,
luafilesystem vs. lfs), and you can't tell a priori (before
compilation) which modules a source rock will install because some of
them use Makefiles.

>>> maybe just a rockspec->english (or bash, or whatever) translator would
>>> be better for old stubborn guys like me....
>>
>> Well, if I were to write a rockspec->bash script to run the rockspec,
>> I might as well write a rockspec->Lua script to run the rockspec... oh
>> wait, that would be LuaRocks. :o)
>
> yeah, as long as it has a dry-run option, to let me see what is it
> trying to do and do it myself, and if it's readable without having to
> care about inner works of LuaRocks.
>
> but what i'd really want is: from a rockspeck, print the dependency
> tree (maybe pruned if i can register the 'already have' packages), and
> the 'what goes where' of the specific package.

This is mostly implementable, except that for some packages, it can
only know the "what goes where" after actually compiling the modules.

Thank you for the feedback, and sorry about the late response!

-- Hisham
http://hisham.hm/ - http://luarocks.org/