How to install luarocks packages without internet?

旧巷老猫 提交于 2019-12-13 00:19:57

问题


I used torch distro repository on github and installed LuaJIT and luarocks.

I want to install luarocks packages , from source, that is downloading the packages(.zip files) and building them from source .

I tried doing it by downloading the packages from github and then running luarocks install modulename.rockspec . But here it again starts cloning from github.

Can anyone tell me the exact procedure to do this ?


回答1:


You can use either source rocks or binary rocks.

Using source rocks

A source rock is a package with .src.rock extension containing the sources. You create it packing a rockspec:

luarocks pack bla-1.0-1.rockspec     # uses the network

This produces bla-1.0-1.src.rock. Running luarocks build bla-1.0-1.src.rock does not use the network to build bla, but it will hit the network to fetch dependencies if needed. So you need to pack and install all dependencies beforehand.

Using binary rocks

A binary rock is a compiled package with .PLATFORM.rock extension containing the .lua or .so/.dll modules. You create it building a module and then packing the code you built:

luarocks build bla-1.0-1.rockspec     # uses the network
luarocks pack bla                     # doesn't use the network

This produces a binary rock, say bla-1.0-1.linux-x86.rock. Note however that to install this in another machine, the target machine needs to be fully ABI-compatible, that is, all installed libraries in the source and destination machine need to be compatible (e.g. same OS/distro version). For this reason, this is useful for deploying rocks to multiple machines in a farm, but not for distributing binary packages for end-users in general.

Grouping packed rocks into a local server

Once you pack all rocks you need (and their dependencies) using one of the methods above, you can put them all in a directory, then turn it into a "local server":

mkdir my_rocks
mv *.rock my_rocks     # suppose we have some packed .rock files here
cd my_rocks
luarocks-admin make-manifest my_rocks

This works with both source and binary rocks. You'll then be able to build rocks from there without fetching the network.

luarocks install bla --only-server=/home/YOURNAME/my_rocks


来源:https://stackoverflow.com/questions/40845265/how-to-install-luarocks-packages-without-internet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!