diff --git a/.gitignore b/.gitignore index 29aa128..c7ed957 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp *~ +Downloads diff --git a/config/pmodules_version.conf b/config/pmodules_version.conf index 9908d11..4bae2f8 100644 --- a/config/pmodules_version.conf +++ b/config/pmodules_version.conf @@ -1,2 +1,2 @@ -PMODULES_VERSION=0.99.0 -MODULES_VERSION=3.2.10 +declare -x PMODULES_VERSION=0.99.1 +declare -x MODULES_VERSION=3.2.10 diff --git a/config/versions.conf b/config/versions.conf index 08f4ec8..ba4e044 100644 --- a/config/versions.conf +++ b/config/versions.conf @@ -1,7 +1,7 @@ autoconf 2.69 automake 1.14 bash 4.3.30 -boost 1.55.0 +boost 1.57.0 BoxLib 2014-02-28 cmake 2.8.12.2 dialog 1.2.1 @@ -17,8 +17,8 @@ fsstress 1.0.0 h5hut_serial 1.99.13 H5hut 1.99.13 H5root 1.2.0 -hdf5_serial 1.8.12 -hdf5 1.8.12 +hdf5_serial 1.8.14 +hdf5 1.8.14 ippl 1.1.3 libtool 2.4.2 libungif 4.1.4 @@ -36,11 +36,11 @@ OpenBLAS_OMP 0.2.9 parmetis 3.2.0 patchelf 0.8.1 Python 3.4.0 -root 5.34.19 +root 5.34.26 SuperLU 4.3 SuperLU_DIST 3.3 Tcl 8.6.3 tiff 4.0.3 -trilinos 11.10.2 +trilinos 11.12.1 UMFPACK 5.6.2 vtk 5.10.1 diff --git a/lib/libem.bash b/lib/libem.bash index c4d15e4..51e741e 100644 --- a/lib/libem.bash +++ b/lib/libem.bash @@ -25,6 +25,8 @@ declare -xr BUILD_TMPDIR="${BUILD_BASEDIR}/tmp" declare -xr BUILD_DOWNLOADSDIR="${BUILD_BASEDIR}/Downloads" declare -xr BUILD_VERSIONSFILE="${BUILD_CONFIGDIR}/versions.conf" +declare -xr PSI_TEMPLATES_DIR='templates' + if [[ -z "${BUILD_CONFIGDIR}/families.d/"*.conf ]]; then die 1 "Default family configuration not set in ${BUILD_CONFIGDIR}/families.d" fi @@ -151,26 +153,27 @@ fi # while bootstraping the module command is not yet available if [[ ${bootstrap} == no ]]; then - source "${PSI_PREFIX}/${PSI_CONFIG_DIR}/profile.bash" + source "${PSI_PREFIX}/${PSI_CONFIG_DIR}/profile.bash" + MODULECMD="${PMODULES_HOME}/bin/modulecmd" [[ -x ${MODULECMD} ]] || die 1 "${MODULECMD}: no such executable" module use unstable module purge fi -P=$(basename $0) -P=${P%.*} +P=$(basename $(dirname "${BUILDSCRIPT}")) _P=$(echo $P | tr [:lower:] [:upper:]) _P=${_P//-/_} _V=${_P}_VERSION eval "${ENVIRONMENT_ARGS}" -if [[ ${PSI_RELEASES_CONF} ]] && [[ -r "${PSI_PREFIX}/${PSI_RELEASES_CONF}" ]]; then - declare -r releases=:$(< "${PSI_PREFIX}/${PSI_RELEASES_CONF}"): +if [[ -n ${PSI_RELEASES} ]]; then + declare -r releases="${PSI_RELEASES}" else # set defaults, if file doesn't exist or isn't readable declare -r releases=":unstable:stable:deprecated:" fi + is_release () { [[ ${releases} =~ :$1: ]] } @@ -192,7 +195,7 @@ function em.add_to_family() { if [[ -z ${1} ]]; then die 42 "${FUNCNAME}: Missing family argument." fi - if [[ ! -d ${PSI_PREFIX}/${PSI_CONFIG_DIR}/${1} ]]; then + if [[ ! -d ${PSI_PREFIX}/${PSI_MODULES_ROOT}/${1} ]]; then die 43 "${1}: family does not exist." fi MODULE_FAMILY=$1 @@ -219,8 +222,14 @@ function module_is_available() { } function _load_build_dependencies() { + # :FIXME: merge this two loops, load only modules which are required + # this merge is not as easy as it looks like at a first glance! for m in "${with_modules[@]}"; do - module load "${m}" + if module_is_available "$m"; then + module load "${m}" + else + die 44 "$m: module not available!" + fi done for m in "${MODULE_BUILD_DEPENDENCIES[@]}"; do [[ -z $m ]] && continue @@ -273,7 +282,7 @@ function _load_build_dependencies() { esac shift done - "${BUILD_SCRIPTSDIR}/${m/\/*}.build" ${args[@]} + "${BUILD_SCRIPTSDIR}"/*/"${m/\/*}/build" ${args[@]} if [[ -z $(module avail "$m" 2>&1) ]]; then die 1 "$m: oops: build failed..." fi @@ -530,7 +539,7 @@ if [[ ${bootstrap} == yes ]]; then MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V" MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V" MODULE_FAMILY='Tools' - MODULE_NAME="Pmodules/0.99.0" + MODULE_NAME="Pmodules/${PMODULES_VERSION}" # set PREFIX of module PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_NAME}" @@ -617,7 +626,7 @@ function _set_link() { local x IFS='/' x=( ${dir_name/${PSI_PREFIX}\/${PSI_MODULES_ROOT}\/} ) local n=${#x[@]} - local -r _target="../"$(eval printf "../%.s" {1..${n}})${PSI_CONFIG_DIR##*/}/"${MODULE_FAMILY}/${P}/modulefile" + local -r _target="../"$(eval printf "../%.s" {1..${n}})${PSI_TEMPLATES_DIR##*/}/"${MODULE_FAMILY}/${P}/modulefile" ln -fs "${_target}" "${MODULE_NAME##*/}" ) fi diff --git a/scripts/Bootstrap/.gitignore b/scripts/Bootstrap/.gitignore new file mode 100644 index 0000000..6be134e --- /dev/null +++ b/scripts/Bootstrap/.gitignore @@ -0,0 +1 @@ +modulecmd diff --git a/scripts/Bootstrap/bash b/scripts/Bootstrap/bash index 08a45cc..c5085bb 100644 --- a/scripts/Bootstrap/bash +++ b/scripts/Bootstrap/bash @@ -1,18 +1,16 @@ #!/bin/bash +############################################################################# +# bash 3 or newer ... +# if [ ${BASH_VERSINFO:-0} -lt 3 ]; then echo "BASH version ${BASH_VERSION} ist not supported! You need at least version 3..." return fi -if [ "${LOADEDMODULES:-}" = "" ]; then - declare -x LOADEDMODULES= -fi - -if [[ -r "${PSI_BASH_COMPLETION}" ]]; then - source "${PSI_BASH_COMPLETION}" -fi - +############################################################################# +# implement module comand as function +# module() { local -r modulecmd="${PMODULES_HOME}/bin/modulecmd" @@ -63,6 +61,72 @@ module() { } export -f module +############################################################################# +# helper functions +# +append_path () { + local -r P=$1 + local -r d=$2 + + if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then + if [[ -z ${!P} ]]; then + eval $P=${d} + else + eval $P="${!P}:${d}" + fi + fi +} + +prepend_path () { + local -r P=$1 + local -r d=$2 + + if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then + if [[ -z ${!P} ]]; then + eval $P=${d} + else + eval $P="${d}:${!P}" + fi + fi +} + +############################################################################# +# setup environment +# +if [[ -z ${LOADEDMODULES} ]]; then + declare -x LOADEDMODULES='' +fi + +if [[ -z ${MODULEPATH} ]]; then + declare -x MODULEPATH='' +fi + +if [[ -z ${PSI_LOADEDFAMILIES} ]]; then + declare -x PSI_LOADEDFAMILIES='' +fi +for f in ${PSI_DEFAULT_FAMILIES}; do + append_path MODULEPATH "${PSI_PREFIX}/${PSI_MODULES_ROOT}/$f" + append_path PSI_LOADEDFAMILIES "${f}" +done + +append_path PATH "${PMODULES_HOME}/bin" +append_path MANPATH "${PMODULES_HOME}/share/man" + +############################################################################# +# initialize bash completion +# +if [[ -r "${PMODULES_HOME}/init/bash_completion" ]]; then + source "${PMODULES_HOME}/init/bash_completion" +fi + +############################################################################# +# legacy... +# +declare -x MODULE_VERSION=${PMODULES_VERSION} +declare -x MODULE_VERSION_STACK="${PMODULE_VERSION}" +declare -x MODULESHOME="${PMODULES_HOME}" + + # Local Variables: # mode: sh # sh-basic-offset: 8 diff --git a/scripts/Bootstrap/bash.build b/scripts/Bootstrap/bash.build deleted file mode 120000 index aa482ca..0000000 --- a/scripts/Bootstrap/bash.build +++ /dev/null @@ -1 +0,0 @@ -../System/bash.build \ No newline at end of file diff --git a/scripts/Bootstrap/bash.build b/scripts/Bootstrap/bash.build new file mode 100755 index 0000000..122c5f9 --- /dev/null +++ b/scripts/Bootstrap/bash.build @@ -0,0 +1,13 @@ +#!/bin/bash + +source "$(dirname $0)/../../lib/libem.bash" + +function em.configure() { + "${MODULE_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +em.add_to_family 'System' +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/Bootstrap/bash_completion b/scripts/Bootstrap/bash_completion index 8b0acaa..76c789a 100644 --- a/scripts/Bootstrap/bash_completion +++ b/scripts/Bootstrap/bash_completion @@ -2,7 +2,7 @@ # Bash commandline completion (bash 3.0 and above) for Modules 3.2.10 # _module_avail() { - "${MODULESHOME}"/bin/modulecmd bash -t avail 2>&1 | sed ' + "${PMODULES_HOME}"/bin/modulecmd bash -t avail 2>&1 | sed ' /:$/d; /:ERROR:/d; s#^\(.*\)/\(.\+\)(default)#\1\n\1\/\2#; diff --git a/scripts/Bootstrap/build_pmodules.sh b/scripts/Bootstrap/build_pmodules.sh index 90f7675..f36cbfc 100755 --- a/scripts/Bootstrap/build_pmodules.sh +++ b/scripts/Bootstrap/build_pmodules.sh @@ -3,9 +3,11 @@ declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" -source "/opt/psi/config/environment.bash" source "${BASE_DIR}/config/pmodules_version.conf" +unset PMODULES_HOME +source "/opt/psi/config/environment.bash" + ${BOOTSTRAP_DIR}/gettext.build --bootstrap ${BOOTSTRAP_DIR}/getopt.build --bootstrap ${BOOTSTRAP_DIR}/dialog.build --bootstrap diff --git a/scripts/Bootstrap/dialog.build b/scripts/Bootstrap/dialog.build deleted file mode 120000 index 3e38d1f..0000000 --- a/scripts/Bootstrap/dialog.build +++ /dev/null @@ -1 +0,0 @@ -../Tools/dialog.build \ No newline at end of file diff --git a/scripts/Bootstrap/dialog.build b/scripts/Bootstrap/dialog.build new file mode 100755 index 0000000..b5d7a1d --- /dev/null +++ b/scripts/Bootstrap/dialog.build @@ -0,0 +1,13 @@ +#!/bin/bash + +source "$(dirname $0)/../../lib/libem.bash" + +function em.configure() { + "${MODULE_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +em.add_to_family 'Tools' +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/Bootstrap/environment.bash b/scripts/Bootstrap/environment.bash new file mode 100644 index 0000000..f3662cd --- /dev/null +++ b/scripts/Bootstrap/environment.bash @@ -0,0 +1,30 @@ +#!/bin/bash + +declare -x PSI_PREFIX=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd) +declare -x PSI_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pwd)) + +if [[ -z ${PMODULES_VERSION} ]]; then + declare -x PMODULES_VERSION="0.99.1" +fi + +declare -x PMODULES_HOME="${PSI_PREFIX}/Tools/Pmodules/${PMODULES_VERSION}" + +declare -A PSI_FAMILIES=( + ['Legacy']=0 + ['Libraries']=0 + ['Programming']=0 + ['Numeric']=0 + ['System']=0 + ['Tools']=0 + ['Compiler']=2 + ['MPI']=4 + ['HDF5_serial']=4 + ['HDF5']=6 +) + +declare -x PSI_MODULES_ROOT='modulefiles' + +declare -x PSI_DEFAULT_FAMILIES='Tools Programming' + +declare -x PSI_RELEASES=':unstable:stable:deprecated:' +declare -x PSI_USED_RELEASES='stable' diff --git a/scripts/Bootstrap/getopt.build b/scripts/Bootstrap/getopt.build deleted file mode 120000 index 09718d1..0000000 --- a/scripts/Bootstrap/getopt.build +++ /dev/null @@ -1 +0,0 @@ -../System/getopt.build \ No newline at end of file diff --git a/scripts/Bootstrap/getopt.build b/scripts/Bootstrap/getopt.build new file mode 100755 index 0000000..e502f0e --- /dev/null +++ b/scripts/Bootstrap/getopt.build @@ -0,0 +1,42 @@ +#!/bin/bash + +source "$(dirname $0)/../../lib/libem.bash" + +function em.configure() { + : +} + +function em.build() { + case ${OS} in + Linux ) + declare -x LDFLAGS="-lintl -liconv" + ;; + Darwin ) + declare -x LDFLAGS="-lintl -liconv -framework CoreFoundation" + ;; + esac + + cd "${MODULE_SRCDIR}" + make -e +} + +function em.install() { + cd "${MODULE_SRCDIR}" + declare -x DESTDIR="${PREFIX}" + declare -x prefix='' + make -e install +} + +function em.cleanup_build() { + cd "${MODULE_SRCDIR}" + make -e realclean +} + +em.add_to_family 'Tools' +em.make_all + +# Local Variables: +# mode: sh +# sh-basic-offset: 8 +# tab-width: 8 +# End: diff --git a/scripts/Bootstrap/gettext.build b/scripts/Bootstrap/gettext.build deleted file mode 120000 index 67fd38d..0000000 --- a/scripts/Bootstrap/gettext.build +++ /dev/null @@ -1 +0,0 @@ -../Tools/gettext.build \ No newline at end of file diff --git a/scripts/Bootstrap/gettext.build b/scripts/Bootstrap/gettext.build new file mode 100755 index 0000000..56463f6 --- /dev/null +++ b/scripts/Bootstrap/gettext.build @@ -0,0 +1,24 @@ +#!/bin/bash + +source "$(dirname $0)/../../lib/libem.bash" + +function em.configure() { + "${MODULE_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --disable-java \ + --disable-threads \ + --disable-shared \ + --enable-relocatable \ + --disable-openmp \ + --disable-acl \ + --disable-curses \ + --with-included-gettext \ + --without-libiconv-prefix \ + --without-libintl-prefix \ + --with-included-libxml \ + || exit 1 +} + +em.add_to_family 'Tools' +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/Bootstrap/install_pmodules.sh b/scripts/Bootstrap/install_pmodules.sh index 7c3fc05..7673c49 100755 --- a/scripts/Bootstrap/install_pmodules.sh +++ b/scripts/Bootstrap/install_pmodules.sh @@ -3,22 +3,27 @@ declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" -source "/opt/psi/config/environment.bash" source "${BASE_DIR}/config/pmodules_version.conf" +unset PMODULES_HOME +source "/opt/psi/config/environment.bash" + sed_cmd="s:@PMODULES_HOME@:${PMODULES_HOME}:g;" sed_cmd+="s:@PMODULES_VERSION@:${PMODULES_VERSION}:g;" sed_cmd+="s:@MODULES_VERSION@:${MODULES_VERSION}:g" sed "${sed_cmd}" "${BOOTSTRAP_DIR}/modulecmd.bash" > "${BOOTSTRAP_DIR}/modulecmd" -install -d -m 0755 "${PMODULES_HOME}/etc" +install -d -m 0755 "${PMODULES_HOME}/bin" +install -d -m 0755 "${PMODULES_HOME}/config" +install -d -m 0755 "${PMODULES_HOME}/init" +install -d -m 0755 "${PMODULES_HOME}/lib" install -m 0755 "${BOOTSTRAP_DIR}/modulecmd" "${PMODULES_HOME}/bin" install -m 0755 "${BOOTSTRAP_DIR}/init_local_env.bash" "${PMODULES_HOME}/bin" install -m 0755 "${BOOTSTRAP_DIR}/modsync.bash" "${PMODULES_HOME}/bin" install -m 0755 "${BOOTSTRAP_DIR}/dialog.bash" "${PMODULES_HOME}/bin" -install -m 0644 "${BOOTSTRAP_DIR}/modulerc" "${PMODULES_HOME}/etc" +#install -m 0644 "${BOOTSTRAP_DIR}/modulerc" "${PMODULES_HOME}/config" install -m 0644 "${BOOTSTRAP_DIR}/bash" "${PMODULES_HOME}/init" install -m 0644 "${BOOTSTRAP_DIR}/bash_completion" "${PMODULES_HOME}/init" diff --git a/scripts/Bootstrap/modulecmd b/scripts/Bootstrap/modulecmd deleted file mode 100644 index 0fa91d4..0000000 --- a/scripts/Bootstrap/modulecmd +++ /dev/null @@ -1,1140 +0,0 @@ -#!/opt/psi/Tools/Pmodules/0.99.0/bin/bash - -declare -r PMODULES_DIR=$( cd "$(dirname $0)/.." && pwd ) -declare -r version='0.99.0' -declare -r modulecmd="${PMODULES_DIR}/bin/modulecmd.tcl" -#declare -rx TCL_LIBRARY="${PMODULES_DIR}/lib/tcl8.6" - -declare -r modulepath_root="${PSI_PREFIX}/${PSI_MODULES_ROOT}" -declare -ra modulepath=( ${MODULEPATH//:/ } ) - -if set -o | grep 'xtrace' | grep -q 'on'; then - declare -r __XTRACE__='on' -else - declare -r __XTRACE__='off' -fi - -declare output_function='human_readable_output' -declare verbosity='silent' -declare userlvl='expert' -declare sw_force='no' -declare sw_create='no' - - -print_version() { - echo " -Pmodules ${version} using Tcl Environment Modules 3.2.10 -Copyright GNU GPL v2 -" 1>&2 -} - -usage() { - print_version - echo " -Usage: module [ switches ] [ subcommand ] [subcommand-args ] - -Switches: - -H|--help this usage info - -V|--version modules version & configuration options - -f|--force force active dependency resolution - -t|--terse terse format avail and list format - -l|--long long format avail and list format - -h|--human readable format avail and list format - -v|--verbose enable verbose messages - -s|--silent disable verbose messages - -c|--create create caches for avail and apropos - -i|--icase ignored - -u|--userlvl set user level to (nov[ice],exp[ert],adv[anced]) - Available SubCommands and Args: - + add|load modulefile [modulefile ...] - + rm|unload modulefile [modulefile ...] - + switch|swap [modulefile1] modulefile2 - + display|show modulefile [modulefile ...] - + avail [modulefile [modulefile ...]] - + search [ switches ] [ args ] - + use [-a|--append] [dir|family|release ...] - + unuse dir|family|release [dir|family|release ...] - + update - + refresh - + purge - + list - + clear - + help [modulefile|subcommand] - + whatis [modulefile [modulefile ...]] - + apropos|keyword string - + initadd modulefile [modulefile ...] - + initprepend modulefile [modulefile ...] - + initrm modulefile [modulefile ...] - + initswitch modulefile1 modulefile2 - + initlist - + initclear - + sync [ switches ] -" 1>&2 - -} - - -subcommand_help_add() { - echo " -add modulefile... -load modulefile... - Load modulefile(s) into the shell environment. Loading a - 'family-head' will extend the MODULEPATH. E.g.: loading a - compiler makes additional modules like openmpi and libraries - compiled with this compiler available. -" 1>&2 -} - -subcommand_help_load() { - subcommand_help_add -} - -subcommand_help_rm() { - echo " -rm modulefile... -unload modulefile... - Remove modulefile(s) from the shell environment. Removing - a 'family-head' will also unload all modules in the family. -" 1>&2 -} - -subcommand_help_unload() { - subcommand_help_rm -} - -subcommand_help_switch() { - echo " -switch [modulefile1] modulefile2 -swap [modulefile1] modulefile2 - Switch loaded modulefile1 with modulefile2. If modulefile1 - is not specified, then it is assumed to be the currently - loaded module with the same root name as modulefile2. -" 1>&2 -} - -subcommand_help_swap() { - subcommand_help_switch -} - -subcommand_help_display() { - echo " -display modulefile... -show modulefile... - Display information about one or more modulefiles. The - display sub-command will list the full path of the - modulefile(s) and all (or most) of the environment changes - the modulefile(s) will make if loaded. It will not display - any environment changes found within conditional statements. -" 1>&2 -} - -subcommand_help_show() { - subcommand_help_display -} - -subcommand_help_apropos() { - echo " -apropos string -keyword string Seeks through the 'whatis' informations of all modulefiles for - the specified string. All module-whatis informations matching - the string will be displayed. - -" 1>&2 -} - -subcommand_help_keyword() { - subcommand_help_apropos -} - - -subcommand_help_avail() { - echo " -avail string List all available modulefiles in the current MODULEPATH. If - an argument is given, then each directory in the MODULEPATH - is searched for modulefiles whose pathname match the argument. - - This command does *not* display all installed modules on the - system. Only *loadable* modules are listed. The list of - available modules may change either by loading other modules, - e.g. a compiler, or with the sub-command 'use'. -" 1>&2 -} - -subcommand_help_search() { - echo " -search [switches] STRING... - Search installed modules. If an argument is given, search - for modules whose name match the argument. - -SWITCHES: ---no-header Suppress output of a header. - ---release=RELEASE - Search for modules within this release. You can specify this - switch multiple times. Without this switch, the used releases - will be searched. - --a|--all-releases - Search within all releases. - ---with=STRING - Search for modules compiled with modules matching string. The - command - - module search --with=gcc/4.8.3 - - lists all modules in the hierarchy compiled with gcc 4.8.3. -" 1>&2 -} - -subcommand_help_use() { - echo " -use [-a|--append|-p|--prepend] [directory|family|release...] - Without arguments this sub-command displays information about - the module search path, used families and releases. You can - use this sub-command to get a list of available families and - releases. - - With a directory as argument, this directory will either be - prepended or appended to the module search path. The default - is to prepend the directory. - - With a family as argument, the modules in this family will - be made available. - - With a release as argument, this modules with this release - will be made available. -" 1>&2 -} - -subcommand_help_unuse() { - echo " -unuse directory|family|release... - Remove the given directory, family or release from the search - path. -" 1>&2 -} -subcommand_help_update() { - echo " -update Attempt to reload all loaded modulefiles. -" 1>&2 -} - -subcommand_help_refresh() { - echo " -refresh Force a refresh of all non-persistent components of currently - loaded modules. This should be used on derived shells where - aliases need to be reinitialized but the environment variables - have already been set by the currently loaded modules. -" 1>&2 -} - -subcommand_help_purge() { - echo " -purge Unload all loaded modulefiles. -" 1>&2 -} - -subcommand_help_list() { - echo " -list List loaded modules. -" 1>&2 -} - -subcommand_help_clear() { - echo " -clear Force the Modules package to believe that no modules are - currently loaded. -" 1>&2 -} - -subcommand_help_whatis() { - echo " -whatis [modulefile...] - Display the information set up by the module-whatis commands - inside the specified modulefile(s). If no modulefile is - specified, all 'whatis' lines will be shown. -" 1>&2 -} - -subcommand_help_initadd() { - echo " -initadd modulefile... - Add modulefile(s) to the shell's initialization file in the - user's home directory. The startup files checked (in order) - are: - - csh - .modules, .cshrc(.ext), .csh_variables, and - .login(.ext) - tcsh - .modules, .tcshrc, .cshrc(.ext), .csh_variables, - and .login(.ext) - (k)sh - .modules, .profile(.ext), and .kshenv(.ext) - bash - .modules, .bash_profile, .bash_login, - .profile(.ext) and .bashrc(.ext) - zsh - .modules, .zcshrc(.ext), .zshenv(.ext), and - .zlogin(.ext) - - If a 'module load' line is found in any of these files, the - modulefile(s) is(are) appended to any existing list of - modulefiles. The 'module load' line must be located in at - least one of the files listed above for any of the 'init' - sub-commands to work properly. If the 'module load' line - line is found in multiple shell initialization files, all - of the lines are changed. -" 1>&2 -} - -subcommand_help_initprepend() { - echo " -initprepend modulefile... - Does the same as initadd but prepends the given modules to - the beginning of the list. -" 1>&2 -} - -subcommand_help_initrm() { - echo " -initrm modulefile... - Remove modulefile(s) from the shell's initialization files. -" 1>&2 -} - -subcommand_help_initswitch() { - echo " -initswitch modulefile1 modulefile2 - Switch modulefile1 with modulefile2 in the shell's initialization files. -" 1>&2 -} - -subcommand_help_initlist() { - echo " -initlist List all of the modulefiles loaded from the shell's initialization file. -" 1>&2 -} - -subcommand_help_initclear() { - echo " -initclear Clear all of the modulefiles from the shell's initialization files. -" 1>&2 -} - -subcommand_help_sync() { - echo " -sync [--from=DIR] [--to=DIR] [--dryrun] [--delete] - Synchronize two Pmodules hierarchies. -" 1>&2 -} - -append_path () { - local -r P=$1 - local -r d=$2 - - if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then - if [[ -z ${!P} ]]; then - eval $P=${d} - else - eval $P=${!P}:${d} - fi - fi -} - -prepend_path () { - local -r P=$1 - local -r d=$2 - - if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then - if [[ -z ${!P} ]]; then - eval $P=${d} - else - eval $P=${d}:${!P} - fi - fi -} - -remove_path() { - local -r P=$1 - local -r d=$2 - local new_path='' - local -r _P=( ${!P//:/ } ) - # loop over all entries in path - for entry in "${_P[@]}"; do - [[ "${entry}" != "${d}" ]] && new_path+=":${entry}" - done - # remove leading ':' - eval ${P}="${new_path:1}" -} - -module_is_available() { - is_loadable() { - release=$( get_release "$1" ) - [[ :${PSI_USED_RELEASES}: =~ ${release} ]] && return 0 - return 1 - } - - [[ -f $1 ]] && return 0 - for dir in "${modulepath[@]}"; do - if [[ -d ${dir}/$1 ]]; then - while read fname; do - is_loadable "${fname}" && return 0 - done < <(find "${dir}" -type l -o -type f \! -name ".*") - else - [[ -f ${dir}/$1 ]] || continue - [[ -r ${dir}/$1 ]] || continue - is_loadable "${dir}/$1" && return 0 - fi - done - return 1 -} - -get_release() { - local -r modulefile=$1 - local -r releasefile="${modulefile%/*}/.release-${modulefile##*/}" - if [[ -r ${releasefile} ]]; then - local -r data=$( < "${releasefile}" ) - local -r release=$( echo ${data} ) - else - local -r release='unstable' - fi - echo ${release} -} - -if [[ ${PSI_RELEASES_CONF} ]] && [[ -r "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_RELEASES_CONF}" ]]; then - declare -r available_releases=:$(< "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_RELEASES_CONF}"): -else - # set defaults, if file doesn't exist or isn't readable - declare -r available_releases=":unstable:stable:deprecated:" -fi -declare used_releases=":${PSI_USED_RELEASES}:" - -is_release() { - [[ ${available_releases} =~ :$1: ]] -} - -is_used_release() { - [[ ${used_releases} =~ :$1: ]] -} - -declare available_families=':' -declare family -declare depth -while read family depth rest; do - if (( depth == 0 )); then - available_families+="${family}:" - fi -done < "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_FAMILY_CONF}" -declare used_families=":${PSI_LOADEDFAMILIES}:" - -is_family() { - [[ ${available_families} =~ :$1: ]] -} - -is_used_family() { - [[ ${used_families} =~ :$1: ]] -} - -module_is_loaded() { - [[ :${LOADEDMODULES}: =~ :$1: ]] -} - -subcommand_generic0() { - local -r subcommand=$1 - shift - if [[ $# != 0 ]]; then - echo "${subcommand}: no arguments allowed" 1>&2 - return 3 - fi - "${modulecmd}" "${shell}" "${subcommand}" -} - -subcommand_generic0plus() { - local -r subcommand=$1 - shift - "${modulecmd}" "${shell}" "${subcommand}" "$@" -} - -subcommand_generic1() { - local -r subcommand=$1 - shift - if [[ $# != 1 ]]; then - echo "${subcommand}: only one argument allowed" 1>&2 - return 3 - fi - "${modulecmd}" "${shell}" "${subcommand}" "$1" -} - -subcommand_generic1plus() { - local -r subcommand=$1 - shift - if [[ $# == 0 ]]; then - echo "${subcommand}: missing argument" 1>&2 - return 3 - fi - "${modulecmd}" "${shell}" "${subcommand}" "$@" -} - -subcommand_load() { - output_load_hints() { - local -ra rels=( ${available_releases//:/ } ) - for rel in "${rels[@]}"; do - eval $( subcommand_use "${rel}" ) - if module_is_available "${m}"; then - echo "${m}: is ${rel}! If you really want to load this module, run" 1>&2 - echo -e "\tmodule use ${rel}" 1>&2 - echo "before running" 1>&2 - echo -e "\tmodule load ${m}" 1>&2 - exit 42 - fi - done - local something_found='no' - local -a output=() - local -a release=() - local -a loadable=() - local -i i=0 - local -i n=0 - while read -a line; do - output[n]="module load ${line[@]:3} ${line[0]}" - release[n]=${line[1]} - if [[ ":${PSI_USED_RELEASES}:" =~ "${release[n]}" ]]; then - loadable[n]='yes' - else - loadable[n]='no' - fi - n+=1 - done < <(subcommand_search "${m}" -a --no-header 2>&1) - if (( n > 0 )); then - echo "The following modules chain(s) are available:" 1>&2 - for ((i=n-1; i >=0; i--)); do - echo -en "${output[i]}\t# ${release[i]}" 1>&2 - if [[ "${loadable[i]}" == "no" ]]; then - echo -e "\t# ${release[i]}" 1>&2 - else - echo "" 1>&2 - fi - done - else - echo "${m}: module does not exist!" 1>&2 - fi - } - - local -r m=$1 - if module_is_available "${m}"; then - "${modulecmd}" "${shell}" load "${m}" - else - if [[ ${userlvl} = 'novice' ]]; then - output_load_hints - else - echo "${m}: module unavailable" 1>&2 - fi - fi -} - - -subcommand_unload() { - # :FIXME: add dependency tests: don't unload if module is required be - # another module - subcommand_generic1plus unload "$@" -} - -subcommand_swap() { - if [[ $# == 0 ]]; then - echo "${subcommand}: missing argument" 1>&2 - return 3 - fi - if [[ $# > 2 ]]; then - echo "${subcommand}: to many arguments" 1>&2 - return 3 - fi - "${modulecmd}" "${shell}" swap "$@" -} - -subcommand_show() { - subcommand_generic1plus show "$@" -} - -# -# get all available modules in given directory. -# return list like -# modulename1 release1 modulename2 release2 ... -# -get_available_modules() { - local -r dir=$1 - local -r module=$2 - local -r use_releases=${3:-${PSI_USED_RELEASES}} - local -a mods=() - while read mod; do - local release=$( get_release "${dir}/${mod}" ) - - if [[ :${use_releases}: =~ :${release}: ]]; then - mods+=( "${mod}" ${release} ) - fi - done < <(MODULEPATH="${dir}" "${modulecmd}" bash -t avail "${module}" 2>&1 | tail -n +2) - echo "${mods[@]}" -} - - -# :FIXXME: support for all output formats -subcommand_avail() { - # use this variable in the output functions - local -a mods=() - local dir='' - - # get number of columns of terminal - eval $(resize) - - output_header() { - let i=($COLUMNS-${#dir})/2-2 - printf -- "%0.s-" $(seq 1 $i) 1>&2 - printf -- " %s " "${dir}" 1>&2 - printf -- "%0.s-" $(seq 1 $i) 1>&2 - printf -- "\n" 1>&2 - } - - terse_output() { - output_header - for (( i=0; i<${#mods[@]}; i+=2 )); do - local mod=${mods[i]} - local release=${mods[i+1]} - case $release in - stable ) - out='' - ;; - * ) - out=${release} - ;; - esac - printf "%-20s\t%s\n" "${mod}" "${out}" 1>&2 - done - echo 1>&2 - } - - long_output() { - output_header - for (( i=0; i<${#mods[@]}; i+=2 )); do - local mod=${mods[i]} - local release=${mods[i+1]} - case $release in - stable ) - out='' - ;; - * ) - out=${release} - ;; - esac - printf "%-20s\t%s\n" "${mod}" "${out}" 1>&2 - done - echo 1>&2 - } - - human_readable_output() { - output_header - - local -i column=$COLUMNS - local -i colsize=16 - for ((i=0; i<${#mods[@]}; i+=2)); do - if [[ ${userlvl} == 'novice' ]]; then - local release=${mods[i+1]} - case ${mods[i+1]} in - stable ) - mod=${mods[i]} - ;; - * ) - mod="${mods[i]}(${release:0:1})" - ;; - esac - else - mod=${mods[i]} - fi - local -i len=${#mod} - local -i span=$(( len / 16 + 1 )) - local -i colsize=$(( span * 16 )) - if (( column+len >= COLUMNS )); then - printf -- "\n" 1>&2 - column=0 - fi - if (( column+colsize < COLUMNS )); then - fmt="%-${colsize}s" - else - fmt="%-s" - fi - printf "${fmt}" "${mod}" 1>&2 - column+=colsize - done - printf -- "\n\n" 1>&2 - } - - if [[ $# == 0 ]]; then - set -- '' - fi - while (( $# > 0 )); do - local module=$1 - for dir in "${modulepath[@]}"; do - mods=( $( get_available_modules "${dir}" "${module}" ) ) - [[ ${#mods[@]} == 0 ]] && continue - - ${output_function} - done - shift - done -} - -subcommand_use() { - if [[ $# == 0 ]]; then - local f - local r - echo -e "Used families:" 1>&2 - for f in ${used_families//:/ }; do - echo -e "\t${f}" 1>&2 - done - echo -e "\nFamilies you may use in addition:" 1>&2 - for f in ${available_families//:/ }; do - if ! is_used_family $f; then - echo -e "\t${f}" 1>&2 - fi - done - - echo -e "\nUsed releases:" 1>&2 - for r in ${used_releases//:/ }; do - echo -e "\t${r}" 1>&2 - done - echo -e "\nReleases you may use in addition:" 1>&2 - for r in ${available_releases//:/ }; do - if ! is_used_release $r; then - echo -e "\t${r}" - fi - done - - echo -e "\nAdditonal directories in MODULEPATH:" 1>&2 - for (( i=0; i<${#modulepath[@]}; i++)); do - if [[ ! ${modulepath[i]} =~ ${PSI_PREFIX} ]]; then - echo -e "\t${modulepath[i]}" 1>&2 - fi - done - else - local dirs_to_add=() - local subcommand_switches='' - while (( $# > 0)); do - arg=$1 - if [[ ${arg} == -a ]] || [[ ${arg} == --append ]]; then - subcommand_switches='--append' - elif [[ ${arg} == -p ]] || [[ ${arg} == --prepend ]]; then - subcommand_switches='' - elif is_release "${arg}"; then - # releases are always *appended* - append_path PSI_USED_RELEASES "${arg}" - elif [[ ! ${arg} =~ */* ]] && [[ -d ${modulepath_root}/${arg} ]]; then - dirs_to_add+=( ${modulepath_root}/${arg} ) - elif [[ -d ${arg} ]]; then - local normalized_dir=$(cd "${arg}" && pwd) - dirs_to_add+=( ${normalized_dir} ) - elif [[ ${arg} =~ "-*" ]]; then - echo "${0##_}: illegal switch: ${arg}" 1>&2 - return 3 - else - echo "${0##_}: neither a directory, release or family: ${arg}" 1>&2 - return 3 - fi - shift - done - echo "export PSI_USED_RELEASES=${PSI_USED_RELEASES}" - [[ ${#dirs_to_add[@]} == 0 ]] && return - - subcommand_generic1plus use ${subcommand_switches} "${dirs_to_add[@]}" - fi -} - -subcommand_unuse() { - local dirs_to_remove=() - while (( $# > 0)); do - arg=$1 - if is_release "${arg}"; then - remove_path PSI_USED_RELEASES "${arg}" - elif [[ ! ${arg} =~ */* ]] && [[ -d ${modulepath_root}/${arg} ]]; then - dirs_to_remove+=( ${modulepath_root}/${arg} ) - elif [[ -d ${arg} ]]; then - local normalized_dir=$(cd "${arg}" && pwd) - dirs_to_remove+=( ${normalized_dir} ) - elif [[ ${arg} =~ "-*" ]]; then - echo "${0##_}: illegal switch: ${arg}" 1>&2 - return 3 - else - echo "${0##_}: not a directory: ${arg}" 1>&2 - return 3 - fi - shift - done - echo "export PSI_USED_RELEASES=${PSI_USED_RELEASES}" - [[ ${#dirs_to_remove[@]} == 0 ]] && return - subcommand_generic1plus unuse "${dirs_to_remove[@]}" -} - -subcommand_update() { - subcommand_generic0 update "$@" -} - -subcommand_refresh() { - subcommand_generic0 refresh "$@" -} - -subcommand_purge() { - subcommand_generic0 purge "$@" -} - -subcommand_list() { - subcommand_generic0 list "$@" -} - -subcommand_clear() { - subcommand_generic0 clear "$@" -} - -subcommand_search() { - local modules=() - local with_modules='//' - local _print_header='yes' - local use_releases=':' - local -r fmt="%-20s %-10s %-12s %-s\n" - - # no args - print_header() { - printf '\n' 1>&1 - printf "${fmt}" "Module" "Release" "Family" "Requires" 1>&2 - printf -- '-%.0s' {1..60} 1>&2 - printf '\n' 1>&2 - } - - # args: - # $1: module name pattern - search () { - local -r module=$1 - # we must write temporary results to a file for sorting - local -r tmpfile=$( mktemp /tmp/$(basename $0).XXXXXX ) || exit 1 - local family depth unused - # loop over all families - while read family depth unused; do - # get all potential directories of family $f with module-files - local mpaths=( $(find \ - "${modulepath_root}/${family}" \ - -type d \ - -mindepth ${depth} -maxdepth ${depth} \ - 2>/dev/null)) - local mpath - for mpath in "${mpaths[@]}"; do - # get dependencies encoded in directory name - local p="${mpath/${modulepath_root}}" - p=( ${p//\// } ) - local deps=() - local -i i - for ((i=1; i < ${#p[@]}; i+=2)); do - deps+=( ${p[i]}/${p[i+1]} ) - done - local requires=${deps[@]} - - # get and print all available modules in $mpath - # with respect to the requested releases - local mods=( $( get_available_modules \ - "${mpath}" \ - "${module}" \ - "${use_releases}" ) ) - [[ ${#mods[@]} == 0 ]] && continue - for (( i=0; i<${#mods[@]}; i+=2 )); do - printf "${fmt}" ${mods[i]} "${mods[i+1]}" \ - ${family} "${requires}" >> "${tmpfile}" - done - done - done < "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_FAMILY_CONF}" - sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}" 1>&2 - - rm -f "${tmpfile}" - } - - - while (( $# > 0 )); do - case $1 in - --no-header ) - _print_header='no' - ;; - --release=* ) - _val=${1/--release=} - if is_release "${_val}"; then - use_releases+="${_val}:" - else - echo "${_val}: illegal release name." 1>&2 - exit 1 - fi - ;; - --with=* ) - _arg=${1/--with=} - if [[ -z ${_arg} ]]; then - echo "$1: module missing." 1>&2 - exit 1 - fi - with_modules+=" && / ${_arg//\//\\/}/" - ;; - -a | --all-releases ) - use_releases=${available_releases} - ;; - -? | -h | --help ) - usage - ;; - -* ) - echo "$1: invalid argument." 1>&2 - exit 1 - ;; - * ) - modules+=( $1 ) - ;; - esac - shift - done - - if [[ "${use_releases}" == ":" ]]; then - use_releases=":${PSI_USED_RELEASES}:" - fi - - [[ "${_print_header}" == "yes" ]] && print_header - if [[ ${#modules[@]} == 0 ]]; then - modules+=( '' ) - fi - - for module in "${modules[@]}"; do - search "${module}" - done -} - -subcommand_help() { - if [[ $# == 0 ]]; then - usage - elif typeset -F subcommand_help_$1 > /dev/null 2>&1 ; then - # help for sub-command - subcommand_help_$1 - else - # :FIXME: print help of newest *available* module - # (respecting PSI_USED_RELEASES) - subcommand_generic1plus help "$@" - fi -} - -subcommand_whatis() { - subcommand_generic0plus whatis "$@" -} - -subcommand_apropos() { - subcommand_generic1 apropos "$@" -} - -subcommand_initadd() { - subcommand_generic1plus initadd "$@" -} - -subcommand_initprepend() { - subcommand_generic1plus initprepend "$@" -} - -subcommand_initrm() { - subcommand_generic1plus initrm "$@" -} - -subcommand_initswitch() { - if [[ $# == 0 ]]; then - echo "${subcommand}: missing argument" 1>&2 - return 3 - fi - if [[ $# > 2 ]]; then - echo "${subcommand}: to many arguments" 1>&2 - return 3 - fi - "${modulecmd}" "${shell}" initswap "$@" -} - -subcommand_initlist() { - subcommand_generic0 initlist "$@" -} - -subcommand_initclear() { - subcommand_generic0 initclear "$@" -} - -subcommand_sync() { - local _srcdir - local _dstdir - local _dryrun='no' - local _delete='no' - local _args=() - while (( $# > 0 )); do - case $1 in - --from=* ) - _srcdir=${1/--from=} - _args+=( $1 ) - ;; - --to=* ) - _dstdir=${1/--to=} - _args+=( $1 ) - ;; - --dry-run ) - _dryrun='yes' - _args+=( --dryrun ) - ;; - --delete ) - _delete='yes' - _args+=( $1 ) - ;; - * ) - echo "$1: invalid argument." 1>&2 - exit 1 - ;; - esac - shift - done - ${PMODULES_HOME}/bin/modsync.bash "${_args[@]}" -} - -case $1 in - bash ) - declare shell=$1 - ;; - * ) - echo "$1: unsupported shell" 1>&2 - exit 1 - ;; -esac -shift - -while (( $# > 0 )); do - case $1 in - -h | -H | -\? | --help | -help ) - usage - exit 1 - ;; - -V | --version ) - print_version - exit 1 - ;; - -f | --force ) - # ignored - ;; - -t | --terse ) - output_function='terse_output' - ;; - -l | --long ) - output_function='long_output' - ;; - --human ) - output_function='human_readable_output' - ;; - --versbose ) - verbosity='verbose' - ;; - --silent ) - verbosity='silent' - ;; - -c | --create ) - sw_create='yes' - ;; - -i | --icase ) - # ignored - ;; - -u | --userlvl ) - case $2 in - nov | novi | novic | novice ) - userlvl='novice' - ;; - exp | expe | exper | expert ) - userlvl='expert' - ;; - adv | adva | advan | advanc | advance | advanced ) - userlvl='advanced' - ;; - * ) - echo "$1: unknown user level" 1>&2 - exit 1 - ;; - esac - shift - ;; - -* ) - echo "$1: unknown switch.\n" 1>&2 - exit 1 - ;; - add|load ) - subcommand='subcommand_load' - shift - sargs=( $* ) - shift $# - ;; - rm|unload ) - subcommand='subcommand_unload' - shift - sargs=( $* ) - shift $# - ;; - switch|swap ) - subcommand='subcommand_swap' - shift - sargs=( $* ) - shift $# - ;; - display|show ) - subcommand='subcommand_show' - shift - sargs=( $* ) - shift $# - ;; - apropos|keyword ) - subcommand='subcommand_apropos' - shift - sargs=( $* ) - shift $# - ;; - avail|search|use|unuse|update|refresh|purge|list|clear|whatis|help ) - subcommand=subcommand_$1 - shift - sargs=( $* ) - shift $# - ;; - initadd|initprepend|initrm|initswitch|initlist|initclear ) - subcommand=subcommand_$1 - shift - sargs=( $* ) - shift $# - ;; - sync ) - subcommand=subcommand_$1 - shift - sargs=( $* ) - shift $# - ;; - * ) - echo "$1: unknown sub-command" 1>&2 - exit 1 - esac - shift -done - -#for ((i=0; i<$#; i++)); do -# case "${sargs[i]}" in -# -a | --append ) -# if [[ ${subcommand} != use ]]; then -# echo "${subcommand}: unsupported switch '$1'" 1>&2 -# exit 1 -# fi -# ;; -# -* ) -# echo "${subcommand}: unsupported switch '$1'" 1>&2 -# exit 1 -# ;; -# [a-zA-Z0-9] ) -# : -# ;; -# * ) -# echo "$1: illegal module name" 1>&2 -# ;; -# esac -#done - -$subcommand "${sargs[@]}" - -# Local Variables: -# mode: sh -# sh-basic-offset: 8 -# tab-width: 8 -# End: diff --git a/scripts/Bootstrap/modulecmd.bash b/scripts/Bootstrap/modulecmd.bash index 01293d9..3fb4149 100755 --- a/scripts/Bootstrap/modulecmd.bash +++ b/scripts/Bootstrap/modulecmd.bash @@ -3,7 +3,9 @@ declare -r PMODULES_DIR=$( cd "$(dirname $0)/.." && pwd ) declare -r version='@PMODULES_VERSION@' declare -r modulecmd="${PMODULES_DIR}/bin/modulecmd.tcl" -#declare -rx TCL_LIBRARY="${PMODULES_DIR}/lib/tcl8.6" + +declare -rx TCL_LIBRARY="${PMODULES_DIR}/lib/tcl8.6" +declare -rx PSI_LIBMODULES="${PMODULES_DIR}/lib/libmodules.tcl" declare -r modulepath_root="${PSI_PREFIX}/${PSI_MODULES_ROOT}" declare -ra modulepath=( ${MODULEPATH//:/ } ) @@ -398,11 +400,11 @@ get_release() { echo ${release} } -if [[ ${PSI_RELEASES_CONF} ]] && [[ -r "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_RELEASES_CONF}" ]]; then - declare -r available_releases=:$(< "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_RELEASES_CONF}"): +if [[ -n ${PSI_RELEASES} ]]; then + declare -r available_releases="${PSI_RELEASES}" else # set defaults, if file doesn't exist or isn't readable - declare -r available_releases=":unstable:stable:deprecated:" + declare -r available_releases=':unstable:stable:deprecated:' fi declare used_releases=":${PSI_USED_RELEASES}:" @@ -414,20 +416,8 @@ is_used_release() { [[ ${used_releases} =~ :$1: ]] } -declare available_families=':' -declare family -declare depth -while read family depth rest; do - if (( depth == 0 )); then - available_families+="${family}:" - fi -done < "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_FAMILY_CONF}" declare used_families=":${PSI_LOADEDFAMILIES}:" -is_family() { - [[ ${available_families} =~ :$1: ]] -} - is_used_family() { [[ ${used_families} =~ :$1: ]] } @@ -677,6 +667,27 @@ subcommand_avail() { done } +get_families () { + { + cd "${modulepath_root}" + echo * + } +} + +# +# $1: family name (not path!) +compute_family_depth () { + { + local -r family=$1 + cd "${modulepath_root}" + local -r tmp=$(find "${family}" -d -type f -o -type l | head -1) + local -ar tmp2=( ${tmp//\// } ) + local depth=${#tmp2[@]} + let depth-=3 + echo ${depth} + }; +} + subcommand_use() { if [[ $# == 0 ]]; then local f @@ -686,9 +697,10 @@ subcommand_use() { echo -e "\t${f}" 1>&2 done echo -e "\nFamilies you may use in addition:" 1>&2 - for f in ${available_families//:/ }; do - if ! is_used_family $f; then - echo -e "\t${f}" 1>&2 + for family in $(get_families); do + local -i depth=$( compute_family_depth "${family}") + if ! is_used_family $f && (( depth == 0 )); then + echo -e "\t${f}" 1>&2 fi done @@ -699,7 +711,7 @@ subcommand_use() { echo -e "\nReleases you may use in addition:" 1>&2 for r in ${available_releases//:/ }; do if ! is_used_release $r; then - echo -e "\t${r}" + echo -e "\t${r}" 1>&2 fi done @@ -710,6 +722,7 @@ subcommand_use() { fi done else + local dirs_to_add=() local subcommand_switches='' while (( $# > 0)); do @@ -722,7 +735,16 @@ subcommand_use() { # releases are always *appended* append_path PSI_USED_RELEASES "${arg}" elif [[ ! ${arg} =~ */* ]] && [[ -d ${modulepath_root}/${arg} ]]; then - dirs_to_add+=( ${modulepath_root}/${arg} ) + local -i depth=$(compute_family_depth "${arg}") + if (( depth == 0 )); then + dirs_to_add+=( ${modulepath_root}/${arg} ) + else + echo "${0##_}: cannot add family ${arg} to module path" + return 3 + fi + elif [[ ${arg} =~ ^${modulepath_root} ]]; then + echo "${0##_}: illegal directory: ${arg}" 1>&2 + return 3 elif [[ -d ${arg} ]]; then local normalized_dir=$(cd "${arg}" && pwd) dirs_to_add+=( ${normalized_dir} ) @@ -808,9 +830,10 @@ subcommand_search() { local -r module=$1 # we must write temporary results to a file for sorting local -r tmpfile=$( mktemp /tmp/$(basename $0).XXXXXX ) || exit 1 - local family depth unused + local family # loop over all families - while read family depth unused; do + for family in $(get_families); do + local -i depth=$( compute_family_depth ${family} ) # get all potential directories of family $f with module-files local mpaths=( $(find \ "${modulepath_root}/${family}" \ @@ -841,7 +864,7 @@ subcommand_search() { ${family} "${requires}" >> "${tmpfile}" done done - done < "${PSI_PREFIX}/${PSI_CONFIG_DIR}/${PSI_FAMILY_CONF}" + done sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}" 1>&2 rm -f "${tmpfile}" diff --git a/scripts/Bootstrap/modulerc b/scripts/Bootstrap/modulerc deleted file mode 100644 index f7a7a28..0000000 --- a/scripts/Bootstrap/modulerc +++ /dev/null @@ -1,8 +0,0 @@ -#%Module1.0 - -setenv PSI_LIBMODULES "$env(PSI_PREFIX)/$env(PSI_CONFIG_DIR)/libmodules.tcl" - -if { ! [info exists env(PSI_LIBMODULES) ] } { - puts stderr "Module cannot be loaded, because the shell environment is not setup correctly." - exit 42 -} diff --git a/scripts/Bootstrap/profile.bash b/scripts/Bootstrap/profile.bash new file mode 100644 index 0000000..2949471 --- /dev/null +++ b/scripts/Bootstrap/profile.bash @@ -0,0 +1,39 @@ +#!/bin/bash + +############################################################################# +# read Pmodules configuration +# +_init_env_file="$(dirname ${BASH_SOURCE})/environment.bash" +if [[ ! -r "${_init_env_file}" ]]; then + echo "Oops: cannot initialize Modules!" + echo "${_init_env_file}: file does not exist or is not readable." + return 1 +fi +source "${_init_env_file}" +unset _init_env_file + +############################################################################ +# check configuration +# +if [[ ! -d ${PSI_PREFIX} ]] || [[ ! -d ${PMODULES_HOME} ]]; then + echo "Oops: cannot initialize module environment !" + return 1 +fi + +############################################################################ +# inititialize Pmodules for bash +# +_init_bash="${PMODULES_HOME}/init/bash" +if [[ ! -r "${_init_bash}" ]]; then + echo "Oops: cannot initialize Modules!" + echo "${_init_bash}: File does not exist or is not readable." + return 1 +fi +source "${_init_bash}" +unset _init_bash + +# Local Variables: +# mode: sh +# sh-basic-offset: 8 +# tab-width: 8 +# End: diff --git a/scripts/Compiler/H5root.build b/scripts/Compiler/H5root/build similarity index 90% rename from scripts/Compiler/H5root.build rename to scripts/Compiler/H5root/build index 46fe671..8de11a3 100755 --- a/scripts/Compiler/H5root.build +++ b/scripts/Compiler/H5root/build @@ -1,6 +1,6 @@ #!/bin/bash -source $(dirname $0)/../../lib/libem.bash +source $(dirname $0)/../../../lib/libem.bash function em.pre_configure() { ./autogen.sh diff --git a/scripts/Compiler/OpenBLAS.build b/scripts/Compiler/OpenBLAS/build similarity index 95% rename from scripts/Compiler/OpenBLAS.build rename to scripts/Compiler/OpenBLAS/build index 2c980fb..4707c8f 100755 --- a/scripts/Compiler/OpenBLAS.build +++ b/scripts/Compiler/OpenBLAS/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cat < "${MODULE_SRCDIR}/make.inc" diff --git a/scripts/Compiler/OpenBLAS_OMP.build b/scripts/Compiler/OpenBLAS_OMP/build similarity index 95% rename from scripts/Compiler/OpenBLAS_OMP.build rename to scripts/Compiler/OpenBLAS_OMP/build index ee48ee0..0bf5565 100755 --- a/scripts/Compiler/OpenBLAS_OMP.build +++ b/scripts/Compiler/OpenBLAS_OMP/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cat < "${MODULE_SRCDIR}/make.inc" diff --git a/scripts/Compiler/SuperLU.build b/scripts/Compiler/SuperLU/build similarity index 95% rename from scripts/Compiler/SuperLU.build rename to scripts/Compiler/SuperLU/build index ea85951..328d30f 100755 --- a/scripts/Compiler/SuperLU.build +++ b/scripts/Compiler/SuperLU/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cat < "${MODULE_SRCDIR}/make.inc" diff --git a/scripts/Compiler/UMFPACK.build b/scripts/Compiler/UMFPACK/build similarity index 95% rename from scripts/Compiler/UMFPACK.build rename to scripts/Compiler/UMFPACK/build index 7ee5afc..c4e11bd 100755 --- a/scripts/Compiler/UMFPACK.build +++ b/scripts/Compiler/UMFPACK/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cat < "${MODULE_SRCDIR}/SuiteSparse_config/SuiteSparse_config.mk" diff --git a/scripts/System/boost.build b/scripts/Compiler/boost/build similarity index 94% rename from scripts/System/boost.build rename to scripts/Compiler/boost/build index 6e68190..9d5797c 100755 --- a/scripts/System/boost.build +++ b/scripts/Compiler/boost/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" # :TODO: detect compiler TOOLSET=gcc diff --git a/scripts/System/gsl.build b/scripts/Compiler/gsl/build similarity index 90% rename from scripts/System/gsl.build rename to scripts/Compiler/gsl/build index c132951..fb32eac 100755 --- a/scripts/System/gsl.build +++ b/scripts/Compiler/gsl/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/System/hdf5_serial.build b/scripts/Compiler/hdf5_serial/build similarity index 86% rename from scripts/System/hdf5_serial.build rename to scripts/Compiler/hdf5_serial/build index 3b30c4f..38c8a3d 100755 --- a/scripts/System/hdf5_serial.build +++ b/scripts/Compiler/hdf5_serial/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/System/openmpi.build b/scripts/Compiler/openmpi/build similarity index 90% rename from scripts/System/openmpi.build rename to scripts/Compiler/openmpi/build index ba22b8c..30c7e06 100755 --- a/scripts/System/openmpi.build +++ b/scripts/Compiler/openmpi/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/System/root.build b/scripts/Compiler/root/build similarity index 95% rename from scripts/System/root.build rename to scripts/Compiler/root/build index a61ffcd..7a502e0 100755 --- a/scripts/System/root.build +++ b/scripts/Compiler/root/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" case ${OS} in Darwin ) diff --git a/scripts/System/vtk.build b/scripts/Compiler/vtk/build similarity index 94% rename from scripts/System/vtk.build rename to scripts/Compiler/vtk/build index c042cda..f83c828 100755 --- a/scripts/System/vtk.build +++ b/scripts/Compiler/vtk/build @@ -6,7 +6,7 @@ # and remove these strings. # -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" case ${OS} in Darwin ) diff --git a/scripts/HDF5/H5hut.build b/scripts/HDF5/H5hut/build similarity index 94% rename from scripts/HDF5/H5hut.build rename to scripts/HDF5/H5hut/build index 20c78d3..eb9097a 100755 --- a/scripts/HDF5/H5hut.build +++ b/scripts/HDF5/H5hut/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.pre_configure() { ./autogen.sh diff --git a/scripts/HDF5/netcdf.build b/scripts/HDF5/netcdf/build similarity index 91% rename from scripts/HDF5/netcdf.build rename to scripts/HDF5/netcdf/build index 62485ba..6f23e05 100755 --- a/scripts/HDF5/netcdf.build +++ b/scripts/HDF5/netcdf/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.pre_configure() { : diff --git a/scripts/HDF5_serial/H5hut_serial.build b/scripts/HDF5_serial/H5hut_serial/build similarity index 92% rename from scripts/HDF5_serial/H5hut_serial.build rename to scripts/HDF5_serial/H5hut_serial/build index 9a4370b..608109c 100755 --- a/scripts/HDF5_serial/H5hut_serial.build +++ b/scripts/HDF5_serial/H5hut_serial/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { (cd "${MODULE_SRCDIR}" && ./autogen.sh) diff --git a/scripts/Libraries/giflib.build b/scripts/Libraries/giflib/build similarity index 80% rename from scripts/Libraries/giflib.build rename to scripts/Libraries/giflib/build index 6f800ef..b99ddf3 100755 --- a/scripts/Libraries/giflib.build +++ b/scripts/Libraries/giflib/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Libraries/gmp.build b/scripts/Libraries/gmp/build similarity index 84% rename from scripts/Libraries/gmp.build rename to scripts/Libraries/gmp/build index 4f9bf17..86b67e9 100755 --- a/scripts/Libraries/gmp.build +++ b/scripts/Libraries/gmp/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Libraries/libungif.build b/scripts/Libraries/libungif/build similarity index 80% rename from scripts/Libraries/libungif.build rename to scripts/Libraries/libungif/build index 6f800ef..b99ddf3 100755 --- a/scripts/Libraries/libungif.build +++ b/scripts/Libraries/libungif/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Libraries/mpc.build b/scripts/Libraries/mpc/build similarity index 87% rename from scripts/Libraries/mpc.build rename to scripts/Libraries/mpc/build index 7db4393..eb28492 100755 --- a/scripts/Libraries/mpc.build +++ b/scripts/Libraries/mpc/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Libraries/mpfr.build b/scripts/Libraries/mpfr/build similarity index 86% rename from scripts/Libraries/mpfr.build rename to scripts/Libraries/mpfr/build index d4c1ab0..c3c2bf1 100755 --- a/scripts/Libraries/mpfr.build +++ b/scripts/Libraries/mpfr/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Libraries/tiff.build b/scripts/Libraries/tiff/build similarity index 80% rename from scripts/Libraries/tiff.build rename to scripts/Libraries/tiff/build index 6f800ef..b99ddf3 100755 --- a/scripts/Libraries/tiff.build +++ b/scripts/Libraries/tiff/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/MPI/BoxLib.build b/scripts/MPI/BoxLib/build similarity index 88% rename from scripts/MPI/BoxLib.build rename to scripts/MPI/BoxLib/build index a855b42..b0c4a33 100755 --- a/scripts/MPI/BoxLib.build +++ b/scripts/MPI/BoxLib/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { CC=$MPICC CXX=$MPICXX cmake \ diff --git a/scripts/MPI/OPAL.build b/scripts/MPI/OPAL/build similarity index 91% rename from scripts/MPI/OPAL.build rename to scripts/MPI/OPAL/build index 27c8d8b..c83c199 100755 --- a/scripts/MPI/OPAL.build +++ b/scripts/MPI/OPAL/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" module use unstable diff --git a/scripts/MPI/SuperLU_DIST.build b/scripts/MPI/SuperLU_DIST/build similarity index 95% rename from scripts/MPI/SuperLU_DIST.build rename to scripts/MPI/SuperLU_DIST/build index 7245ef3..6ac2d44 100755 --- a/scripts/MPI/SuperLU_DIST.build +++ b/scripts/MPI/SuperLU_DIST/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cat < "${MODULE_SRCDIR}/make.inc" diff --git a/scripts/System/hdf5.build b/scripts/MPI/hdf5/build similarity index 91% rename from scripts/System/hdf5.build rename to scripts/MPI/hdf5/build index 2e4493b..a99accd 100755 --- a/scripts/System/hdf5.build +++ b/scripts/MPI/hdf5/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { CC=$MPICC diff --git a/scripts/System/ippl.build b/scripts/MPI/ippl/build similarity index 90% rename from scripts/System/ippl.build rename to scripts/MPI/ippl/build index 3ecceb2..2fd66ea 100755 --- a/scripts/System/ippl.build +++ b/scripts/MPI/ippl/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { CC=$MPICC diff --git a/scripts/System/optPilot.build b/scripts/MPI/optPilot/build similarity index 91% rename from scripts/System/optPilot.build rename to scripts/MPI/optPilot/build index b1d73f8..f6e5e83 100755 --- a/scripts/System/optPilot.build +++ b/scripts/MPI/optPilot/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" module use unstable diff --git a/scripts/System/parmetis.build b/scripts/MPI/parmetis/build similarity index 95% rename from scripts/System/parmetis.build rename to scripts/MPI/parmetis/build index 1f1ec61..3338247 100755 --- a/scripts/System/parmetis.build +++ b/scripts/MPI/parmetis/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { CC=$MPICC diff --git a/scripts/System/trilinos.build b/scripts/MPI/trilinos/build similarity index 98% rename from scripts/System/trilinos.build rename to scripts/MPI/trilinos/build index a79f5b0..64b87e6 100755 --- a/scripts/System/trilinos.build +++ b/scripts/MPI/trilinos/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" declare -rx AR=ar diff --git a/scripts/Programming/Python.build b/scripts/Programming/Python/build similarity index 90% rename from scripts/Programming/Python.build rename to scripts/Programming/Python/build index fed0766..4475082 100755 --- a/scripts/Programming/Python.build +++ b/scripts/Programming/Python/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/Tcl.build b/scripts/Programming/Tcl/build similarity index 90% rename from scripts/Programming/Tcl.build rename to scripts/Programming/Tcl/build index 0adbeab..402004d 100755 --- a/scripts/Programming/Tcl.build +++ b/scripts/Programming/Tcl/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { case ${OS} in diff --git a/scripts/Programming/autoconf.build b/scripts/Programming/autoconf/build similarity index 89% rename from scripts/Programming/autoconf.build rename to scripts/Programming/autoconf/build index 431b95a..e3bf580 100755 --- a/scripts/Programming/autoconf.build +++ b/scripts/Programming/autoconf/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/automake.build b/scripts/Programming/automake/build similarity index 89% rename from scripts/Programming/automake.build rename to scripts/Programming/automake/build index 7c6bebc..481d812 100755 --- a/scripts/Programming/automake.build +++ b/scripts/Programming/automake/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/cmake.build b/scripts/Programming/cmake/build similarity index 79% rename from scripts/Programming/cmake.build rename to scripts/Programming/cmake/build index 137f989..ffb9212 100755 --- a/scripts/Programming/cmake.build +++ b/scripts/Programming/cmake/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}/bootstrap" --prefix="${PREFIX}" diff --git a/scripts/Programming/gcc.build b/scripts/Programming/gcc/build similarity index 93% rename from scripts/Programming/gcc.build rename to scripts/Programming/gcc/build index 7ae5406..7c9ad60 100755 --- a/scripts/Programming/gcc.build +++ b/scripts/Programming/gcc/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/gtest.build b/scripts/Programming/gtest/build similarity index 73% rename from scripts/Programming/gtest.build rename to scripts/Programming/gtest/build index 65d3110..dbca446 100755 --- a/scripts/Programming/gtest.build +++ b/scripts/Programming/gtest/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" em.add_to_family 'Programming' em.set_runtime_dependencies "" diff --git a/scripts/Programming/libtool.build b/scripts/Programming/libtool/build similarity index 86% rename from scripts/Programming/libtool.build rename to scripts/Programming/libtool/build index 8df068a..e6b1ba6 100755 --- a/scripts/Programming/libtool.build +++ b/scripts/Programming/libtool/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/lua.build b/scripts/Programming/lua.build deleted file mode 100755 index f02bdfc..0000000 --- a/scripts/Programming/lua.build +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Lua cannot be build in a seperate directory! -# - -source "$(dirname $0)/../../lib/libem.bash" - -function em.configure() { - cd "${MODULE_SRCDIR}" - "${MODULE_SRCDIR}"/configure \ - --prefix="${PREFIX}" \ - || exit 1 -} - -function em.build() { - cd "${MODULE_SRCDIR}" - - make -j ${JOBS} -} - -em.supported_os '' -em.add_to_family 'Programming' -em.set_build_dependencies "${COMPILER}" -em.make_all -em.cleanup_src diff --git a/scripts/Programming/m4.build b/scripts/Programming/m4/build similarity index 81% rename from scripts/Programming/m4.build rename to scripts/Programming/m4/build index cfc5cc0..82c5b86 100755 --- a/scripts/Programming/m4.build +++ b/scripts/Programming/m4/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Programming/psi-python27.build b/scripts/Programming/psi-python27/build similarity index 83% rename from scripts/Programming/psi-python27.build rename to scripts/Programming/psi-python27/build index 08f970e..9fce1c3 100755 --- a/scripts/Programming/psi-python27.build +++ b/scripts/Programming/psi-python27/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { : diff --git a/scripts/System/bash.build b/scripts/System/bash.build deleted file mode 100755 index 122c5f9..0000000 --- a/scripts/System/bash.build +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../../lib/libem.bash" - -function em.configure() { - "${MODULE_SRCDIR}"/configure \ - --prefix="${PREFIX}" \ - || exit 1 -} - -em.add_to_family 'System' -em.set_build_dependencies "${COMPILER}" -em.make_all diff --git a/scripts/System/filebench.build b/scripts/System/filebench/build similarity index 81% rename from scripts/System/filebench.build rename to scripts/System/filebench/build index baa0b4b..d919ff2 100755 --- a/scripts/System/filebench.build +++ b/scripts/System/filebench/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/System/fsstress.build b/scripts/System/fsstress/build similarity index 88% rename from scripts/System/fsstress.build rename to scripts/System/fsstress/build index 19b3334..f43ae43 100755 --- a/scripts/System/fsstress.build +++ b/scripts/System/fsstress/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { : diff --git a/scripts/System/getopt.build b/scripts/System/getopt.build deleted file mode 100755 index e502f0e..0000000 --- a/scripts/System/getopt.build +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../../lib/libem.bash" - -function em.configure() { - : -} - -function em.build() { - case ${OS} in - Linux ) - declare -x LDFLAGS="-lintl -liconv" - ;; - Darwin ) - declare -x LDFLAGS="-lintl -liconv -framework CoreFoundation" - ;; - esac - - cd "${MODULE_SRCDIR}" - make -e -} - -function em.install() { - cd "${MODULE_SRCDIR}" - declare -x DESTDIR="${PREFIX}" - declare -x prefix='' - make -e install -} - -function em.cleanup_build() { - cd "${MODULE_SRCDIR}" - make -e realclean -} - -em.add_to_family 'Tools' -em.make_all - -# Local Variables: -# mode: sh -# sh-basic-offset: 8 -# tab-width: 8 -# End: diff --git a/scripts/System/mathlib.build b/scripts/System/mathlib.build deleted file mode 100755 index 58e4052..0000000 --- a/scripts/System/mathlib.build +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../lib/libem.bash" - -function em.configure() { - : -} - -function em.build() { - cd "${MODULE_SRCDIR}" - - - install -m 0755 -d "${PREFIX}/include" - install -m 0755 -d "${PREFIX}/lib" - install -m 0755 -d "${DOCDIR}/lapack" - - ( - cp make.inc.blas BLAS/make.inc - cd BLAS - make -e -j3 || exit 1 - install -m 0644 libblas.a "${PREFIX}/lib" || exit 1 - ) || exit 1 - - ( - cp make.inc.cblas CBLAS/Makefile.in - cd CBLAS - make -e || exit 1 - install -m 0644 include/* "${PREFIX}/include" || exit 1 - install -m 0644 lib/* "${PREFIX}/lib" || exit 1 - ) || exit 1 - ( - cp make.inc.lapack lapack/make.inc - cd lapack - make -e -j3 || exit 1 - make -e -j3 lapackelib || exit 1 - install -m 0644 lapacke/include/* "${PREFIX}/include" || exit 1 - install -m 0644 lib*.a "${PREFIX}/lib" || exit 1 - install -m 0444 README LICENSE "${DOCDIR}/lapack" - ) || exit 1 -} - -function em.install() { - : -} - -em.add_to_family 'Compiler' -em.set_runtime_dependencies "${COMPILER}" -em.set_build_dependencies "${COMPILER}" -em.make_all -em.cleanup_src diff --git a/scripts/System/nmap.build b/scripts/System/nmap/build similarity index 91% rename from scripts/System/nmap.build rename to scripts/System/nmap/build index 69a3e3a..aaf593f 100755 --- a/scripts/System/nmap.build +++ b/scripts/System/nmap/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { cd "${MODULE_SRCDIR}" diff --git a/scripts/System/patchelf.build b/scripts/System/patchelf/build similarity index 81% rename from scripts/System/patchelf.build rename to scripts/System/patchelf/build index baa0b4b..d919ff2 100755 --- a/scripts/System/patchelf.build +++ b/scripts/System/patchelf/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Tools/Modules.build b/scripts/Tools/Modules.build deleted file mode 100755 index 171be58..0000000 --- a/scripts/Tools/Modules.build +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../../lib/libem.bash" - -TCL_VERSION='8.6.3' -TCL_DIR="${PSI_PREFIX}/Programming/Tcl/${TCL_VERSION}" - -PATH="${TCL_DIR}/bin:${PATH}" - -case ${OS} in -Linux ) - declare -x LIBS="-lz -lpthread" - ;; -Darwin ) - declare -x LIBS="-lz -framework CoreFoundation" - ;; -esac - -function em.configure() { - CPPFLAGS="-DUSE_INTERP_ERRORLINE" "${MODULE_SRCDIR}"/configure \ - --prefix="${PSI_PREFIX}/${MODULE_FAMILY}" \ - --with-module-path="${PSI_PREFIX}/${PSI_MODULES_ROOT}" \ - --with-tcl="${TCL_DIR}/lib" \ - --without-x \ - || exit 1 -} -# fake module command -module() { - : -} - -# use system gcc to compile -declare -rx CC=gcc - -em.add_to_family 'Tools' -em.set_build_dependencies "Tcl/${TCL_VERSION}" -em.make_all diff --git a/scripts/Tools/dialog.build b/scripts/Tools/dialog.build deleted file mode 100755 index b5d7a1d..0000000 --- a/scripts/Tools/dialog.build +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../../lib/libem.bash" - -function em.configure() { - "${MODULE_SRCDIR}"/configure \ - --prefix="${PREFIX}" \ - || exit 1 -} - -em.add_to_family 'Tools' -em.set_build_dependencies "${COMPILER}" -em.make_all diff --git a/scripts/Tools/emacs.build b/scripts/Tools/emacs/build similarity index 95% rename from scripts/Tools/emacs.build rename to scripts/Tools/emacs/build index c436bd2..13774aa 100755 --- a/scripts/Tools/emacs.build +++ b/scripts/Tools/emacs/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" module use 'Libraries' diff --git a/scripts/Tools/gettext.build b/scripts/Tools/gettext.build deleted file mode 100755 index 56463f6..0000000 --- a/scripts/Tools/gettext.build +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../../lib/libem.bash" - -function em.configure() { - "${MODULE_SRCDIR}"/configure \ - --prefix="${PREFIX}" \ - --disable-java \ - --disable-threads \ - --disable-shared \ - --enable-relocatable \ - --disable-openmp \ - --disable-acl \ - --disable-curses \ - --with-included-gettext \ - --without-libiconv-prefix \ - --without-libintl-prefix \ - --with-included-libxml \ - || exit 1 -} - -em.add_to_family 'Tools' -em.set_build_dependencies "${COMPILER}" -em.make_all diff --git a/scripts/Tools/global.build b/scripts/Tools/global/build similarity index 89% rename from scripts/Tools/global.build rename to scripts/Tools/global/build index 6a0b3a1..7d163b4 100755 --- a/scripts/Tools/global.build +++ b/scripts/Tools/global/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Tools/gnuplot.build b/scripts/Tools/gnuplot/build similarity index 88% rename from scripts/Tools/gnuplot.build rename to scripts/Tools/gnuplot/build index 034a143..41ba752 100755 --- a/scripts/Tools/gnuplot.build +++ b/scripts/Tools/gnuplot/build @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname $0)/../../lib/libem.bash" +source "$(dirname $0)/../../../lib/libem.bash" function em.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/change_release b/scripts/change_release deleted file mode 100755 index 7dff17a..0000000 --- a/scripts/change_release +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../lib/lib.bash" - -change_release() { - local m=$1 - local with_modules=() - shift - shift - shift - while (( $# > 0 )); do - with_modules+=( "--with=$1" ) - shift - done - "$(dirname $0)/${m%/*}.build" "${m#*/}" "${with_modules[@]}" "--release=${release}" -} - -declare usecmd="${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/use.bash" -declare searchcmd="${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/search.bash" - -# :FIXME: this does not work ... -#eval "${usecmd} deprecated" -#eval "${usecmd} unstable" - -release='' -with_modules=() -modules=() -while (( $# > 0 )); do - case $1 in - --release=* ) - release=${1/--release=} - ;; - --with=*/* ) - with_modules+=( ${1} ) - ;; - -* ) - die 1 "$1: illegal argument" - ;; - */* ) - modules+=( $1 ) - ;; - * ) - die 1 "$1: illegal argument" - ;; - esac - shift -done - -#[[ -z ${from_release} ]] && die 1 "--from-release missing" -[[ -z ${release} ]] && die 1 "--release missing" -while read -a tokens ; do - echo "${tokens[@]}" - change_release "${tokens[@]}" -done < <("${searchcmd}" "${modules[@]}" --no-header -a "${with_modules[@]}" 2>&1) diff --git a/scripts/family.build b/scripts/family.build deleted file mode 100755 index d8795a8..0000000 --- a/scripts/family.build +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -source "$(dirname $0)/../lib/lib.bash" - -family=$1 -shift - -modules=$(egrep -l "[:space:]*[\"\']$family[\"\']" "$(dirname $0)"/*.build || :) - -for m in ${modules}; do - "$m" "$@" -done