Commit Graph

1984 Commits

Author SHA1 Message Date
Xavier Delaruelle
5d9af77c3e install: configure/build/install lib from main scripts
Call configure script and Makefile of 'lib' directory from main
configure and Makefile to configure/build/install/clean libtclenvmodules
from top-level scripts.

Add '--libdir', '--enable-libtclenvmodules', '--with-tcl' and
'--with-tclinclude' options to main configure script to control
libtclenvmodules build and installation. Documentation of these new
options has been added to INSTALL guide.

When '--enable-libtclenvmodules' option is set (default) code in
modulecmd.tcl is enabled to load compiled libtclenvmodules shared
library.

Update RPM spec file to take into account libtclenvmodules.

Update Travis and AppVeyor configurations to check libtclenvmodules
enablement and disablement over the various test cases.
2019-04-29 16:02:13 +02:00
Xavier Delaruelle
babe58050c install: improve Makefile install/test target prereqs spec 2019-04-29 15:56:23 +02:00
Xavier Delaruelle
b7c399c19a Add autotools configs to build libtclenvmodules
Build this extension library against Tcl stub library to be able to
'load' it in modulecmd.tcl script.
2019-04-29 15:56:23 +02:00
Xavier Delaruelle
3c360a9937 Introduce Modules Tcl extension library
Introduce Modules Tcl extension library (written in C) to extend Tcl
language in order to provide more optimized I/O commands than native Tcl
commands do.

This library first provides a 'readFile' command which performs an open,
read, close of a given modulefile to fetch its content. Compared to the
Tcl native open, read, close commands it saves 1 ioctl + 1 fcntl + N
lstat system calls per modulefile.
2019-04-29 15:56:23 +02:00
Xavier Delaruelle
b9e42bd69f Introduce readFile proc to read a file
Adapt all procedures reading file (modulefile, shell init file,
collection file) to use the readFile procedure for that reading job.

This readFile command is defined as a Tcl procedure if not found defined
(by the load of the upcoming C extension).
2019-04-29 15:56:23 +02:00
Xavier Delaruelle
c79dde069d Always read full modfile on most module cmds
Except for path, paths, list, avail and aliases module commands always
fully read a modulefile whether its full content is needed or just its
header to verify its validity. Proceed this way to only read file once
on commands that first just check modulefile validity then read again
valid files to get their full content.

The path, paths, list, avail and aliases module commands are excluded
from this 'always read full modulefile' mechanism as they never need to
get the full modulefile content.

Most files found within modulepaths are intended to be modulefiles so
always reading full file content even for invalid modulefiles should not
harm much performances compared to the gain of reading every valid
modulefiles only once instead of two.
2019-04-29 15:56:23 +02:00
Xavier Delaruelle
5512300470 Cache modfile content read to minimize file ops
If modulefile is fully read, cache the content read and the file header
computed to avoid another file read if the same modulefile need to be
read multiple times.
2019-04-29 15:50:56 +02:00
Xavier Delaruelle
4999e90ea6 Call readModuleContent in checkValidModule proc
To read a modulefile so the code to read file and analyze its header to
check it is a valid modulefile is just written once.

readModuleContent procedure has been adapted to proceed like
checkValidModule did when it is called in a only_check_validity mode. In
this mode, only the first line of the file is read as we just want to
parse the header of the file (as it was done previously in
checkValidModule procedure).
2019-04-29 15:50:56 +02:00
Xavier Delaruelle
b24f4c5b27 doc: desc. Vim addons in NEWS and INSTALL 2019-04-29 14:44:26 +02:00
Xavier Delaruelle
3325b4dc02 appveyor/cirrus: test 'make uninstall' 2019-04-29 14:43:41 +02:00
Xavier Delaruelle
e7ac00c02d rpm: install modulefile vim syntax addons 2019-04-29 13:23:54 +02:00
Xavier Delaruelle
322700ac3c install: rename vim addons configure options
For disambiguation with Vim plugins and for letting room for further
improvements in this area, rename '--enable-vimplugin' configure option
into '--enable-vim-addons' and '--vimplugindir' into '--vimdatadir'.
2019-04-29 13:23:54 +02:00
Felix Neumärker
76a4d4ce71 add vim syntax support 2019-04-28 21:42:38 +02:00
Xavier Delaruelle
2b53c068da Release of version 4.2.4 v4.2.4 2019-04-26 10:28:28 +02:00
Xavier Delaruelle
9779a2e54d ts: correctly escape exp res in 50/{042,047,052,057,062,065} 2019-04-26 10:28:26 +02:00
Xavier Delaruelle
1fa094f619 doc: provide short install guideline in README
Fixes #230.
2019-04-25 21:11:32 +02:00
Xavier Delaruelle
32c6911f3e init: init MANPATH on zsh if empty to preserve man sysconfig
Zsh initializes by default the MANPATH environment variable to an empty
value when it starts. To preserve manpath system configuration even
after addition to this variable by modulefiles, set MANPATH variable to
':' if found empty.

Fixes #224.
2019-04-25 18:54:39 +02:00
Xavier Delaruelle
6a35699a6e ts: improve getDiffBetweenList proc test coverage 2019-04-25 18:54:27 +02:00
Xavier Delaruelle
84ed76fa4f Raise error when bad option passed to {append,prepend,remove}-path
Raise an error when an invalid option is set on append-path,
prepend-path or remove-path modulefile command.

Fixes #249.
2019-04-25 18:54:27 +02:00
Xavier Delaruelle
2420960471 Revert "appveyor: stop testing R in Cygwin platform"
This reverts commit 48624f9d11.

AppVeyor Cygwin environment has been updated, which fixed the R issue.

See appveyor/ci#2898.
2019-04-25 13:23:54 +02:00
Xavier Delaruelle
bde4a259ce Inhibit 'module load' in DepRe context
When reloading modules through the *Dependent Reload* automated
mechanism, disable the automated loading of modules by other modules with
the 'module load' modulefile command as done for the 'prereq' command.

It saves the mechanism from the reload of modules that have just been
unloaded (and asked by the user to be unloaded from instance when
performing a 'switch' command).

Fixes #265.
2019-04-25 13:23:17 +02:00
Xavier Delaruelle
eb6a1ab516 No req load suggestion msg as soon as one has been tried
Instead of requiring that all possibilities need be tried to consider
the requirement load or the conflict unload has been tried, consider it
tried as soon as one module choice has been evaluated.
2019-04-23 15:12:17 +02:00
Xavier Delaruelle
696eca7a7f Do not re-evaluate a failing module
Skip load or unload evaluation of a module whose respectively load or
unload was already attempted but failed. If this second evaluation
attempt occurs within the same main evaluation frame.

Fixes #264.
2019-04-23 15:07:15 +02:00
Xavier Delaruelle
22687ff942 Refactor eval context change for switch cmd in modfile 2019-04-23 09:13:27 +02:00
Xavier Delaruelle
c50e2ba7d3 No load attempt of already loaded mod in no-auto mode
When the automated module handling mode is disabled, do not attempt to
load a requirement expressed in a modulefile with a 'module load'
command, if this requirement is already loaded or loading.
2019-04-23 09:03:02 +02:00
Xavier Delaruelle
4ddddc41c4 Distinguish DepRe load/unload phases in msgs
Adapt warning, error and info messages relative to the Dependent Reload
mechanism to distinguish the unload phase from the load (reload) phase
of this mechanism. In the automated module handling summary report,
unloaded modules via this mechanism are reported in the *Unloading
dependent* list and modules reloaded afterward are reported against the
"Reloading dependent* list.

Fixes #263.
2019-04-23 09:03:02 +02:00
Xavier Delaruelle
34cac85fbb Correctly report loading state of conflicting module
Fixes #262.
2019-04-21 19:14:45 +02:00
Xavier Delaruelle
19e1169633 ts: test issue with prereq using alt name in 50/380 2019-04-21 19:13:53 +02:00
Xavier Delaruelle
13e37209e1 Resolve mod name passed to isModuleEvaluated
To check if actual module has been evaluated based on its aliased or
symbolic name.
2019-04-21 19:13:53 +02:00
Xavier Delaruelle
7d8163db30 Register modfile eval attempt in addition to modname
Helps to find a given module has been evaluated when a conflict/prereq
statement is sometimes done on the module name and other times on the
modulefile.
2019-04-21 19:13:53 +02:00
Xavier Delaruelle
64cc92a47f ts: adapt text msgs to fixed loaded conflict report 2019-04-21 19:13:53 +02:00
Xavier Delaruelle
f0b452a69e Report loaded conflict on corresp. module msg block
When loading a module, report any loaded conflict on the message
reporting block corresponding to this module load. This warning or error
message comes in addition to the eventual conflict unload message
reported under the message block of the main evaluation.

When a module load is forced and a conflict of this module is loaded,
report this conflict with the same concise message (no hint) whether an
unload of this conflicting module was attempted or not.

Fixes #261.
2019-04-21 19:14:34 +02:00
Xavier Delaruelle
27cd3865be Raise ConUn err/warn msg to top level message block
When a conflicting module is seen loaded but the unload of this module
was attempted, report a conflict unload error or warning message toward
the main evaluation message block.

Fixes #261.
2019-04-21 19:14:23 +02:00
Xavier Delaruelle
16ffc82cdb Refactor error raising code in conflict proc 2019-04-21 19:13:53 +02:00
Xavier Delaruelle
74edeb5506 Clearer error/warn msg when unloading a required mod
When unloading a module which has some dependent module still loaded,
produce a more specific error or warning message if an evaluation of
these dependent modules has been realized or if the unload of the
required module is forced.

Fixes #259.
2019-04-21 19:14:13 +02:00
Xavier Delaruelle
986dc31d5b Also register unload evaluation attempt
In addition to load evaluation attempt, also register the various unload
evaluation attempt to get a more appropriate warning or error message
regarding the missing requirement during a module load. When these
requirements are unloaded due to a conflict or a dependent unload/reload
mechanism, it seems better not to advise user to load this requirement
(as the dependency management system has unloaded it).
2019-04-21 19:13:53 +02:00
Xavier Delaruelle
2804c89160 Use distinctive context for main load and unload 2019-04-21 19:13:53 +02:00
Xavier Delaruelle
d5f5325c41 Same req missing warn msg in force mode whatever the auto mode
When a module load is forced and a requirement of this module is missing,
report this miss with the same concise message (no hint) whether a load
of this requirement was attempted or not.
2019-04-21 19:13:53 +02:00
Xavier Delaruelle
525af4080b Report missing req on corresponding module msg block
When loading a module, report any missing requirement on the message
reporting block corresponding to this module load. This warning or error
message comes in addition to the eventual requirement load message
reported under the message block of the main evaluation.

Fixes #258.
2019-04-21 19:14:03 +02:00
Xavier Delaruelle
8ca1523c0b Raise failed ReqLo msg to top level message block 2019-04-21 19:13:53 +02:00
Xavier Delaruelle
00ff4b08c2 More appropriate warn/err msg for failed ReqLo
When a module requirement is seen missing but the load of this module
was attempted, report a more specific error or warning message to let
user understand that the load of the requirement was attempted but
failed.

Thus distinction is made between missing requirements where a load
tentative was made and those were the no load attempt was performed
(when the automated module handling mode is disabled for instance).

Fixes #257.
2019-04-21 19:13:53 +02:00
Xavier Delaruelle
62111a5e6a Refactor cmdModule{Load,Unload} error catch code 2019-04-21 19:11:34 +02:00
Xavier Delaruelle
dbcf9a5411 Report failed {load,unload} of switched-{off,on} module
When switching modules, report failure of switched-off module unload or
switched-on module load under the message block of the switch action. A
failed switched-off module unload is reported as an error, as it aborts
the switch evaluation, whereas a failed switched-on module load is
reported as a warning.

Fixes #255.
2019-04-21 19:12:25 +02:00
Xavier Delaruelle
f177f3682b Rely on cmdModuleUnload error catch mech for prereq report
When attempting to unload a module, if this module has dependent loaded
it cannot be unloaded if auto_handling mode is disabled. Treat that
situation through the cmdModuleUnload error catch rather just with a
reportError call.

In case this situation happens through a 'module unload' command in a
modulefile evaluated in load mode, no error return code should be set.
However in other situations, cmdModuleUnload command should return an
error code.

So this change fixes 'switch' sub-command when the switched-off module
cannot be unloaded as it has some dependent module loaded. Now it fails
the whole switch process and no load of the switched-on module is not
tried.

Fixes #251.
2019-04-21 19:12:09 +02:00
Xavier Delaruelle
1c27cb7475 Rely on cmdModuleLoad error catch mech for conflict report 2019-04-21 19:11:34 +02:00
Xavier Delaruelle
1517c915af Move 'module switch' deps set in cmdModuleSwitch
Used for 'module switch' commands is set in modulefile. In order to get
finer control on the dependency definition and error report when the
unload of the switched-off module or the load of the switched-on module
fail.
2019-04-21 19:11:34 +02:00
Xavier Delaruelle
2c3d2d74d8 Drop output of failed ReqLo eval if one succeed
When multiple modules are listed on a prereq command, drop the output of
those modules that fails to load (by the requirement load automated
mechanism) to only keep the output of the module whose load succeed.

Introduces procedures and variables to hold reports until all
requirement choices are tried to be loaded, then release held output
(drop or print). Exception is made for debug output which is always
immediately printed.

Fixes #254.
2019-04-21 19:12:00 +02:00
Xavier Delaruelle
e07887bfcc ts: clarify comment on no-auto urequn report in 50/376 2019-04-21 19:11:34 +02:00
Xavier Delaruelle
a5145a921f Warn if useless requirement unload fails on no-auto mode
During the unload of a module when the automated module handling mode is
disabled, report a warning message foreach unload of a useless
requirement that fails as done when the automated module handling mode
is enabled.

Fixes #253.
2019-04-21 19:11:50 +02:00
Xavier Delaruelle
e8d429d393 Remove useless priorlmlist var from cmdModule{Load,Unload} 2019-04-21 19:11:34 +02:00