From 7161682cff01a20281bc628ba54db496bcdbf235 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 May 2015 15:15:49 +0200 Subject: [PATCH 1/3] lib/libem.bash: - core to find tarball of package moved to function and improved --- lib/libem.bash | 60 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/lib/libem.bash b/lib/libem.bash index f1949c9..11a5775 100644 --- a/lib/libem.bash +++ b/lib/libem.bash @@ -307,6 +307,37 @@ em.cleanup_env() { } +# +# find tarball +# $1: download directory +# $2: name without version +# $3: version +# +function find_tarball() { + local -r dir=$1 + local -r name=$2 + local -r version=$3 + + TARBALL="" + local ext + for ext in tar tar.gz tgz tar.bz2 tar.xz; do + local fname="${dir}/${name}-${OS}-${version}.${ext}" + if [[ -r "${fname}" ]]; then + TARBALL="${fname}" + break + fi + local fname="${dir}/${name}-${version}.${ext}" + if [[ -r "${fname}" ]]; then + TARBALL="${fname}" + break + fi + done + if [[ -z ${TARBALL} ]]; then + error "tar-ball for $P/$V not found." + exit 43 + fi +} + #setup module specific environment function _setup_env2() { if [[ -z ${MODULE_FAMILY} ]]; then @@ -456,19 +487,7 @@ function _setup_env2() { 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 + find_tarball "${BUILD_DOWNLOADSDIR}" "${P/_serial}" "${V}" } @@ -500,19 +519,8 @@ function _setup_env2_bootstrap() { 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 + find_tarball "${BUILD_DOWNLOADSDIR}" "${P/_serial}" "${V}" + C_INCLUDE_PATH="${PREFIX}/include" CPLUS_INCLUDE_PATH="${PREFIX}/include" CPP_INCLUDE_PATH="${PREFIX}/include" From a56b83e44a29311eddd13d4b948121a03661edd3 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 May 2015 15:17:53 +0200 Subject: [PATCH 2/3] scripts/Bootstrap: - coreutils added, we need a unique base64 --- scripts/Bootstrap/compile_pmodules.sh | 11 ++++++----- scripts/Bootstrap/coreutils/build | 12 ++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100755 scripts/Bootstrap/coreutils/build diff --git a/scripts/Bootstrap/compile_pmodules.sh b/scripts/Bootstrap/compile_pmodules.sh index 5de1ca8..54d92b3 100755 --- a/scripts/Bootstrap/compile_pmodules.sh +++ b/scripts/Bootstrap/compile_pmodules.sh @@ -8,11 +8,12 @@ source "${BOOTSTRAP_DIR}/Pmodules_version.conf" unset PMODULES_HOME source "/opt/psi/config/environment.bash" -${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; } +${BOOTSTRAP_DIR}/coreutils/build --bootstrap || { echo "compiling 'coreutils' failed!"; exit 1; } +${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" diff --git a/scripts/Bootstrap/coreutils/build b/scripts/Bootstrap/coreutils/build new file mode 100755 index 0000000..416a5c1 --- /dev/null +++ b/scripts/Bootstrap/coreutils/build @@ -0,0 +1,12 @@ +#!/bin/bash + +source "$(dirname $0)/../../../lib/libem.bash" + +function em.configure() { + "${MODULE_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +em.add_to_family 'Tools' +em.make_all From 21e9b9720fd0c56788fad85224fa2c32e731d7d5 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 6 May 2015 15:18:43 +0200 Subject: [PATCH 3/3] script/Bootstrap/Pmodules/modulecmd.in: - use our own GNU base64 --- scripts/Bootstrap/Pmodules/bash | 2 +- scripts/Bootstrap/Pmodules/modulecmd.in | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/Bootstrap/Pmodules/bash b/scripts/Bootstrap/Pmodules/bash index 121d92f..7621913 100644 --- a/scripts/Bootstrap/Pmodules/bash +++ b/scripts/Bootstrap/Pmodules/bash @@ -124,7 +124,7 @@ save_env() { s+="$( typeset -p $1 );" shift done - echo export PMODULES_ENV=$( base64 <<< "$s" ) + echo export PMODULES_ENV=$( "${PMODULES_HOME}/bin/base64" --wrap=0 <<< "$s" ) } #module purge diff --git a/scripts/Bootstrap/Pmodules/modulecmd.in b/scripts/Bootstrap/Pmodules/modulecmd.in index 3c52daf..02a2ea0 100755 --- a/scripts/Bootstrap/Pmodules/modulecmd.in +++ b/scripts/Bootstrap/Pmodules/modulecmd.in @@ -37,7 +37,7 @@ save_env() { s+="$( typeset -p $1 );" shift done - echo export PMODULES_ENV=$( base64 <<< "$s" ) + echo export PMODULES_ENV=$( "${PMODULES_HOME}/bin/base64" --wrap=0 <<< "$s" ) } export_env() { @@ -425,14 +425,12 @@ get_release() { : ${PMODULES_DEFINED_RELEASES:=':unstable:stable:deprecated:'} -declare used_releases=":${USED_RELEASES}:" - is_release() { [[ ${PMODULES_DEFINED_RELEASES} =~ :$1: ]] } is_used_release() { - [[ ${used_releases} =~ :$1: ]] + [[ ":${USED_RELEASES}:" =~ :$1: ]] } declare used_families=":${PMODULES_USED_GROUPS}:" @@ -992,7 +990,7 @@ subcommand_use() { done info "\nUsed releases:" - for r in ${used_releases//:/ }; do + for r in ${USED_RELEASES//:/ }; do info "\t${r}" done info "\nUnused releases:" @@ -1435,7 +1433,7 @@ subcommand_initclear() { } if [[ -n ${PMODULES_ENV} ]]; then - eval "$(base64 -D <<< "${PMODULES_ENV}" 2>/dev/null)" + eval "$("${PMODULES_HOME}/bin/base64" -d <<< "${PMODULES_ENV}" 2>/dev/null)" fi case $1 in