-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alien-Luarocks supporting several lua versions #4
Comments
Great question, we didn't dive into multi-versioning for Alien components yet. As it stands, to work with multiple Lua/LuaRocks versions, one would have to SymlinkProgram both Lua and LuaRocks to switch versions each time. Clearly not ideal. (I never attacked this problem myself because I'm usually running a development copy of LuaRocks in my $HOME, but that's not of course the "right solution"). The LuaRocks approach for multi-versioning is that it installs itself as both Here's an idea: what if Alien runs It's still not perfect because one would have to install LuaRocks three times, once for each Lua version (which leads us to the next question, how to install the same version of LuaRocks three times on GoboLinux cleanly... a klugde would be something like /Programs/LuaRocks/2.3.0_5.3/) |
Yeah, sounds fine but I think that calling SymlinkProgram just to change the version of lua at user scope is a bit overkill. That's fine if you want to make the default lua at system level but for users i was thinking more in adding a small utility (Environment function) to change between different versions of lua (aliases for example).
What about including luarocks with the lua recipe? for new versions of luarocks we can just release a new revision of the recipe. I think that the most widely use of lua is together with luarocks so I think that will work for most of the people. We can also provide a standalone Lua and Luarocks recipe for those who need something special (they will need to deal then with the conflicts i guess). |
While revisiting open issues I noticed this one and thought about giving my 2 cents. How about spawning LuaRocks through Runner to have the right version of Lua automatically configured? |
@AitorATuin This is what Homebrew does on macOS. It's definitely an option, but bundling things under the same prefix is not too Gobo-like.
@lucasvr LuaRocks has no problem finding the Lua version it was configured with. The trouble is having up to three copies of the same version of LuaRocks to handle different Lua versions. The LuaRocks codebase works the same for Lua 5.1-5.3, the only difference is that its modules need to be installed in No solution I can think of right now makes me fully satisfied. I might end up going with Aitor's suggestion for simplicity's sake. |
Ahhhh, thanks for the clarification @hishamhm. |
@hishamhm I know it's not the better solution but I think it's the simplest solution, at least for the moment, we can think about a better solution in the future if we can. |
Actually we have the same problem with python. I think that over and above the specific lua problem we should take a decision regarding on how to deal with multiple versions for the same language (in the languages for which this make sense of course). |
A PR implementing a new PIP3 namespace. |
PIP3 is probably necessary anyway, but the broader issue is different minor versions used in parallel, which can't feasibly be dealt with with new prefixes every time. Python 3.5 vs 3.6 or Lua 5.2 vs 5.3 can potentially be handled by detecting the corresponding language version in use from the dependencies. Bundling the package manager with it is one way to manage that, but it could be built in as a feature separately too. There may be odd corner cases where versions of more than one package matter and not just the language itself, which bundling can't deal with (for example, alien packages may vary according to both the language and the VM backing it). There's a fundamental problem anyway when you upgrade and change the default system version too, when all of these packages instantly disappear. I don't know how to solve that. Declaring a single specific version of each is supported and ignoring the rest is one option, but that just means you're stuck forever. |
Well, that should be something the concrete package manager should deal with. In lua it's easier, the versioning is much better imho, lua 5.2 is different from lua 5.3 and you have two different binaries.
I don't see this could happen in lua (which is the case we were discussing regarding the package manager bundled) but maybe I'm missing something. Can you provide an example, please?
Yeah, not sure if we should even solve this in Alien, it's a problem related to the language anyway. |
They're also python3.5 and python3.6 (and more if you turn on autoVersionExecutables). Python scripts could all be patched by Compile to run a particular version, it's just annoying to do so.
I can imagine a JVM language having libraries that depended on both the JVM version and the language version, or something building on Parrot or Mono. None of those are supported at the moment anyway, so it's a future issue only. For Lua and Python it's not a problem. A long-term solution shouldn't exclude the possibility though. |
Here's a sketch of a general solution in a way that may cover the cases that @AitorATuin and @mwh brought up:
For example, given a Dependencies file that says:
then Alien-LuaRocks should be able to infer that
Does this all sound sensible? Or is it too over-engineered? Or does it shift the burden too much on the Alien drivers? |
In general it sounds good enough for me with some comments / suggestions:
A tricky situation arises when there are no trees under the namespace yet. I suppose it's up to the Alien driver to fail, give the user sensible --tree options for the language, or to detect which language version is currently installed. Yeah, in that case it should expect explicitly a tree parameter i guess. |
I agree that decoupling things is preferrable, but moving the context resolution into a component in Compile would mean that this component needs to know rules for all supported languages. My criterion is that the logic for knowing how to resolve a set of dependencies into a tree is language-specific, and therefore belongs in each specific Alien. The knowledge about the dependencies format should be separate, that's why I suggested using the The tree resolution is very language-specifiic. Typically it would query just the language, as in the Lua example, or as in @mwh's example, it could check for two programs; I'll cook up a PR to see how the implementation looks in practice. That way we'll be able to better judge if things got too coupled or not.
That is sensible and not too magical. |
As proposed in #4 (comment) Implemented LuaRocks only first as a proof-of-concept. See discussion in #4 for details.
Uploaded the PR: #24 |
Does Alien or the luarocks Alien wrapper support different versions of lua at the moment?
I want to support the three latest version (5.1, 5.2 and 5.3) and I was wondering what's the best approach to achieve it, i have in mind some alternatives:
luarocks
that is currently linked and support an utility in the Lua package/Recipe to switch the lua version somehow. We can also have different recipes for older versions of lua (Lua1, Lua2) and let Lua to point to the latest version (5.3 now) (we will need the same for the Luarocks package/Recipe obviously)if the versioning is not supported which option makes more sense for you?
The text was updated successfully, but these errors were encountered: