Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The lmod package should depend_on('tcl') #1263

Merged
merged 4 commits into from
Jul 21, 2016

Conversation

hartzell
Copy link
Contributor

@hartzell hartzell commented Jul 15, 2016

The lmod package needs a tclsh. Up until now it just assumed
that one was available on the system.

This change adds a depends_on('tcl') to the lmod package.

The tcl package installs a tclsh script with an embedded version
number (e.g. tclsh8.6) but the lmod configuration looks for tclsh.
This change extends the tcl package to symlink tclshX.Y to tclsh in
the tcl package bin directory.

Closes #1257.

@davydden
Copy link
Member

please change See #1257 to fixes #1257, see https://github.com/blog/1506-closing-issues-via-pull-requests

@adamjstewart
Copy link
Member

@davydden Ooh, didn't know this. Neat!

@hartzell
Copy link
Contributor Author

@davydden -- done.

@hartzell
Copy link
Contributor Author

Whoops, there's a bit more work here. The resulting environment module should require/load (I need to catch up on spack-isms) the tcl module, else you run into:

[throgg@flaky spack]$ module load py-flake8-2.5.4-gcc-4.8.5-ikinxm4ue3ecglynj7kpweu3knnzonnh
/usr/bin/env: tclsh: No such file or directory
Lmod has detected the following error:  Unable to load module:
py-flake8-2.5.4-gcc-4.8.5-ikinxm4ue3ecglynj7kpweu3knnzonnh
[...]

I've scanned past the discussions about enabling packages to specify contents in the environment/dot-kit grommets. I'll dig into it (this is a good intro!).

@davydden
Copy link
Member

@hartzell i would say you need to change dependency type from default ('build','link') to nolink which is same as ('build','run'). To that end, add , type=nolink to depends_on.

@hartzell
Copy link
Contributor Author

whoops.

I'd added the tcl bin to my PATH by hand, so I didn't really test the @davydden suggested change appropriately.

If I log out, log in, source the modules init file

opt/spack/linux-centos7-x86_64/gcc-4.8.5/lmod-6.4.1-ealu5lnvl3tmngkkadckhice7tms3aka/lmod/6.4.1/init/bash

I end up with back at:

[throgg@flaky spack]$ module load lmod-6.4.1-gcc-4.8.5-ealu5lnvl3tmngkkadckhice7tms3aka
/usr/bin/env: tclsh: No such file or directory

There are two problems:

  1. I don't see anything in the generated modulefile that would cause the tcl modulefile to be loaded (what happens for type=nolink depends_on anyway?).

  2. I actually have a bootstrapping problem here. I can't use the module command to set up the module command, sourcing the init scripts as provided won't work. The bash scripts hardcodes the path to the appropriate lmod command, but there's no hook to set up the environment.

    It might be The Right Thing if lmod's configure script embedded the path to the tclsh that it discovered.

@davydden
Copy link
Member

try spack module refresh to see if it changes anything. Whether or not run dependency actually works i don't know, because the PR with different dependencies types was just merged and currently broke a few things.

@hartzell
Copy link
Contributor Author

That wasn't very satisfying, but it might be because I'm trying to use spack to bootstrap a module system installed by spack...

[throgg@flaky spack]$ ./bin/spack module refresh
==> Regenerating tcl module files.
Traceback (most recent call last):
  File "./bin/spack", line 179, in <module>
    main()
  File "./bin/spack", line 157, in main
    return_val = command(parser, args)
  File "/home/throgg/foo/spack/lib/spack/spack/cmd/module.py", line 154, in module
    module_refresh()
  File "/home/throgg/foo/spack/lib/spack/spack/cmd/module.py", line 145, in module_refresh
    if os.path.isdir(cls.path):
AttributeError: type object 'TclModule' has no attribute 'path'
[throgg@flaky spack]$

@hartzell
Copy link
Contributor Author

I've rebased this onto the current develop.

The lmod package needs a tclsh.  Up until now it just assumed
that one was available on the system.

This change adds a depends_on('tcl') to the lmod package.

The tcl package installs a tclsh script with an embedded version
number (e.g. tclsh8.6) but the lmod configuration looks for tclsh.
This change extends the tcl package to symlink tclshX.Y to tclsh in
the tcl package bin directory.
lmod uses tclsh at runtime, so adjust the depends_on accordingly
(thanks @davydden!).
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).
@hartzell
Copy link
Contributor Author

hartzell commented Jul 21, 2016

I fixed the problem with the tcl scripts being unable to find tclsh by adding bits that rewrite the #! lines in the tcl scripts to use the tclsh discovered by the configure script.

I've also rebased onto the current tip of develop.

I've submitted similar changes upstream: TACC/Lmod#150.

@hartzell
Copy link
Contributor Author

This now Works For Me(tm). I'd appreciate feedback. Thanks!

@tgamblin tgamblin merged commit 4707362 into spack:develop Jul 21, 2016
@hartzell hartzell deleted the lmod-needs-tcl branch July 22, 2016 17:06
@hartzell hartzell mentioned this pull request Jul 25, 2016
olupton pushed a commit to olupton/spack that referenced this pull request Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants