On Mon, 22 Apr 2002, Edward Arthur wrote:
> /home/installs/modules-3.1.6/utility.c:764: the use of `tempnam' is
> dangerous, better use `mkstemp'
I'd like to second this one -- I see these warnings as well.
> Also, I've never made an RPM but I might volunteer to make one for
> modules (just to learn). if there is any interest. Let me know...
Note that building an RPM for modules is not a simple thing. :-(
I recently made a modules RPM for the OSCAR cluster project
(http://oscar.sourceforge.net/). The next major version of OSCAR will be
using modules as a back-end solution for user environment manipulation.
There's a thin front end called "switcher" that makes persistent changes
to the user's dot files and uses modules on the back end to actually make
all the environment changes.
The "switcher" project is at SourceForge, and although I just populated it
last night (i.e., it's still somewhat rough -- we had been using a private
CVS tree before migrating it to SourceForge), the modules specfile and
script that we use to build it is available in CVS.
See http://env-switcher.sourceforge.net/
-----
The spec file that we made for the modules RPM is definitely OSCAR-ized,
but could probably be genericized fairly easily (just remove some of the
post-processing that we do at the end). However, when making a modules
RPM, some decisions will definitely have to be made (where to put
modulefiles, etc.). It's somewhat easier since you can make certain
assumptions since you know this will only be on Linux, but that doesn't
solve all the problems.
I am certainly no RPM expert, but here are some of the difficulties that
we ran into, as well as some of the choices that we made when making the
OSCAR-ized modules RPM:
- modules does not support a "DESTDIR" kind of install. This makes it
impossible to install modules into somewhere other than $prefix. This is
a common trick for building RPMs -- you ./configure the package with a
prefix of /usr, but then install it into /var/tmp/rpm-build.$$/$prefix so
that it's easy to bundle up all the files that are installed from that
package into the RPM.
Since modules doesn't support DESTDIR installs, we have to install into
the "real" location where modules is supposed to go. If you're building
the RPM on a machine where a previous version of the modules RPM is
installed, you have to move the previous version out of the way before you
can install the new one that you are building. Icky.
I posted to this list about this issue a few weeks ago; converting modules
to use automake is only solution that would solve this problem nicely. I
haven't looked at the modules configure/build system closely, though -- I
don't know how much effort this would take.
- You have to pick where the modulefiles will be installed. We chose
/opt/modules/modulefiles -- it seems to be acceptable for the linux FSB,
but others may have religious feelings about where to install them.
- Currently flavors of "man" on linux have the annoying behavior that if
MANPATH is not set, /etc/man.config is used to determine which directories
should be used to find man pages. If MANPATH is set, then /etc/man.config
is not used. Hence, MANPATH needs to be loaded with all the directories
from /etc/man.config if any module adds even a single directory to
MANPATH.
We didn't really solve this problem, but it's on our to-do list. :-(
- We chose not to use all the defaults that are in the skel files from the
modules distribution with respect to setting variables such as
LD_LIBRARY_PATH, etc. Most linux distros are setup (by default) to not
need any of these variables, and therefore leaving them blank (undefined)
is acceptable (and preferable).
- Recent Linux distros (well, Mandrake and RedHat) have a convenient
mechanism that seemily makes a bunch of things easier: the /etc/profile.d
directory. If you put scripts in there, they will be run during
shell-setup phases. So we created /etc/profile.d/00-modules.sh and
/etc/profile.d/00-modules.csh files that do all the setup necessary for
modules.
This didn't turn out to be quite the perfect solution that we thought it
would be -- there were some cases where the 00-modules scripts didn't seem
to get run, and therefore modules didn't get setup properly. See the next
item.
- Recent Linux distros (well, Mandrake and RedHat) take pains to run as
few shell setup files as possible when running non-interactive remote
shells. For example:
rsh somehost who
On the machine "somehost", /etc/bashrc (for bash-flavored shells) and
/etc/csh.cshrc (for csh-flavored shells) is configured to *not* run all
the scripts in /etc/profile.d in this situation (csh splits it into
csh.login [per-login] and csh.cshrc [per-shell]. The profile.d scripts
are only run in csh.login, but rsh/ssh doesn't treat this case as a login
shell, so csh.login does not run). This created massive difficulty for us
(because one of the main reasons for OSCAR clusters is for cluster
parallelism -- running jobs on multiple nodes simultaneously).
We finally ended up appending /etc/bashrc and /etc/csh.cshrc to manually
source the appropriate 00-modules file if it hadn't already been sourced.
Icky, but effective.
- As a second side effect of this behavior, we had to combine the
once-per-login modules setup and every-shell modules setup into the single
00-modules file. There's environment variable protection such that the
once-per-login behavior should actually only happen once per login, but
it's still somewhat icky.
- Finally, we had to address the "su problem". For example, I happen to
prefer the shell tcsh. If I'm logged in as user "jsquyres" happily using
tcsh and then I su over to root (who uses bash as a default shell), then
the once-per-login modules setup stuff will be all wrong and root won't
have modules setup properly.
So we had to add some more environment variable protection to 00-modules
to ensure that the once-per-login setup stuff runs: a) during login, or b)
when the shell changes.
-----
The contents of http://env-switcher.sourceforge.com/ are still fairly
rough, but they'll be filled out soon -- it's an evolving and continuing
work.
I'd appreciate the comments and feedback from the general modules
community.
{+} Jeff Squyres
{+} jsq...@la...
{+} http://www.lam-mpi.org/
|