Skip to content

don't use PERL_MM_OPT and PERL_MB_OPT#1362

Merged
boegel merged 4 commits intoeasybuilders:developfrom
rug-cit-hpc:Perl-unset-envvars
Feb 21, 2018
Merged

don't use PERL_MM_OPT and PERL_MB_OPT#1362
boegel merged 4 commits intoeasybuilders:developfrom
rug-cit-hpc:Perl-unset-envvars

Conversation

@RvDijk
Copy link
Copy Markdown
Contributor

@RvDijk RvDijk commented Feb 20, 2018

Something like this should do the trick, however I was not able to test anything. Using e.g. eb ~/Perl-5.26.1-test-foss-2018a.eb --include-easyblocks=./perlmodule.py,../p/perl.py did not use my custom perlmodule.py. It would be helpful to know how I can use a custom easyblock such as perlmodule.py for testing.

"""Install procedure for Perl modules: using either Makefile.Pl or Build.PL."""
# Perl modules have two possible installation procedures: using Makefile.PL and Build.PL
# configure, build, test, install
unset_cmd = "unset PERL_MM_OPT PERL_MB_OPT"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll probably need to make this unset ... && to chain it with the Perl command? preconfigopts complicates this though...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better approach would be to use unset_env_vars(['PERL_MB_OPT', 'PERL_MM_OPT']), where unset_env_vars can be imported from easybuild.tools.environment.

This will result in proper logging for example, and since the environment in which commands are run via run_cmd is inherited, that should work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do include a comment to explain why these environment variables need to be unset.

unset_cmd = "unset PERL_MM_OPT PERL_MB_OPT"
if os.path.exists('Makefile.PL'):
run_cmd('%s perl Makefile.PL PREFIX=%s %s' % (self.cfg['preconfigopts'], self.installdir, self.cfg['configopts']))
run_cmd('%s %s perl Makefile.PL PREFIX=%s %s' % (unset_cmd, self.cfg['preconfigopts'], self.installdir, self.cfg['configopts']))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line becomes too long, and this won't work especially in combination with preconfigopts, but you can just revert this change if you use unset_env_vars instead.

@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 21, 2018

@RvDijk To test with a custom perlmodule.py, you currently need to place it in a subdirectory named generic, and specify its location via --include-easyblocks=/path/to/generic/perlmodule.py, see easybuilders/easybuild-framework#1964 .

@boegel boegel added this to the next release (3.5.2 or 3.6.0) milestone Feb 21, 2018
@RvDijk
Copy link
Copy Markdown
Contributor Author

RvDijk commented Feb 21, 2018

@boegel I agree with you a lot, I'll look into using unset_env_vars. I already wanted to do something like that but was not able to find how to change environment vars within these Python scripts. I think unset_env_vars is one of the best solutions.

@RvDijk
Copy link
Copy Markdown
Contributor Author

RvDijk commented Feb 21, 2018

@boegel I was able to build a simplified version of Perl, where one extension was used. The build succeeded succesfully, where the previous version of perlmodule.py would have failed.

"""Initialize custom class variables."""
super(PerlModule, self).__init__(*args, **kwargs)
self.testcmd = None
# Environment variables PERL_MM_OPT and PERL_MB_OPT cause installations to fail.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RvDijk Let's move the extra line you added below this block to above this block? :)

Also, drop the WIP from the PR title, it looks good to go.

@RvDijk RvDijk changed the title don't use PERL_MM_OPT and PERL_MB_OPT (WIP) don't use PERL_MM_OPT and PERL_MB_OPT Feb 21, 2018
@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 21, 2018

Thanks @RvDijk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants