Merge branch 'master' of gitorious.psi.ch:pmodules/src

Conflicts:
	scripts/Bootstrap/Pmodules/libpmodules.bash
	scripts/Bootstrap/Pmodules/modmanage.in
This commit is contained in:
2015-04-13 15:35:25 +02:00
31 changed files with 521 additions and 256 deletions

View File

@@ -1,17 +1,4 @@
declare -x PMODULES_VERSION=0.99.1
declare -x MODULES_VERSION=3.2.10
declare -a COMPILER_VERSIONS=( 'gcc/4.7.4' 'gcc/4.8.3' 'gcc/4.8.4' 'gcc/4.9.2' )
declare -a MPI_VERSIONS=( 'openmpi/1.6.5' 'openmpi/1.8.2' 'openmpi/1.8.4' )
declare -a HDF5_VERSIONS=( 'hdf5/1.8.12' 'hdf5/1.8.14' )
declare COMPILER='gcc'
declare COMPILER_VERSION='4.8.4'
declare GCC_VERSION="${COMPILER_VERSION}"
declare MPI='openmpi'
declare MPI_VERSION='1.8.4'
declare OPENMPI_VERSION="${MPI_VERSION}"
declare HDF5='hdf5/1.8.12'
declare HDF5_serial='hdf5_serial/1.8.12'
declare -a HDF5_SERIAL_VERSIONS=( 'hdf5_serial/1.8.12' 'hdf5_serial/1.8.14' )

View File

@@ -19,7 +19,7 @@ H5hut 1.99.13
H5root 1.2.0
hdf5_serial 1.8.14
hdf5 1.8.14
ippl 1.1.3
ippl 1.1.4
libtool 2.4.2
libungif 4.1.4
lua 5.1.4.5

View File

@@ -2,10 +2,14 @@
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
# disable auto-echo feature of 'cd'
unset CDPATH
shopt -s expand_aliases
declare -r BUILDSCRIPT=$( cd $(dirname "$0") && pwd )/$(basename "$0")
declare -r BUILDSCRIPT_DIR=$( cd $(dirname "$0") && pwd )
declare -r BUILDSCRIPT="${BUILDSCRIPT_DIR}"/$(basename "$0")
declare -rx ARGS="$@"
declare -rx SHLIBDIR=$( cd $(dirname "$BASH_SOURCE") && pwd )
declare -r OS=$(uname -s)
@@ -25,16 +29,7 @@ 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
#for f in "${BUILD_CONFIGDIR}/families.d/"*.conf; do
# source "${f}"
#done
source "${BUILD_CONFIGDIR}/Pmodules.conf"
#source "${BUILD_CONFIGDIR}/Pmodules.conf"
declare -x PREFIX=''
declare -x DOCDIR=''
@@ -59,7 +54,8 @@ declare -x LIBRARY_PATH
declare -x LD_LIBRARY_PATH
declare -x DYLD_LIBRARY_PATH
##############################################################################
#
function usage() {
error "
Usage: $0 [OPTIONS..] [VERSION] [ENV=VALUE...]
@@ -96,89 +92,26 @@ ENV=VALUE
exit 1
}
debug_on='no'
force_rebuild='no'
ENVIRONMENT_ARGS=''
dry_run='no'
bootstrap='no'
# array collecting all modules specified on the command line via '--with=module'
with_modules=()
while (( $# > 0 )); do
case $1 in
-j )
JOBS=$2
shift
;;
--jobs=[0-9]* )
JOBS=${1/--jobs=}
;;
-v | --verbose)
debug_on='yes'
;;
-f | --force-rebuild )
force_rebuild='yes'
;;
-b | --bootstrap )
bootstrap='yes'
force_rebuild='yes'
;;
-? | -h | --help )
usage
;;
--dry-run )
dry_run='yes'
;;
--release=* )
MODULE_RELEASE=${1/--release=}
;;
--with=*/* )
with_modules+=( ${1/--with=} )
;;
*=* )
eval $1
ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1"
;;
* )
V=$1
;;
esac
shift
done
if [[ ${debug_on} == yes ]]; then
trap 'echo "$BASH_COMMAND"' DEBUG
fi
# while bootstraping the module command is not yet available
if [[ ${bootstrap} == no ]]; then
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 $(dirname "${BUILDSCRIPT}"))
_P=$(echo $P | tr [:lower:] [:upper:])
_P=${_P//-/_}
_V=${_P}_VERSION
eval "${ENVIRONMENT_ARGS}"
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
##############################################################################
#
# test whether a the string passed in $1 is a valid release name
#
# $1: string to be tested
#
is_release () {
[[ ${releases} =~ :$1: ]]
}
##############################################################################
#
# test whether a module is loaded or not
#
# $1: module name
#
em.is_loaded() {
[[ :${LOADEDMODULES}: =~ :$1: ]]
}
function em.set_release() {
is_release "$1" || die 1 "$P: unknown release type: $1"
[[ "$1" == "deprecated" ]] && die 0 "$P: is deprecated, we don't rebuild it."
@@ -223,16 +156,6 @@ 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
if module_is_available "$m"; then
echo "Loading module: ${m}"
module load "${m}"
else
die 44 "$m: module not available!"
fi
done
for m in "${MODULE_BUILD_DEPENDENCIES[@]}"; do
[[ -z $m ]] && continue
if [[ ! $m =~ "*/*" ]]; then
@@ -243,6 +166,7 @@ function _load_build_dependencies() {
echo "$m: warning: No version set, loading default ..."
fi
fi
em.is_loaded "$m" && continue
if ! module_is_available "$m"; then
debug "${m}: module not available"
local rels=( ${releases//:/ } )
@@ -344,8 +268,12 @@ function _write_build_dependencies() {
done
}
# setup general environment
function _setup_env1() {
##############################################################################
#
# cleanup environment
#
em.cleanup_env() {
C_INCLUDE_PATH=''
CPLUS_INCLUDE_PATH=''
CPP_INCLUDE_PATH=''
@@ -358,13 +286,23 @@ function _setup_env1() {
CXXFLAGS=''
LIBS=''
LDFLAGS=''
}
##############################################################################
#
# load default versions
#
_setup_env1() {
local varname=''
while read _name _version; do
[[ -z ${_name} ]] && continue
[[ -z ${_version} ]] && continue
[[ "${_name:0:1}" == '#' ]] && continue
_NAME=$(echo ${_name} | tr [:lower:] [:upper:])
eval ${_NAME}_VERSION=$_version
var_name=$(echo ${_name} | tr [:lower:] [:upper:])_VERSION
# don't set version, if already set
if [[ -z ${!var_name} ]]; then
eval ${var_name}="${_version}"
fi
done < "${BUILD_VERSIONSFILE}"
}
@@ -438,13 +376,24 @@ function _setup_env2() {
MODULE_NAME+="${HDF5}/${HDF5_VERSION}/"
MODULE_NAME+="${P}/${V}"
;;
OPAL )
MODULE_RPREFIX="${P}/${V}"
MODULE_RPREFIX+="/${OPAL}/${OPAL_VERSION}"
MODULE_RPREFIX+="/${MPI}/${MPI_VERSION}"
MODULE_RPREFIX+="/${COMPILER}/${COMPILER_VERSION}"
MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/"
MODULE_NAME+="${MPI}/${MPI_VERSION}/"
MODULE_NAME+="${OPAL}/${OPAL_VERSION}/"
MODULE_NAME+="${P}/${V}"
;;
HDF5_serial )
MODULE_RPREFIX="${P}/${V}"
MODULE_RPREFIX+="/hdf5_serial/${HDF5_SERIAL_VERSION}"
MODULE_RPREFIX+="/${COMPILER}/${COMPILER_VERSION}"
MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/"
MODULE_NAME+="hdf5_serial/${HDF5_VERSION}/"
MODULE_NAME+="hdf5_serial/${HDF5_SERIAL_VERSION}/"
MODULE_NAME+="${P}/${V}"
;;
* )
@@ -523,58 +472,56 @@ function _setup_env2() {
}
if [[ ${bootstrap} == yes ]]; then
# redefine function for bootstrapping
function _setup_env2() {
if [[ -z ${MODULE_FAMILY} ]]; then
# redefine function for bootstrapping
function _setup_env2_bootstrap() {
if [[ -z ${MODULE_FAMILY} ]]; then
die 1 "$P: family not set."
fi
fi
if [[ -z $V ]]; then
if [[ -z $V ]]; then
V=$(eval echo \$${_P}_VERSION)
fi
fi
# oops, we need a version
if [[ -z $V ]]; then
# oops, we need a version
if [[ -z $V ]]; then
die 1 "$P: Missing version."
fi
MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V"
MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V"
MODULE_FAMILY='Tools'
MODULE_NAME="Pmodules/${PMODULES_VERSION}"
# set PREFIX of module
PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_NAME}"
MODULE_RELEASE='unstable'
info "${MODULE_NAME}: will be released as \"${MODULE_RELEASE}\""
fi
MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V"
MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V"
MODULE_FAMILY='Tools'
MODULE_NAME="Pmodules/${PMODULES_VERSION}"
# set PREFIX of module
PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_NAME}"
MODULE_RELEASE='unstable'
info "${MODULE_NAME}: will be released as \"${MODULE_RELEASE}\""
# directory for README's, license files etc
DOCDIR="${PREFIX}/share/doc/$P"
# directory for README's, license files etc
DOCDIR="${PREFIX}/share/doc/$P"
# set tar-ball and flags for tar
TARBALL="${BUILD_DOWNLOADSDIR}/${P/_serial}"
if [[ -r "${TARBALL}-${V}.tar.gz" ]]; then
TARBALL+="-${V}.tar.gz"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.gz" ]]; then
TARBALL+="-${OS}-${V}.tar.gz"
elif [[ -r "${TARBALL}-${V}.tar.bz2" ]]; then
TARBALL+="-${V}.tar.bz2"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.bz2" ]]; then
TARBALL+="-${OS}-${V}.tar.bz2"
else
error "tar-ball for $P/$V not found."
exit 43
fi
C_INCLUDE_PATH="${PREFIX}/include"
CPLUS_INCLUDE_PATH="${PREFIX}/include"
CPP_INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
LD_LIBRARY_PATH="${PREFIX}/lib"
DYLD_LIBRARY_PATH="${PREFIX}/lib"
# set tar-ball and flags for tar
TARBALL="${BUILD_DOWNLOADSDIR}/${P/_serial}"
if [[ -r "${TARBALL}-${V}.tar.gz" ]]; then
TARBALL+="-${V}.tar.gz"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.gz" ]]; then
TARBALL+="-${OS}-${V}.tar.gz"
elif [[ -r "${TARBALL}-${V}.tar.bz2" ]]; then
TARBALL+="-${V}.tar.bz2"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.bz2" ]]; then
TARBALL+="-${OS}-${V}.tar.bz2"
else
error "tar-ball for $P/$V not found."
exit 43
fi
C_INCLUDE_PATH="${PREFIX}/include"
CPLUS_INCLUDE_PATH="${PREFIX}/include"
CPP_INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
LD_LIBRARY_PATH="${PREFIX}/lib"
DYLD_LIBRARY_PATH="${PREFIX}/lib"
PATH+=":${PREFIX}/bin"
}
fi
PATH+=":${PREFIX}/bin"
}
function _prep() {
@@ -637,14 +584,14 @@ function _set_link() {
}
function em.cleanup_build() {
(
[[ -d /${MODULE_BUILDDIR} ]] || return 0
cd "/${MODULE_BUILDDIR}/..";
if [[ $(pwd) != / ]]; then
echo "Cleaning up $(pwd)/${COMPILER_VERSION}"
rm -rf *
fi
);
[[ -n "${MODULE_BUILDDIR}" ]] \
|| die 1 "Oops: internal error: MODULE_BUILDDIR is set to empty string..."
[[ "${MODULE_BUILDDIR}" == "/" ]] \
&& die 1 "Oops: internal error: MODULE_BUILDDIR is set to '/'..."
[[ -d "/${MODULE_BUILDDIR}" ]] \
|| die 1 "Oops: internal error: MODULE_BUILDDIR=${MODULE_BUILDDIR} is not a directory..."
echo "Cleaning up '/${MODULE_BUILDDIR}'..."
rm -rf "/${MODULE_BUILDDIR}"
}
function em.cleanup_src() {
@@ -685,13 +632,19 @@ function _post_install() {
}
function em.make_all() {
local building='no'
echo "${P}:"
_setup_env1
_load_build_dependencies
# setup module specific environment
_setup_env2
if [[ ${bootstrap} == no ]]; then
_setup_env2
else
_setup_env2_bootstrap
fi
if [[ ! -d "${PREFIX}" ]] || [[ ${force_rebuild} == 'yes' ]]; then
building='yes'
echo "Building $P/$V ..."
[[ ${dry_run} == yes ]] && die 0 ""
_check_compiler
@@ -716,9 +669,104 @@ function em.make_all() {
if [[ ${bootstrap} == 'no' ]]; then
_set_link
fi
em.cleanup_build
[[ ${building} == yes ]] && em.cleanup_build
return 0
}
##############################################################################
#
debug_on='no'
force_rebuild='no'
ENVIRONMENT_ARGS=''
dry_run='no'
bootstrap='no'
em.cleanup_env
# array collecting all modules specified on the command line via '--with=module'
with_modules=()
if [[ -r "${BUILDSCRIPT_DIR}/with_modules" ]]; then
with_modules+=( $(cat "${BUILDSCRIPT_DIR}/with_modules") )
fi
while (( $# > 0 )); do
case $1 in
-j )
JOBS=$2
shift
;;
--jobs=[0-9]* )
JOBS=${1/--jobs=}
;;
-v | --verbose)
debug_on='yes'
;;
-f | --force-rebuild )
force_rebuild='yes'
;;
-b | --bootstrap )
bootstrap='yes'
force_rebuild='yes'
;;
-? | -h | --help )
usage
;;
--dry-run )
dry_run='yes'
;;
--release=* )
MODULE_RELEASE=${1/--release=}
;;
--with=*/* )
with_modules+=( ${1/--with=} )
;;
*=* )
eval $1
ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1"
;;
* )
V=$1
;;
esac
shift
done
if [[ ${debug_on} == yes ]]; then
trap 'echo "$BASH_COMMAND"' DEBUG
fi
# while bootstraping the module command is not yet available
if [[ ${bootstrap} == no ]]; then
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
for m in "${with_modules[@]}"; do
if module_is_available "$m"; then
echo "Loading module: ${m}"
module load "${m}"
else
die 44 "$m: module not available!"
fi
done
fi
P=$(basename $(dirname "${BUILDSCRIPT}"))
_P=$(echo $P | tr [:lower:] [:upper:])
_P=${_P//-/_}
_V=${_P}_VERSION
eval "${ENVIRONMENT_ARGS}"
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
# Local Variables:
# mode: sh
# sh-basic-offset: 8

View File

@@ -1,2 +1,3 @@
environment.bash
modulecmd
modmanage.bash

View File

@@ -2,7 +2,7 @@
#set -o functrace
source "$(dirname $0)/../../../lib/libem.bash"
TCL_DIR="${PSI_PREFIX}/Tools/Pmodules/0.99.0"
TCL_DIR="${PSI_PREFIX}/Tools/Pmodules/${PMODULES_VERSION}"
PATH="${TCL_DIR}/bin:${PATH}"

View File

@@ -90,27 +90,50 @@ prepend_path () {
fi
}
#
# Replace or remove a directory in a path variable.
#
# To remove a dir:
# replace_path PATH <pattern>
#
# To replace a dir:
# replace_path PATH <pattern> /replacement/path
#
# Args:
# $1 name of the shell variable to set (e.g. PATH)
# $2 a grep pattern identifying the element to be removed/replaced
# $3 the replacement string (use "" for removal)
#
# Based on solution published here:
# https://stackoverflow.com/questions/273909/how-do-i-manipulate-path-elements-in-shell-scripts
#
function replace_path () {
local -r path=$1
local -r removepat=$2
local -r replacestr=$3
local -r removestr=$(echo "${!path}" | tr ":" "\n" | grep -m 1 "^$removepat\$")
export $path=$(echo "${!path}" | tr ":" "\n" | sed "s:^${removestr}\$:${replacestr}:" |
sed '/^\s*$/d' | tr "\n" ":" | sed -e 's|^:||' -e 's|:$||')
}
module purge
#############################################################################
# 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
declare -x LOADEDMODULES=''
declare -x PSI_LOADEDFAMILIES=''
declare -x MODULEPATH=''
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"
replace_path PATH "${PMODULES_HOME%/*}/.*"
replace_path MANPATH "${PMODULES_HOME%/*}/.*"
append_path PATH "${PMODULES_HOME}/bin"
append_path MANPATH "${PMODULES_HOME}/share/man"
#############################################################################
# initialize bash completion
@@ -122,10 +145,9 @@ fi
#############################################################################
# legacy...
#
declare -x MODULE_VERSION=${PMODULES_VERSION}
declare -x MODULE_VERSION_STACK="${PMODULE_VERSION}"
declare -x MODULESHOME="${PMODULES_HOME}"
unset MODULE_VERSION
unset MODULE_VERSION_STACK
unset MODULESHOME
# Local Variables:
# mode: sh

View File

@@ -338,7 +338,7 @@ function module_picker() {
# if DIALOG_LIB is NOT set, call module picker
[[ ${DIALOG_LIB:+"is_lib"} == "is_lib" ]] || {
if [[ -x ${PMODULES_HOME}/bin/modulecmd ]]; then
module_picker "$1" < <(${PMODULES_HOME}/bin/modulecmd bash search --no-header -a 2>&1)
module_picker "${1:-$PSI_PREFIX}" < <(${PMODULES_HOME}/bin/modulecmd bash search --src="${2:-/afs/psi.ch/sys/psi.x86_64_slp6}" --no-header -a 2>&1)
else
echo "ERROR: module environment configuration: ${PMODULES_HOME}/bin/modulecmd is not an executable!"
fi

View File

@@ -3,7 +3,7 @@
declare -x PSI_PREFIX=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd)
if [[ -z ${PMODULES_VERSION} ]]; then
declare -x PMODULES_VERSION="0.99.1"
declare -x PMODULES_VERSION="@PMODULES_VERSION@"
fi
declare -x PMODULES_HOME="${PSI_PREFIX}/Tools/Pmodules/${PMODULES_VERSION}"

View File

@@ -181,6 +181,8 @@ proc set_std_environment { PREFIX name version } {
if { [lsearch ${::dont-setenv} "${NAME}_HOME"] == -1 } {
setenv ${NAME}_HOME $PREFIX
}
} else {
debug "$PREFIX is not a directory"
}
if { [file isdirectory "$PREFIX/bin"] } {

View File

@@ -58,22 +58,30 @@ get_options() {
"${bindir}/getopt" "$@"
}
check_pmodules_env() {
check_pmodules_env_vars() {
[[ -n "${PSI_PREFIX}" ]] &&
[[ -n "${PSI_CONFIG_DIR}" ]] &&
[[ -n "${PSI_MODULES_ROOT}" ]] &&
[[ -n "${PSI_TEMPLATES_DIR}" ]] &&
[[ -n "${PMODULES_HOME}" ]] &&
[[ -n "${PMODULES_VERSION}" ]] || die 1 "
Error: not running within a valid module environment!"
Error: the module environment you are going to use as source has not been
initialized properly!"
}
[[ -d "${PSI_PREFIX}" ]] &&
[[ -d "${PSI_PREFIX}/${PSI_CONFIG_DIR}" ]] &&
[[ -d "${PSI_PREFIX}/${PSI_MODULES_ROOT}" ]] &&
[[ -d "${PSI_PREFIX}/${PSI_TEMPLATES_DIR}" ]] &&
[[ -d "${PMODULES_HOME}" ]] || die 1 "
Error: the module environment '$PSI_PREFIX' is invalid!"
check_pmodules_directories() {
local -r src_prefix="$1"
[[ -d "${src_prefix}" ]] &&
[[ -d "${src_prefix}/${PSI_CONFIG_DIR}" ]] &&
[[ -d "${src_prefix}/${PSI_MODULES_ROOT}" ]] &&
[[ -d "${src_prefix}/${PSI_TEMPLATES_DIR}" ]] &&
[[ -d "${src_prefix}/Tools/Pmodules/${PMODULES_VERSION}" ]] || die 1 "
Error: the module environment '${src_prefix}' has not been initialized properly!"
}
check_pmodules_env() {
check_pmodules_env_vars
check_pmodules_directories "${PSI_PREFIX}"
}

View File

@@ -1,5 +1,7 @@
#!@PMODULES_HOME@/bin/bash
unset CDPATH
shopt -s expand_aliases
declare -r bindir=$(cd $(dirname "$0") && pwd)
@@ -25,7 +27,7 @@ Switches:
--force force overwrite
Available SubCommands and Args:
init [--src=<src>] [--user=<user>] --dst=<dst>
init [--src=<src>] [--user=<user>] <dst>
Initialize a new minimal Pmodule environment.
install <module> [--with=<dep>...]
@@ -54,7 +56,7 @@ init [--src=<src>] [--user=<user>] <dst>
subcommand_help_install() {
echo "
install <module> [--with=<dep>...]
install <module>... [--with=<dep>...] [--release=<release>...] [--src=<src>]
Install matching modules
" 1>&2
}
@@ -125,11 +127,12 @@ sync_module() {
local -r rel_module_prefix=$( get_module_prefix "${rel_modulefile}" )
local -r rel_releasefile=$( get_releasefile_name "${rel_modulefile}" )
$DRY mkdir -p "${target_prefix}/${rel_module_prefix}" || return $?
$DRY rsync --links --perms --recursive --delete \
"${src_prefix}/${rel_module_prefix}/" \
"${target_prefix}/${rel_module_prefix}/" || return $?
if [[ ! -d "${target_prefix}/${rel_module_prefix}" ]] || [[ "${force}" == 'yes' ]]; then
$DRY mkdir -p "${target_prefix}/${rel_module_prefix}" || return $?
$DRY rsync --links --perms --recursive --delete \
"${src_prefix}/${rel_module_prefix}/" \
"${target_prefix}/${rel_module_prefix}/" || return $?
fi
local -r src_modulefile="${src_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}"
local -r src_releasefile="${src_prefix}/${PSI_MODULES_ROOT}/${rel_releasefile}"
local -r target_modulefile="${target_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}"
@@ -174,7 +177,7 @@ subcommand_init() {
local target_prefixes=()
local user=''
local opts=''
opts=$(get_options -o h -l src: -l user: -l help -- "$@")
opts=$(get_options -o h -l src: -l user: -l help -l version: -- "$@")
if [[ $? != 0 ]]; then
subcommand_help_init
exit 1
@@ -190,6 +193,10 @@ subcommand_init() {
user=$2
shift
;;
--version )
PMODULES_VERSION=$2
shift
;;
-- )
:
;;
@@ -231,6 +238,7 @@ environment at '${PSI_PREFIX}'
"
init_pmodules_environment() {
local -r src_prefix="${PSI_PREFIX}"
local -r target_prefix=$1
local src=''
local dst=''
@@ -250,12 +258,23 @@ environment at '${PSI_PREFIX}'
sync_config "${PSI_PREFIX}" \
"${target_prefix}" || die 1 "Error: configuration synchronization failed!"
dst="${target_prefix}/${PSI_MODULES_ROOT}/"
echo "Creating root directory '${dst}' for module hierarchy ..."
$DRY mkdir -p "${dst}"
echo
echo "Syncing Pmodules ..."
sync_module "Tools/Pmodules/${PMODULES_VERSION}" \
"${PSI_PREFIX}" \
"${src_prefix}" \
"${target_prefix}" || die 1 "Error: sync Pmodules failed!"
echo
dst="${target_prefix}/${PSI_CONFIG_DIR}/environment.bash"
echo "Adding installation source '${src_prefix}' to '${dst}'..."
sed -i .bak '/PMODULES_INSTALL_SOURCE/d' "${dst}"
echo "declare -x PMODULES_INSTALL_SOURCE=\"${src_prefix}\"" >> "${dst}"
echo
if [[ -n "${user}" ]]; then
echo "Changing user of new module environment to '${user}'..."
$DRY chown -R "${user}" "${target_prefix}" || die 1 "Error: changing owner failed!"
@@ -279,8 +298,10 @@ subcommand_install() {
local -a with=()
local -a releases=()
local -a module_pattern=()
local -r src_prefix="${PMODULES_INSTALL_SOURCE}"
local -r target_prefix="${PSI_PREFIX}"
opts=$(get_options -o h -l with: -l release: -l help -- "$@")
opts=$(get_options -o hf -l dry-run -l force -l with: -l release: -l help -l src: -- "$@")
if [[ $? != 0 ]]; then
subcommand_help_install
exit 1
@@ -288,9 +309,18 @@ subcommand_install() {
eval set -- "${opts}"
while (($# > 0)); do
case $1 in
--dry-run )
DRY='echo'
;;
--force | -f )
force='yes'
;;
--release )
releases+=( "$2" )
echo $2
shift
;;
--src )
src_prefix="$2"
shift
;;
--with )
@@ -300,7 +330,11 @@ subcommand_install() {
-- )
:
;;
-* | -h | --help )
-h | --help )
subcommand_help_install
exit 1
;;
-* )
echo "$1: illegal option" 1>&2
subcommand_help_init
exit 1
@@ -311,7 +345,36 @@ subcommand_install() {
esac
shift
done
${PMODULES_HOME}/bin/modulecmd bash search "${module_pattern[@]}" "${with[@]/#/--with}" "${releases[@]/#/--release=}" --no-header
local -A modules_to_install
local -i n=0
while read rel_modulefile; do
modules_to_install["${rel_modulefile}"]+='.'
let n+=1
done < <(${PMODULES_HOME}/bin/modulecmd bash search \
"${module_pattern[@]}" \
"${with[@]/#/--with=}" \
"${releases[@]/#/--release=}" \
--no-header --print-modulefiles \
--src="${src_prefix}" 2>&1)
(( n == 0 )) && die 0 "Nothing to install..."
echo -e "The following modules will be installed/updated:\n" 1>&2
for key in "${!modules_to_install[@]}"; do
echo " ${key}" 1>&2
done
echo 1>&2
get_YN_answer "Do you want to continue? [n] " || die 1 "Aborting..."
echo 1>&2
for rel_modulefile in "${!modules_to_install[@]}"; do
if [[ -d "${target_prefix}/${rel_modulefile}" ]]; then
echo " Updating; ${rel_modulefile}..." 1>&2
else
echo " Installing: ${rel_modulefile}..."
fi
sync_module "${rel_modulefile}" \
"${src_prefix}" \
"${target_prefix}"
done
echo -e "\nDone!\n" 1>&2
}
subcommand_sync() {

View File

@@ -1,4 +1,8 @@
#!@PMODULES_HOME@/bin/bash
#
# we have to unset CDPATH, otherwise 'cd' prints the directoy!
unset CDPATH
declare -r PMODULES_DIR=$( cd "$(dirname $0)/.." && pwd )
declare -r version='@PMODULES_VERSION@'
@@ -10,6 +14,8 @@ declare -rx PSI_LIBMODULES="${PMODULES_DIR}/lib/libmodules.tcl"
declare -r modulepath_root="${PSI_PREFIX}/${PSI_MODULES_ROOT}"
declare -ra modulepath=( ${MODULEPATH//:/ } )
source "${PMODULES_DIR}/lib/libpmodules.bash"
if set -o | grep 'xtrace' | grep -q 'on'; then
declare -r __XTRACE__='on'
else
@@ -462,6 +468,11 @@ subcommand_generic1plus() {
"${modulecmd}" "${shell}" "${subcommand}" "$@"
}
#
# load module
#
# $1: module to load
#
subcommand_load() {
output_load_hints() {
local -ra rels=( ${available_releases//:/ } )
@@ -507,7 +518,9 @@ subcommand_load() {
}
local -r m=$1
if module_is_available "${m}"; then
if [[ "${m}" == "" ]]; then
echo "No module specified." 1>&2
elif module_is_available "${m}"; then
"${modulecmd}" "${shell}" load "${m}"
else
if [[ ${userlvl} = 'novice' ]]; then
@@ -668,22 +681,25 @@ subcommand_avail() {
}
get_families () {
if [[ ! -d "${modulepath_root}" ]]; then
local -r module_hierarchy_root="$1"
if [[ ! -d "${module_hierarchy_root}" ]]; then
echo ""
else
{
cd "${modulepath_root}"
cd "${module_hierarchy_root}"
ls -1
}
fi
}
#
# $1: family name (not path!)
# $1: root of modulefile hierarchy
# $2: family name (not path!)
compute_family_depth () {
local -r module_hierarchy_root="$1"
local -r family=$2
{
local -r family=$1
cd "${modulepath_root}"
cd "${module_hierarchy_root}"
local -r tmp=$(find "${family}" -depth -type f -o -type l | head -1)
local -ar tmp2=( ${tmp//\// } )
local depth=${#tmp2[@]}
@@ -701,8 +717,8 @@ subcommand_use() {
echo -e "\t${f}" 1>&2
done
echo -e "\nFamilies you may use in addition:" 1>&2
for family in $(get_families); do
local -i depth=$( compute_family_depth "${family}")
for family in $(get_families "${modulepath_root}"); do
local -i depth=$( compute_family_depth "${modulepath_root}" "${family}")
if ! is_used_family $f && (( depth == 0 )); then
echo -e "\t${f}" 1>&2
fi
@@ -739,7 +755,7 @@ subcommand_use() {
# releases are always *appended*
append_path PSI_USED_RELEASES "${arg}"
elif [[ ! ${arg} =~ */* ]] && [[ -d ${modulepath_root}/${arg} ]]; then
local -i depth=$(compute_family_depth "${arg}")
local -i depth=$(compute_family_depth "${modulepath_root}" "${arg}")
if (( depth == 0 )); then
dirs_to_add+=( ${modulepath_root}/${arg} )
else
@@ -816,6 +832,7 @@ subcommand_clear() {
subcommand_search() {
local modules=()
local with_modules='//'
local src_prefix=''
local _print_header='yes'
local _print_modulefiles='no'
local use_releases=':'
@@ -833,22 +850,23 @@ subcommand_search() {
# $1: module name pattern
search () {
local -r module=$1
local -r module_hierarchy_root="${src_prefix}/${PSI_MODULES_ROOT}"
# we must write temporary results to a file for sorting
local -r tmpfile=$( mktemp /tmp/$(basename $0).XXXXXX ) || exit 1
local family
# loop over all families
for family in $(get_families); do
local -i depth=$( compute_family_depth ${family} )
for family in $(get_families "${module_hierarchy_root}"); do
local -i depth=$( compute_family_depth "${module_hierarchy_root}" "${family}" )
# get all potential directories of family $f with module-files
local mpaths=( $(find \
"${modulepath_root}/${family}" \
"${module_hierarchy_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}}"
local p="${mpath/${module_hierarchy_root}}"
p=( ${p//\// } )
local deps=()
local -i i
@@ -870,15 +888,15 @@ subcommand_search() {
done
done
done
if [[ "{_print_modulefiles}" == "no" ]]; then
if [[ "${_print_modulefiles}" == "no" ]]; then
sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}" 1>&2
else
while read -a line; do
echo -n "${line[2]}/"
echo -n "${line[2]}/" 1>&2
for d in "${line[@]:3}"; do
echo -n "$d/"
echo -n "$d/" 1>&2
done
echo "${line[0]}"
echo "${line[0]}" 1>&2
done < <(sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}")
fi
rm -f "${tmpfile}"
@@ -914,6 +932,10 @@ subcommand_search() {
-a | --all-releases )
use_releases=${available_releases}
;;
--src=* )
src_prefix=${1/--src=}
check_pmodules_directories "${src_prefix}"
;;
-? | -h | --help )
usage
;;
@@ -927,9 +949,12 @@ subcommand_search() {
esac
shift
done
if [[ -z "${src_prefix}" ]]; then
src_prefix="${PSI_PREFIX}"
fi
if [[ "${use_releases}" == ":" ]]; then
use_releases=":${PSI_USED_RELEASES}:"
use_releases=":${PSI_USED_RELEASES}:"
fi
[[ "${_print_header}" == "yes" ]] && print_header

View File

@@ -0,0 +1,7 @@
declare -x PMODULES_VERSION=0.99.1
declare -x MODULES_VERSION=3.2.10
declare -a COMPILER_VERSIONS=( 'gcc/4.7.4' 'gcc/4.8.3' 'gcc/4.8.4' 'gcc/4.9.2' )
declare -a MPI_VERSIONS=( 'openmpi/1.6.5' 'openmpi/1.8.2' 'openmpi/1.8.4' )
declare -a HDF5_VERSIONS=( 'hdf5/1.8.12' 'hdf5/1.8.14' )
declare -a HDF5_SERIAL_VERSIONS=( 'hdf5_serial/1.8.12' 'hdf5_serial/1.8.14' )

View File

@@ -21,7 +21,6 @@ function em.post_install() {
{ cd "${PREFIX}"/bin && rm -f tclsh && ln -fs tclsh${V%.*} tclsh; };
}
em.add_to_family 'Programming'
em.add_to_family 'Tools'
em.set_docfiles 'license.terms' 'README'
em.set_build_dependencies "${COMPILER}"
em.make_all

View File

@@ -8,6 +8,5 @@ function em.configure() {
|| exit 1
}
em.add_to_family 'System'
em.set_build_dependencies "${COMPILER}"
em.add_to_family 'Tools'
em.make_all

View File

@@ -3,18 +3,18 @@
declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd)
declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap"
source "${BASE_DIR}/config/Pmodules.conf"
source "${BOOTSTRAP_DIR}/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
${BOOTSTRAP_DIR}/bash/build --bootstrap
${BOOTSTRAP_DIR}/Tcl/build --bootstrap
${BOOTSTRAP_DIR}/gettext/build --bootstrap || { echo "compiling 'gettext' failed!"; exit 1; }
${BOOTSTRAP_DIR}/getopt/build --bootstrap || { echo "compiling 'getopt' failed!"; exit 1; }
${BOOTSTRAP_DIR}/dialog/build --bootstrap || { echo "compiling 'dialog' failed!"; exit 1; }
${BOOTSTRAP_DIR}/bash/build --bootstrap || { echo "compiling 'bash' failed!"; exit 1; }
${BOOTSTRAP_DIR}/Tcl/build --bootstrap || { echo "compiling 'Tcl' failed!"; exit 1; }
# we have to remove the init directory - otherwise the next build will fail...
rm -rf "${PMODULES_HOME}/init"
${BOOTSTRAP_DIR}/Modules/build --bootstrap
${BOOTSTRAP_DIR}/Modules/build --bootstrap || { echo "compiling 'Modules' failed!"; exit 1; }
mv -v "${PMODULES_HOME}/bin/modulecmd" "${PMODULES_HOME}/bin/modulecmd.tcl"

View File

@@ -9,5 +9,4 @@ function em.configure() {
}
em.add_to_family 'Tools'
em.set_build_dependencies "${COMPILER}"
em.make_all

View File

@@ -20,5 +20,4 @@ function em.configure() {
}
em.add_to_family 'Tools'
em.set_build_dependencies "${COMPILER}"
em.make_all

View File

@@ -4,7 +4,7 @@ declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd)
declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap"
declare -r SRC_DIR="${BOOTSTRAP_DIR}/Pmodules"
source "${BASE_DIR}/config/Pmodules.conf"
source "${BOOTSTRAP_DIR}/Pmodules_version.conf"
unset PMODULES_HOME
source "/opt/psi/config/environment.bash"
@@ -14,6 +14,7 @@ sed_cmd+="s:@PMODULES_VERSION@:${PMODULES_VERSION}:g;"
sed_cmd+="s:@MODULES_VERSION@:${MODULES_VERSION}:g"
sed "${sed_cmd}" "${SRC_DIR}/modulecmd.in" > "${SRC_DIR}/modulecmd"
sed "${sed_cmd}" "${SRC_DIR}/modmanage.in" > "${SRC_DIR}/modmanage.bash"
sed "${sed_cmd}" "${SRC_DIR}/environment.bash.in" > "${SRC_DIR}/environment.bash"
install -d -m 0755 "${PMODULES_HOME}/bin"
install -d -m 0755 "${PMODULES_HOME}/config"

View File

@@ -18,7 +18,6 @@ function em.configure() {
--prefix="${PREFIX}" \
--enable-parallel \
--enable-debug \
--enable-vtkconverter \
--with-hdf5=$HDF5_PREFIX \
--with-pic \
|| exit 1
@@ -37,7 +36,7 @@ function em.install() {
em.add_to_family 'HDF5'
em.set_runtime_dependencies "${COMPILER}" "${MPI}" 'hdf5'
em.set_build_dependencies "autoconf" "automake" "libtool" "${COMPILER}" "${MPI}" "vtk" "hdf5"
em.set_build_dependencies "autoconf" "automake" "libtool" "${COMPILER}" "${MPI}" "hdf5"
em.set_docfiles 'AUTHORS' 'COPYING'
em.make_all

View File

@@ -19,6 +19,7 @@ for cc in "${COMPILER_VERSIONS[@]}"; do
echo " compile: $cc"
echo " mpi: $mpi"
echo " hdf5: $hdf5"
exit 1
}
done
done

View File

@@ -0,0 +1,23 @@
#!/bin/bash
declare -r basedir=$(dirname $0)
source '../../config/Pmodules.conf'
declare -r recipe="${basedir}/$1/build"
shift
if [[ ! -x "${recipe}" ]]; then
echo "Error: no recipe to build '$1'!"
exit 1
fi
for cc in "${COMPILER_VERSIONS[@]}"; do
for hdf in "${HDF5_SERIAL_VERSIONS[@]}"; do
"${recipe}" "$@" --with=$cc --with=$hdf || {
echo "Oops: build failed for:"
echo " compiler: $cc"
echo " HDF5 (serial): $hdf"
exit 1
}
done
done

View File

@@ -0,0 +1,9 @@
gcc/4.8.3
openmpi/1.8.2
ippl/1.1.4
hdf5/1.8.12
H5hut/1.99.13
trilinos/11.10.2
boost/1.55.0
gsl/1.15
root/5.34.19

View File

@@ -17,6 +17,7 @@ for cc in "${COMPILER_VERSIONS[@]}"; do
echo "Oops: build failed for:"
echo " compiler: $cc"
echo " mpi: $mpi"
exit 1
}
done
done

View File

@@ -12,9 +12,9 @@ function em.configure() {
"${MODULE_SRCDIR}"
}
em.add_to_family 'MPI'
em.add_to_family 'OPAL'
em.set_runtime_dependencies "${COMPILER}" "${MPI}"
em.set_build_dependencies 'cmake' "${COMPILER}" "${MPI}" 'boost' 'hdf5' 'H5hut' 'trilinos' 'ippl' 'gsl' 'boost' 'OPAL'
em.set_supported_compilers 'gcc/4.7' 'gcc/4.8'
em.set_supported_compilers 'gcc/4.8'
em.make_all

View File

@@ -0,0 +1,10 @@
gcc/4.8.3
openmpi/1.8.2
ippl/1.1.4
hdf5/1.8.12
H5hut/1.99.13
trilinos/11.10.2
boost/1.55.0
gsl/1.15
root/5.34.19
OPAL/1.3.2

View File

@@ -21,7 +21,9 @@ function em.post_install() {
{ cd "${PREFIX}"/bin && rm -f tclsh && ln -fs tclsh${V%.*} tclsh; };
}
# use system's cc
declare CC=cc
em.add_to_family 'Programming'
em.set_docfiles 'license.terms' 'README'
em.set_build_dependencies "${COMPILER}"
em.make_all

32
scripts/Programming/Tk/build Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
source "$(dirname $0)/../../../lib/libem.bash"
function em.configure() {
case ${OS} in
Linux )
srcdir="${MODULE_SRCDIR}/unix"
;;
Darwin )
srcdir="${MODULE_SRCDIR}/macosx"
;;
esac
"${srcdir}"/configure \
--prefix="${PREFIX}" \
--with-tcl=${TCL_PREFIX}/lib \
--enable-shared=no \
|| exit 1
}
function em.post_install() {
:
#{ cd "${PREFIX}"/bin && rm -f tclsh && ln -fs tclsh${V%.*} tclsh; };
}
# use system's cc
declare CC=cc
em.add_to_family 'Programming'
em.set_build_dependencies 'Tcl'
em.set_docfiles 'license.terms' 'README'
em.make_all

View File

@@ -23,7 +23,6 @@ function em.install() {
make install
}
em.release 'unstable'
em.add_to_family 'System'
em.set_build_dependencies "${COMPILER}"
em.make_all

27
scripts/Tools/git/build Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
source "$(dirname $0)/../../../lib/libem.bash"
function em.configure() {
cd "${MODULE_SRCDIR}"
"${MODULE_SRCDIR}"/configure \
--prefix="${PREFIX}" \
--with-tcltk \
|| exit 1
}
function em.build() {
cd "${MODULE_SRCDIR}"
make
}
em.add_to_family 'Tools'
em.set_runtime_dependencies 'Tcl' 'Tk'
em.set_docfiles 'COPYING' 'README'
em.make_all
# Local Variables:
# mode: sh
# sh-basic-offset: 8
# tab-width: 8
# End:

View File

@@ -0,0 +1,2 @@
Tcl/8.6.4
Tk/8.6.4