Make RubyGem extension EB use GEM_ envs except if installed with Ruby itself#1247
Make RubyGem extension EB use GEM_ envs except if installed with Ruby itself#1247boegel merged 3 commits intoeasybuilders:developfrom
Conversation
|
|
||
| # this is the 'proper' way to specify a custom installation prefix: set $GEM_HOME | ||
| if not self.is_extension: | ||
| if self.cfg.__dict__.get('software_name') != 'Ruby': |
There was a problem hiding this comment.
This is a bit dirty, but I think the real question we should ask is why the existing check based on self.is_extension doesn't, it should, see https://github.com/easybuilders/easybuild-framework/blob/master/easybuild/framework/extensioneasyblock.py#L88
There was a problem hiding this comment.
I think it does not work, because it is a Bundle. So the gems are installed as extension not as an EasyBlock (rubygem). But I might misunderstand the code.
There was a problem hiding this comment.
OK, I think I see the problem...
We need to have $GEM_HOME set both when installing individual Ruby gems as stand-alone modules, and also when installing a bundle of gems together, but not when installing extensions as a part of a Ruby installation (i.e. a "batteries included" Ruby installation).
So, I think we need to keep the not self.is_extension condition, but combine it with another condition via or, like this:
# define $GEM_HOME for both stand-alone installations and bundles of gems,
# to ensure that they are being installed in the right location (i.e. not in parent the Ruby installation)
if not self.is_extension or self.master.name != 'Ruby':
env.setvar('GEM_HOME', self.installdir)To clarify: self.master is made available so extensions can access the parent software (in this case, the bundle that is being installed), see https://github.com/easybuilders/easybuild-framework/blob/master/easybuild/framework/extension.py#L57.
Can you give that a try and see if it works as expected?
There was a problem hiding this comment.
@boegel We have a maintenance period right now, so I will test it when we are online again.
| if self.cfg.__dict__.get('software_name') != 'Ruby': | ||
| txt += self.module_generator.prepend_paths('GEM_PATH', ['']) | ||
| return txt | ||
| return super(RubyGem, self).make_module_extra(txt) |
There was a problem hiding this comment.
Does this actually change anything? What's there should work...
There was a problem hiding this comment.
I think the original code was simply not executed. This change, indeed does not make any change, I just simply copied this part from the rpackage EasyBlock.
There was a problem hiding this comment.
Well, it's wrong as it is now, since we already call out to super(RubyGem, self).make_module_extra() when defining txt, see above.
It should be reinstated to just return txt imho.
|
@boegel Ping? Can we do something, or this PR is completely dead? |
|
@hajgato Sorry, I've been meaning to get back to this but keep getting distracted. My plan was to get this merged for EasyBuild v3.4.1, but other stuff got in between... |
|
@boegel This works perfect. |
|
Thanks for the fix @hajgato! |
If I understood correctly,
GEM_PATHandGEM_HOMEdo not have to be set if extensions installed fromRuby. At the old EB, GEM envs were set only if individual gems were installed, not as a bundle. For some reasonmake_module_extra(self)part does not work (also in the previous version)