From 9523e50732ff651e1ae073791708c312217bedb1 Mon Sep 17 00:00:00 2001 From: George Hartzell Date: Thu, 21 Jul 2016 13:58:16 -0400 Subject: [PATCH] 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). --- .../repos/builtin/packages/lmod/fix_tclsh_paths.patch | 10 ++++++++++ var/spack/repos/builtin/packages/lmod/package.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/lmod/fix_tclsh_paths.patch diff --git a/var/spack/repos/builtin/packages/lmod/fix_tclsh_paths.patch b/var/spack/repos/builtin/packages/lmod/fix_tclsh_paths.patch new file mode 100644 index 0000000000..70f0d47925 --- /dev/null +++ b/var/spack/repos/builtin/packages/lmod/fix_tclsh_paths.patch @@ -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' \ diff --git a/var/spack/repos/builtin/packages/lmod/package.py b/var/spack/repos/builtin/packages/lmod/package.py index 14b6e02b3a..c8936d768b 100644 --- a/var/spack/repos/builtin/packages/lmod/package.py +++ b/var/spack/repos/builtin/packages/lmod/package.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * - +from glob import glob 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( 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): configure('--prefix=%s' % prefix) make('install')