Commit Graph

60 Commits

Author SHA1 Message Date
Xavier Delaruelle
37b46a3778 init: use 'sed -r' if 'sed -E' not supported
`-E` option is a *relatively* recent option of GNU sed (v4.2), yet
mandatory for OS portability (as detailled in b68e44e).

Adapt configure step to detect if sed option `-E` is supported and
fallback to `-r` otherwise.

Fixes #317
2020-02-22 13:04:04 +01:00
Xavier Delaruelle
089a680263 install: add dist-win rule to build win-specific dist zip ball 2020-01-17 21:39:22 +01:00
Xavier Delaruelle
2d64c275f6 init: move windows/moduleinit.cmd as init/cmd.cmd file 2020-01-14 06:13:30 +01:00
Xavier Delaruelle
4919ae356e init: ensure ml is defined in bash/ksh subshells 2020-01-09 20:38:50 +01:00
Xavier Delaruelle
1365a88cd4 install: add --with-initconf-in configure opt
Introduce the ability to install the Modules initialization
configuration files in the ``etcdir`` rather than in the ``initdir``. A
new configure option is introduced for this task:
``--with-initconf-in``. Accepted values for this option are: ``etcdir``
or ``initdir`` (default).
2019-07-10 13:44:48 +02:00
Xavier Delaruelle
8fa93a271d install: add --enable-quarantine-support configure opt
Add the ability to control whether or not code to support quarantine
mechanism should be added to the module function and initialization
scripts. Enabled by default

Fixes #167
2018-09-05 06:02:43 +02:00
Xavier Delaruelle
f700e055d4 install: add --enable-silent-shell-debug-support configure opt
Add the ability to control whether or not code to support silent shell
debug should be added to the module function and sh-kind initialization
scripts. Enabled by default

Fixes #166
2018-09-03 07:43:50 +02:00
Xavier Delaruelle
9df232de14 install: add --enable-append-{bin,man}path configure opts
Add the ability to append rather prepend the man or bin directory when
adding these directory to the relative environment variable is enabled
(with --enable-set-manpath or --enable-set-binpath).

Takes the form of 2 new configure options: --enable-append-manpath and
--enable-append-binpath. No effect if set but relative
--enable-set-{bin,man}path option is unset or disabled.
2018-05-03 07:09:11 +02:00
Xavier Delaruelle
13c169a27c install: workaround Linux+Make 3.81 '\\\n' issue
Was affecting tests on Ubuntu Trusty
2018-02-14 08:18:22 +01:00
Xavier Delaruelle
bec3f92304 install: more portable \n to build init/modulerc
That also works on OS X.
2018-02-13 07:52:25 +01:00
Xavier Delaruelle
5ce6488909 install: portable newline echo in Makefile 2018-02-01 20:11:16 +01:00
Xavier Delaruelle
0e9aa2b774 install: check rmdir '--ignore-fail-on-non-empty' exists 2018-02-01 19:46:34 +01:00
Xavier Delaruelle
300910d93e install: fix multi modulepath build in init/modulerc 2018-02-01 18:53:25 +01:00
Xavier Delaruelle
0c2d588293 install: define a portable \n to build init/modulerc 2018-02-01 18:53:25 +01:00
Xavier Delaruelle
170d88b5d9 install/init: use MANPATH if manpath cmd not there 2018-02-01 18:53:25 +01:00
Xavier Delaruelle
806aa278e0 install: portable symlink copy with '-R -P'
Make symlink copy portable with 'cp -R -P' (to support SunOS)
2018-01-25 06:22:14 +01:00
Xavier Delaruelle
b91637c03a install: 'cp --remove-destination' is not portable
Adapt 'cp --remove-destination' into rm + cp commands as the
--remove-destination is not understood everywhere (not known on SunOS
for instance).
2018-01-25 05:48:41 +01:00
Xavier Delaruelle
745803c57f install: get 'ps' and 'basename' loc in configure
Check paths in configure script to detect the location of the 'ps' and
'basename' commands. Then use this found location in profile.sh scripts.

First part of #147 is solved here.
2018-01-24 07:47:13 +01:00
Xavier Delaruelle
2441251ef1 install: add @VERSION@ pattern
Introduce the '@VERSION@' pattern, combination of Modules release and
build information, for building files to install.

Still rely on @MODULES_RELEASE@ and @MODULES_BUILD@ when these
information are needed prior to ./configure call (dist-related stuff) or
are expected to change after ./configure call (modulecmd.tcl in
dev environment).
2017-12-29 18:55:35 +01:00
Xavier Delaruelle
6b81b8a185 install: adapt default modpath if versioning set
If --enable-versioning configure option is set, default modulepath option
is changed  from '$prefix/modulefiles' to
'$baseprefix/$MODULE_VERSION/modulefiles'.

Adapt installation process to handle modulepath containing special '$'
character. Adapt also install testsuite to correctly check these
modulepaths containing variable references.
2017-12-28 21:42:25 +01:00
Xavier Delaruelle
dbd86817c7 install: deploy MODULE_VERSION and version modfile
When --enable-versioning is set at configure time, deploy the setup of
the MODULE_VERSION and MODULE_VERSION_STACK environment variables in
modulecmd.tcl and in a version-specific modulefile.

This version-specific modulefile is deployed in a @baseprefix@/versions
modulepath directory, which is also created specifically for versioning
installation mode.

MODULE_VERSION and MODULE_VERSION_STACK environment variables setup in
modulecmd.tcl is commented if versioning installation mode is not
enabled rather deleted to guaranty consistency across code coverage
tests (same code line numbering whatever the installation options set).

version-specific modulefile is a bit different than the one used before
<4.0 as now module version is initialized when loading this module by
calling the autoinit action on the modulecmd.tcl script.

These version-specific modulefiles enable to switch from one module
version to another but there is an incompatibility of initialization
between Modules 3.2 and Modules >=4. Switching from Modules 3.2 to
Modules >4 will be possible, but not going back from >4 to version 3.2.
2017-12-28 21:42:25 +01:00
Xavier Delaruelle
b9fe7bbb17 testsuite/travis: fix testconfig removal of etcdir 2017-12-24 12:18:02 +01:00
Xavier Delaruelle
a7993020ab testsuite/travis: add an example siteconfig.tcl
Add 'install-testsiteconfig' make target to setup a dummy siteconfig.tcl
file in install_etcdir. Link that to some of the travis checks to run
testsuite with an existing siteconfig.tcl
2017-12-23 18:22:20 +01:00
Xavier Delaruelle
353b9d662c Introduce @etcdir@/siteconfig.tcl script
Add the possibility to setup a site-specific configuration Tcl script
which will be sourced at the start of modulecmd.tcl. This site-specific
Tcl script enables to supersede global variable and procedure definition
made in modulecmd.tcl. This way local adaptations can be made without
editing the modulecmd.tcl script.

'--etcdir' configure option is added to specify the location of the
site-specific configuration script.
2017-12-23 18:22:20 +01:00
Xavier Delaruelle
a3ada7c7cd @prefix@/etc/rc does not depend on MODULESHOME anymore
Avoid dependency to the MODULESHOME environment variable when looking
for the etc/rc global RC file. To define an environment dynamic global RC
file the MODULERCFILE variable may be used. By not relying on an
environment variable we ensure this etc/rc will always be read, if it
exists, whatever the current environment state.

Location of this etc/rc is based on @prefix@ defined at configure time
which is also the basis for the MODULESHOME value, so this change should
not have an impact if MODULESHOME variable were not manipulated
afterward.

This change is useful when using module through commands resetting the
environment like 'sudo' (see RH#1443124, RH#1139165 [1])

module.1 man page is already mentionning @prefix@/etc/rc, no change
needed there.

Adapt testsuite to provide a way to test the use of a @prefix@/etc/rc
file for the whole 'make test' duration, with 'make install-testetcrc'.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1139165
2017-12-13 07:32:51 +01:00
Xavier Delaruelle
d918ee6d86 install: add --with-quarantine-vars
Add --with-quarantine-vars configure option to define quarantine
mechanism configuration at build time.

Value passed to the configure option will be used by Makefile to
initialize in the various initialization scripts the
MODULES_RUN_QUARANTINE variable and eventual MODULES_RUNENV_<VAR>.
2017-11-12 16:56:40 +01:00
Xavier Delaruelle
29fb374116 install: fix use of ifeq/wildcard in Makefile
Prefer 'rmdir --ignore-fail-on-non-empty' which is evaluated at runtime.
ifeq is evaluated at Makefile read.
2017-11-01 17:42:52 +01:00
Xavier Delaruelle
1416a523cd testsuite/travis: rework tests with ex. init config
Use make for test config setup rather direct commands in travis
configuration.
2017-10-25 16:29:04 +02:00
Xavier Delaruelle
1dec5ed2eb install: skip initdir rmdir if not empty on uninstall 2017-10-23 22:35:27 +02:00
Xavier Delaruelle
7de4c10bcc install: use sed rather perl for substitutions
Use sed instead of perl in configure and Makefile scripts as perl is not
required anymore to build documentation. sed is a lighter requirement to
build and install software.
2017-10-07 17:57:08 +02:00
Xavier Delaruelle
429215f9b7 install: handle version number through git tags
Introduce a version.inc file sourced by Makefiles, that holds release
number and build information. Makefiles use these information to set
correct version number in manpages and modulecmd.tcl script.

version.inc is present in dist tarball. This file is generated from
version.inc.in file by main Makefile when working in git repository.

Release information are retrieved from the tags of the git repository.
Release number corresponds to last git tag set. Build number is the
result of the 'git describe' command: this information helps to know
from what git branch and commit the current build is made of.
2017-09-30 21:47:26 +02:00
Xavier Delaruelle
8ec675c299 Release of version 4.0.0-beta
Adapt testsuite to take new release name in account.
2017-09-25 18:23:48 +02:00
Xavier Delaruelle
ab2de00dc8 init: fix and normalize fish_completion
* remove incorrect references to apt-get
* use space instead of tabs
* normalize description messages reusing short sentences already made
  for zsh completion
* fix function to filter module command output and only return
  modulefile list not mixed with files
* simplify install process by removing need for a '.in' file (and fix
  bash_completion install on the way)
2017-09-22 21:30:47 +02:00
BEFH
e833ab2b74 fish_completion
Created an initial fish_completion script and added to Makefile.
2017-09-22 08:12:36 +02:00
Xavier Delaruelle
8594a029cf install: add 'modules' modfile to example modfiles 2017-09-15 06:16:42 +02:00
Xavier Delaruelle
b4401a0061 init: add profile scripts enabling compat vers by default 2017-09-13 06:30:27 +02:00
Xavier Delaruelle
34273d4956 install: remove any preexisting ksh-functions switchml
In case we reinstall with this time C version installation disabled.
2017-09-13 06:30:27 +02:00
Xavier Delaruelle
fc5674846c init: adapt scripts to --enable-compat-version build
Introduce MODULE_USE_COMPAT_VERSION environment variable to control the
activation of the compatibility version rather main version in case of
--enable-compat-version installation.

The initialization script of the shells supporting compatibility version
are adapted to define the 'module' command based on the modulecmd-compat
binary if MODULE_USE_COMPAT_VERSION is set to 1. Elsewhere module is
based on modulecmd.tcl.

'switchml' function of alias is reintroduced to switch between main and
compatibility version based on the state of the
MODULE_USE_COMPAT_VERSION environment variable.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-09-13 06:30:19 +02:00
Xavier Delaruelle
1cdae156ff install: --enable-compat-version to build compat vers
Introduce '--enable-compat-version' configure argument to configure and
build compatibility (C) version in addition to main version.

This compatibility version is located in the 'compat' directory, which
is automatically populated with 'c-master' git branch if we work in the
git repository.

'configure' script is adapted to run the compatibility version relative
configure script. Unknown command-line arguments are passed down to this
script, which raise error if these arguments are not known there either.
Some compatibility version configure script argument are also
incompatible in this dual installation mode, so an error is raised
(--enable-versioning for instance).

Build process will generate and install modulecmd-compat, module-compat.1
and modulefile-compat.4 from this compatibility version. 'compat' suffix
enables clear distinction with main version files.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-09-13 06:12:49 +02:00
Xavier Delaruelle
d6b87dfe26 install: remove features linking to external C version
Remove the --enable-set-switchml, --enable-use-cver-dotmodulespath,
--with-cver-initdir, --with-cver-bindir and --with-cver-mandir configure
option that previously enabled to link Modules-Tcl installation to an
external Modules-C installation.

This change is an initial step toward a bundled installation of Tcl/C
versions, so the external linking support will transform into a dual
flavor installation.
2017-09-06 07:28:37 +02:00
Xavier Delaruelle
9006a3baab install: avoid make to rebuild Makefile.inc 2017-09-03 15:56:08 +02:00
Xavier Delaruelle
b6d4404153 install: fix Makefile generation flaws
Generate a shared 'Makefile.inc' file rather all 'Makefile's at
configure time. Avoid init/Makefile being rebuilt by initscript '%.in'
rules.

Correct 'all' rule typo in doc/Makefile.

Enforce '.modulespath' symlink creation when usecverdotmodulespath is
enabled.
2017-08-11 23:13:05 +02:00
Xavier Delaruelle
b47c4407fe install: introduce a 'configure' step
Add a 'configure' shell script to generate Makefiles, rather than
choosing installtion directories or enabled features a the 'make' step.
By doing so, installation process is clearer and closer to build
conventions.

Use a custom 'configure' shell script rather than using autoconf and
automake tool suites in order to keep good readability of Makefiles.
Moreover our build use case is relatively small since nothing is
complied so there is no real benefit of using autoconf/automake.

Adapt Makefiles to this 'configure' change and add 'distclean' target.
2017-03-06 06:09:15 +01:00
Xavier Delaruelle
fb9d286196 init: add make option to bind on C ver .modulespath
Add the 'usecverdotmodulespath' make argument to generate
init/.modulespath config file as a symlink on C version installed
.modulespath configuration (by doing so both C and Tcl versions
installed on the same environment can share the same MODULEPATH
initialization setup).

'cverinitdir' must be known for 'usecverdotmodulespath' to be taken in
account.
2017-03-06 06:09:15 +01:00
Xavier Delaruelle
3293765e2e init: define switchml tool in shell init scripts
Introduce 'switchml' tool, a shell function (or alias for csh or tcsh
shells) that swap currently enabled Modules version (C or Tcl) by the
other version (C or Tcl).

In case a swapped version was defining specific PATH or MANPATH entries,
these specific entries are removed when switching to the other version
to avoid still relying on the binaries and man pages of the swapped-out
version.
2017-03-06 06:09:15 +01:00
Xavier Delaruelle
e4398d4c4d install: add an 'uninstall' make target 2017-03-06 06:09:15 +01:00
Xavier Delaruelle
6fa0b5d950 init: generate modulerc and .modulespath configs
Add makefile rules to generate the modulerc and .modulespath
configuration files. modulerc is generated in any case. By default it
hosts the MODULEPATH and LOADEDMODULES definition passed to the Makefile
with the 'modulepath' and 'loadedmodules' argument.

The 'setdotmodulespath' Makefile argument is also introduced. When set
to 'y', the .modulespath is generated and hosts the MODULEPATH
definition. In this case, modulerc config file only gets the
LOADEDMODULES definition or is set empty if no value is passed to the
'loadedmodules' argument.
2017-03-06 06:09:14 +01:00
Xavier Delaruelle
a8207ff45f install: add modulefilesdir configuration option
@modulefilesdir@ enables to set the default system-wide modulefiles
directory as described in module.1 man page.
2017-03-06 06:09:14 +01:00
Xavier Delaruelle
95984d243f init: set PATH and MANPATH in shell init scripts
Add the possibility to set PATH and MANPATH in shell init scripts
(sh-like, csh-like and fish scripts) if specific option are enabled in
makefile (enabled by default). With this, bin directory and man
directory of the modules-tcl installation are prepended to the MANPATH
and PATH environment variables.

Prepending is required for PATH as manpath utility in its default Linux
setup will automatically set MANPATH from PATH change, so if we want
MANPATH to be prepended, PATH has to be prepended.
2017-03-06 06:09:08 +01:00
Xavier Delaruelle
99668416d8 Introduce an installation process
Introduce an 'install' target in makefiles to provide an installation
process for modules-tcl.

Defines installation paths with Makefile variables in order to avoid
having a ./configure step. Install paths are set during the 'make' step
by passing 'prefix', 'libexecdir', 'mandir', etc arguments to the make
command. If no path definitions are passed to the 'make' command,
installation will be made in '/usr/local/modules-tcl' by default.

Installation paths provided (or set from the default value found in
Makefile) are saved at the 'make' step in a .makeinstallpath file. Then
at the 'make install' step, this .makeinstallpath file is read and make
knows where to install modules-tcl.

These paths definitions are also used to translate *.in init script to
their installed version.

modulecmd.tcl script is by default set to be installed in the libexec
directory to follow FHS specification (as this script is an executable
but not directly accessed by users).
2017-03-06 05:32:37 +01:00