Skip to content
Snippets Groups Projects
Commit 09b2a0bb authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

release script: extract repeated functionality into functions.

parent 22644776
No related branches found
No related tags found
No related merge requests found
......@@ -49,16 +49,9 @@ set -e
trap errMsg ERR
if [[ ${TMPDIR+set} = '' ]]; then
if [[ -d "$XDG_RUNTIME_DIR" && -w "$XDG_RUNTIME_DIR" ]]; then
TMPDIR=$XDG_RUNTIME_DIR
elif [[ -d /dev/shm && -w /dev/shm ]]; then
TMPDIR=/dev/shm
else
TMPDIR=/tmp
fi
export TMPDIR
fi
setupMakeDebugging
addOverrides
setTMPDIR
tmpsrc=$(mktemp -d "${TMPDIR-/tmp}/tmp.XXXXXXXXXX")
log=$(mktemp "${TMPDIR-/tmp}/tmp.XXXXXXXXXX")
exec 6>"${log}"
......@@ -107,9 +100,9 @@ s/^MAKE =[ ]*\(.*[^ ]\) *$/\1/; p ; q
[[ -n "${MAKE}" ]] || MAKE='make'
fi
echo " ${MAKE}"
${MAKE} -j >&6 2>&6
${MAKE} "${MAKE_DEBUG_ARGS[@]}" -j >&6 2>&6
echo " make check"
${MAKE} -j8 check >&6 2>&6
${MAKE} "${MAKE_DEBUG_ARGS[@]}" -j8 check >&6 2>&6
git update-index -q --really-refresh
if git diff-index --exit-code HEAD -- >&6 ; then
echo 'success: no unexpected files were created/modified.' >&2
......
......@@ -135,6 +135,47 @@ errMsg()
$restore_extglob
unset restore_extglob
setupMakeDebugging()
{
if (( ${DEBUG:-0} )); then
set -x
MAKE_DEBUG_ARGS=(--debug 'SHELL=bash -x')
else
MAKE_DEBUG_ARGS=()
fi
}
addOverrides()
{
local mpirun_version=$(mpirun --version)
case $mpirun_version in
('mpirun (Open MPI)'*)
if [[ "$mpirun_version" =~ ^mpirun\ \(Open\ MPI\)\ ([0-9]+\.[0-9.]+) ]]; then
mpirun_version=${BASH_REMATCH[1]}
if printf '%s\n' "5.0" "${mpirun_version}" | sort -C -V ; then
MAKE_DEBUG_ARGS+=('PRRTE_MCA_rmaps_default_mapping_policy=:oversubscribe')
elif printf '%s\n' "1.8.0" "${mpirun_version}" | sort -C -V ; then
MAKE_DEBUG_ARGS+=('OMPI_MCA_rmaps_base_oversubscribe=true')
fi
fi
;;
esac
}
setTMPDIR()
{
if [[ ${TMPDIR+set} = '' ]]; then
if [[ -d "$XDG_RUNTIME_DIR" && -w "$XDG_RUNTIME_DIR" ]]; then
TMPDIR=$XDG_RUNTIME_DIR
elif [[ -d /dev/shm && -w /dev/shm ]]; then
TMPDIR=/dev/shm
else
TMPDIR=/tmp
fi
export TMPDIR
fi
}
#
# Local Variables:
# coding: utf-8
......
......@@ -31,21 +31,9 @@ set -e
trap errMsg ERR
if (( ${DEBUG:-0} )); then
set -x
MAKE_DEBUG_ARGS=(--debug 'SHELL=bash -x')
else
MAKE_DEBUG_ARGS=()
fi
if [[ ${TMPDIR+set} = '' ]]; then
if [[ -d /dev/shm && -w /dev/shm ]]; then
TMPDIR=/dev/shm
else
TMPDIR=/tmp
fi
TMPDIR=$(mktemp -d "${TMPDIR}/$(id -un)-XXXXXX")
export TMPDIR
fi
setupMakeDebugging
setTMPDIR
BUILD_DIR=$(mktemp -d "${TMPDIR}/${package}-distcheck.XXXXXX")
if (( ${DEBUG:-0} == 0)) && [[ -z "${KEEP_BUILDDIR-}" ]] ; then
trap 'chmod -R u+w "${BUILD_DIR}" ; rm -rf "${BUILD_DIR}"' EXIT
......@@ -57,19 +45,7 @@ for ((i=0; i < 2; ++i)); do
if ((i == 0)); then
args+=(--enable-maintainer-mode)
fi
mpirun_version=$(mpirun --version)
case $mpirun_version in
('mpirun (Open MPI)'*)
if [[ "$mpirun_version" =~ ^mpirun\ \(Open\ MPI\)\ ([0-9]+\.[0-9.]+) ]]; then
mpirun_version=${BASH_REMATCH[1]}
if printf '%s\n' "5.0" "${mpirun_version}" | sort -C -V ; then
MAKE_DEBUG_ARGS+=('PRRTE_MCA_rmaps_default_mapping_policy=:oversubscribe')
elif printf '%s\n' "1.8.0" "${mpirun_version}" | sort -C -V ; then
MAKE_DEBUG_ARGS+=('OMPI_MCA_rmaps_base_oversubscribe=true')
fi
fi
;;
esac
addOverrides
"${SRC_DIR}"/configure "${args[@]}" \
|| { status=$? ; gzip -c config.log \
>"${SRC_DIR}/${log_dir}/make-distcheck-config.log.gz" ; exit $status ; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment