Fix shebang line in tcl scripts

Lmod's configure script goes to the trouble of finding
tclsh.  This change uses that info to rewrite the #! lines
in the tcl scripts so that they call the tclsh that the
configure script discovered.

It needs to massage the existing shebang lines into something
that the sed statement in the makefile can manipulate and
it needs to add the path_to_tclsh info into the set of sed
statements.

Checked with versions 6.4.1 and 6.3.7 (the checksum for 6.0.1 is
incorrect, a fix for another time).
This commit is contained in:
George Hartzell 2016-07-21 13:58:16 -04:00
parent 52f0249c61
commit 9523e50732
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,10 @@
--- a/Makefile.in 2016-07-21 13:03:27.861000000 -0400
+++ b/Makefile.in 2016-07-21 13:03:58.416000000 -0400
@@ -197,6 +197,7 @@
-e 's|@colorize@|$(COLORIZE)|g' \
-e 's|@duplicate_paths@|$(DUPLICATE_PATHS)|g' \
-e 's|@allow_tcl_mfiles@|$(ALLOW_TCL_MFILES)|g' \
+ -e 's|@path_to_tclsh@|$(PATH_TO_TCLSH)|g' \
-e 's|@mpath_avail@|$(MPATH_AVAIL)|g' \
-e 's|@short_time@|$(SHORT_TIME)|g' \
-e 's|@cacheDirs@|$(SPIDER_CACHE_DIRS)|g' \

View file

@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
from glob import glob
class Lmod(Package): class Lmod(Package):
""" """
@ -54,6 +54,15 @@ def setup_environment(self, spack_env, run_env):
spack_env.append_path('LUA_PATH', stage_lua_path.format( spack_env.append_path('LUA_PATH', stage_lua_path.format(
version=self.version), separator=';') version=self.version), separator=';')
patch('fix_tclsh_paths.patch')
def patch(self):
"""The tcl scripts should use the tclsh that was discovered
by the configure script. Touch up their #! lines so that the
sed in the Makefile's install step has something to work on.
Requires the change in the associated patch file.fg"""
for tclscript in glob('src/*.tcl'):
filter_file(r'^#!.*tclsh', '#!@path_to_tclsh@', tclscript)
def install(self, spec, prefix): def install(self, spec, prefix):
configure('--prefix=%s' % prefix) configure('--prefix=%s' % prefix)
make('install') make('install')