Fix perl build when using Build.PL
This fixes #12852 where perl builds that use Build.PL will fail when the shebang of the Build script produced from the configure step is too long.
This commit is contained in:
parent
5201d2615e
commit
08a6577861
1 changed files with 12 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
from spack.directives import depends_on, extends
|
||||
from spack.package import PackageBase, run_after
|
||||
from spack.util.executable import Executable
|
||||
from llnl.util.filesystem import filter_file
|
||||
|
||||
|
||||
class PerlPackage(PackageBase):
|
||||
|
@ -80,6 +81,17 @@ def configure(self, spec, prefix):
|
|||
|
||||
inspect.getmodule(self).perl(*options)
|
||||
|
||||
# It is possible that the shebang in the Build script that is created from
|
||||
# Build.PL may be too long causing the build to fail. Patching the shebang
|
||||
# does not happen until after install so set '/usr/bin/env perl' here in
|
||||
# the Build script.
|
||||
@run_after('configure')
|
||||
def fix_shebang(self):
|
||||
if self.build_method == 'Build.PL':
|
||||
pattern = '#!{0}'.format(self.spec['perl'].command.path)
|
||||
repl = '#!/usr/bin/env perl'
|
||||
filter_file(pattern, repl, 'Build', backup=False)
|
||||
|
||||
def build(self, spec, prefix):
|
||||
"""Builds a Perl package."""
|
||||
self.build_executable()
|
||||
|
|
Loading…
Reference in a new issue