Merge branch 'develop' into features/shared

This commit is contained in:
Carson Woods
2020-06-23 11:37:54 -04:00
849 changed files with 24549 additions and 4684 deletions

View File

@@ -304,6 +304,13 @@ _pretty_print() {
complete -o bashdefault -o default -F _bash_completion_spack spack
# Completion for spacktivate
complete -o bashdefault -o default -F _bash_completion_spack spacktivate
_spacktivate() {
_spack_env_activate
}
# Spack commands
#
# Everything below here is auto-generated.

View File

@@ -16,46 +16,43 @@ COPY share $SPACK_ROOT/share
COPY var $SPACK_ROOT/var
RUN mkdir -p $SPACK_ROOT/opt/spack
RUN yum update -y \
&& yum install -y epel-release \
&& yum update -y \
RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/docker-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/interactive-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/spack-env
RUN yum update -y \
&& yum install -y epel-release \
&& yum update -y \
&& yum --enablerepo epel groupinstall -y "Development Tools" \
&& yum --enablerepo epel install -y \
curl findutils gcc-c++ gcc \
gcc-gfortran git gnupg2 hostname \
iproute Lmod make patch \
openssh-server python python-pip tcl \
unzip which \
&& pip install boto3 \
&& rm -rf /var/cache/yum \
&& yum --enablerepo epel install -y \
curl \
findutils \
gcc-c++ \
gcc \
gcc-gfortran \
git \
gnupg2 \
hostname \
iproute \
Lmod \
make \
patch \
python \
python-pip \
python-setuptools \
tcl \
unzip \
which \
&& pip install boto3 \
&& rm -rf /var/cache/yum \
&& yum clean all
RUN ( echo ". /usr/share/lmod/lmod/init/bash" \
&& echo ". \$SPACK_ROOT/share/spack/setup-env.sh" \
&& echo "if [ \"\$CURRENTLY_BUILDING_DOCKER_IMAGE\" '!=' '1' ]" \
&& echo "then" \
&& echo " . \$SPACK_ROOT/share/spack/spack-completion.bash" \
&& echo "fi" ) \
>> /etc/profile.d/spack.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-ssh.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-ssh.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-ssh.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-prompt.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-prompt.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-prompt.sh \
&& mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
RUN mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
# [WORKAROUND]
@@ -66,10 +63,10 @@ RUN [ -f ~/.profile ] \
|| true
WORKDIR /root
SHELL ["/bin/bash", "-l", "-c"]
SHELL ["docker-shell"]
# TODO: add a command to Spack that (re)creates the package cache
RUN spack spec hdf5+mpi
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["docker-shell"]
CMD ["interactive-shell"]

View File

@@ -16,46 +16,43 @@ COPY share $SPACK_ROOT/share
COPY var $SPACK_ROOT/var
RUN mkdir -p $SPACK_ROOT/opt/spack
RUN yum update -y \
&& yum install -y epel-release \
&& yum update -y \
RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/docker-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/interactive-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/spack-env
RUN yum update -y \
&& yum install -y epel-release \
&& yum update -y \
&& yum --enablerepo epel groupinstall -y "Development Tools" \
&& yum --enablerepo epel install -y \
curl findutils gcc-c++ gcc \
gcc-gfortran git gnupg2 hostname \
iproute Lmod make patch \
openssh-server python python-pip tcl \
unzip which \
&& pip install boto3 \
&& rm -rf /var/cache/yum \
&& yum --enablerepo epel install -y \
curl \
findutils \
gcc-c++ \
gcc \
gcc-gfortran \
git \
gnupg2 \
hostname \
iproute \
Lmod \
make \
patch \
python \
python-pip \
python-setuptools \
tcl \
unzip \
which \
&& pip install boto3 \
&& rm -rf /var/cache/yum \
&& yum clean all
RUN ( echo ". /usr/share/lmod/lmod/init/bash" \
&& echo ". \$SPACK_ROOT/share/spack/setup-env.sh" \
&& echo "if [ \"\$CURRENTLY_BUILDING_DOCKER_IMAGE\" '!=' '1' ]" \
&& echo "then" \
&& echo " . \$SPACK_ROOT/share/spack/spack-completion.bash" \
&& echo "fi" ) \
>> /etc/profile.d/spack.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-ssh.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-ssh.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-ssh.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-prompt.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-prompt.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-prompt.sh \
&& mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
RUN mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
# [WORKAROUND]
@@ -66,10 +63,10 @@ RUN [ -f ~/.profile ] \
|| true
WORKDIR /root
SHELL ["/bin/bash", "-l", "-c"]
SHELL ["docker-shell"]
# TODO: add a command to Spack that (re)creates the package cache
RUN spack spec hdf5+mpi
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["docker-shell"]
CMD ["interactive-shell"]

View File

@@ -1,45 +1,143 @@
#! /usr/bin/env bash -e
#! /usr/bin/env bash
#
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
unset CURRENTLY_BUILDING_DOCKER_IMAGE
mode=oneshot
if [ "$1" '=' 'docker-shell' ] ; then
if [ -t 0 ] ; then
exec bash -il
else
(
echo -n "It looks like you're trying to run an intractive shell"
echo -n " session, but either no psuedo-TTY is allocateed for this"
echo -n " container's STDIN, or it is closed."
echo
echo -n "Make sure you run docker with the --interactive and --tty"
echo -n " options."
echo
) >&2
exit 1
fi
else
exec 3>&1
exec 4>&2
exec 1>&-
exec 2>&-
source /etc/profile.d/spack.sh
source /etc/profile.d/handle-ssh.sh
exec 1>&3
exec 2>&4
exec 3>&-
exec 4>&-
spack "$@"
exit $?
if [ "$( basename "$0" )" '=' 'spack-env' ] ; then
mode=spackenv
elif [ "$( basename "$0" )" '=' 'docker-shell' ] ; then
mode=dockershell
elif [ "$( basename "$0" )" '=' 'interactive-shell' ] ; then
mode=interactiveshell
elif [ "$1" '=' 'docker-shell' ] ; then
mode=dockershell
shift
elif [ "$1" '=' 'interactive-shell' ] ; then
mode=interactiveshell
shift
fi
case "$mode" in
"spackenv")
# Scenario 1: Run as if the image had no ENTRYPOINT
#
# Necessary for use cases where the command to run and all
# arguments must be accepted in the CMD portion. (e.g.: Gitlab CI
# Runners)
#
# Roughly equivalent to
# docker run ... --entrypoint spack-env ... sh -c "..."
#
# The shell script runs with spack pre-loaded and ready to use.
. $SPACK_ROOT/share/spack/setup-env.sh
unset CURRENTLY_BUILDING_DOCKER_IMAGE
exec "$@"
;;
"dockershell")
# Scenario 2: Accept shell code from a RUN command in a
# Dockerfile
#
# For new Docker images that start FROM this image as its base.
# Prepared so that subsequent RUN commands can take advantage of
# Spack without having to manually (re)initialize.
#
# Example:
# FROM spack/centos7
# COPY spack.yaml .
# RUN spack install # <- Spack is loaded and ready to use.
# # No manual initialization necessary.
. $SPACK_ROOT/share/spack/setup-env.sh
exec bash -c "$*"
;;
"interactiveshell")
# Scenario 3: Run an interactive shell session with Spack
# preloaded.
#
# Create a container meant for an interactive shell session.
# Additional checks are performed to ensure that stdin is a tty
# and additional shell completion files are sourced. The user is
# presented with a shell prompt from which they may issue Spack
# commands.
#
# This is the default behavior when running with no CMD or
# ENTRYPOINT overrides:
# docker run -it spack/centos7
if [ -t 0 ] ; then
. $SPACK_ROOT/share/spack/setup-env.sh
. $SPACK_ROOT/share/spack/spack-completion.bash
unset CURRENTLY_BUILDING_DOCKER_IMAGE
exec bash -i
else
(
echo -n "It looks like you're trying to run an"
echo -n " intractive shell session, but either no"
echo -n " psuedo-TTY is allocated for this container's"
echo " STDIN, or it is closed."
echo
echo -n "Make sure you run docker with the --interactive"
echo -n " and --tty options."
echo
) >&2
exit 1
fi
;;
"oneshot")
# Scenario 4: Run a one-shot Spack command from the host command
# line.
#
# Triggered by providing arguments to `docker run`. Arguments
# are passed along to the container's underlying spack
# installation, allowing users to use the image as if it were
# spack, itself. Pass volume mount information to `docker run`
# to persist the effects of running in this mode.
#
# This is the default behavior when running with a CMD override.
#
# Examples:
# # concretize the same spec on different OSes
# docker run --rm spack/ubuntu-xenial spec zlib
# docker run --rm spack/centos7 spec zlib
#
# # a "wetter" dry-run;
# # install a package and then throw away the results.
# docker run --rm spack/centos7 install libiconv
# docker run --rm spack/centos7 find libiconv
# ==> No package matches the query: libiconv
#
# # use docker volumes to persist changes
# docker run --rm -v ...:/spack spack/centos7 install ...
# docker run --rm -v ...:/spack spack/centos7 install ...
# docker run --rm -v ...:/spack spack/centos7 install ...
exec 3>&1
exec 4>&2
exec 1>&-
exec 2>&-
. $SPACK_ROOT/share/spack/setup-env.sh
unset CURRENTLY_BUILDING_DOCKER_IMAGE
exec 1>&3
exec 2>&4
exec 3>&-
exec 4>&-
spack "$@"
exit $?
;;
*)
echo "INTERNAL ERROR - UNRECOGNIZED MODE: $mode" >&2
exit 1
;;
esac

View File

@@ -1,173 +0,0 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
if [ "$CURRENTLY_BUILDING_DOCKER_IMAGE" '!=' '1' ] ; then
if [ x$SPACK_PROMPT '!=' x0 ] ; then
__tmp="`mktemp -d`"
__trylock() {
local dir
dir="$__tmp/$1.lock"
mkdir "$dir" &>/dev/null
return $?
}
__queue_init() {
local r
local w
mkdir "$__tmp/$1.read.lock" ; r=$?
mkdir "$__tmp/$1.write.lock" ; w=$?
if [ "$r" '=' '0' -a "$w" '=' '0' ] ; then
return 0
else
return 1
fi
}
__queue_try_read() {
__trylock "$1.read"
return $?
}
__queue_try_write() {
__trylock "$1.write"
return $?
}
__queue_make_readable() {
rm -r "$__tmp/$1.read.lock" &>/dev/null
return $?
}
__queue_make_writable() {
rm -r "$__tmp/$1.write.lock" &>/dev/null
return $?
}
__read() {
cat "$__tmp/$1" 2> /dev/null
return $?
}
__write() {
cat > "$__tmp/$1" 2> /dev/null
return $?
}
__revparse_head() {
head="`git -C "$SPACK_ROOT" rev-parse $@ HEAD 2>/dev/null`"
result="$?"
if [ "$result" '!=' '0' ] ; then
head="`git --git-dir="$SPACK_ROOT"/.git \\
--work-tree="$SPACK_ROOT" rev-parse $@ HEAD 2>/dev/null`"
result="$?"
fi
echo "$head"
return $result
}
__git_head() {
head="`__revparse_head --abbrev-ref`"
if [ "$?" '=' '0' ] ; then
if [ "$head" '=' 'HEAD' ] ; then
head="`__revparse_head | cut -c1-8`..."
fi
echo "$head"
fi
}
__update_prompt() {
local prompt
prompt=''
linux_distro="$DOCKERFILE_DISTRO"
if [ -n "$linux_distro" ] ; then
linux_distro='\[\e[1;34m\][\[\e[0;34m\]'"$linux_distro"'\[\e[1;34m\]]'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$linux_distro"
fi
git_head="`__git_head`"
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$git_head"
fi
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt"'\[\e[0;m\]\W: '
echo "$prompt" | __write prompt
}
set -m
(
__queue_init query
__queue_init prompt
__update_prompt
__queue_make_readable prompt
__queue_make_writable query
while sleep 0.010 ; do
last_q_time=''
while sleep 0.010 ; do
q_time="`date +%s%N`"
if __queue_try_read query ; then
last_q_time="$q_time"
__queue_make_writable query
fi
if [ -n "$last_q_time" -a \
"$(( (q_time - last_q_time)/10000000 > 100 ))" '=' '1' ] ; then
break
fi
done
__update_prompt
__queue_make_readable prompt
done
) &>/dev/null &
set +m
__update_prompt_main_first_call=1
__update_prompt_main() {
if [ "$__update_prompt_main_first_call" '=' '1' ] ; then
while sleep 0.001 ; do
if __queue_try_read prompt ; then
PS1="`__read prompt`"
break
fi
done
__update_prompt_main_first_call=0
else
if __queue_try_read prompt ; then
PS1="`__read prompt`"
fi
fi
if __queue_try_write query ; then
__queue_make_readable query
fi
}
PROMPT_COMMAND=__update_prompt_main
fi # [ x$SPACK_PROMPT '!=' x0 ]
fi # [ "$CURRENTLY_BUILDING_DOCKER_IMAGE" '!=' '1' ]

View File

@@ -1,50 +0,0 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
if [ "$CURRENTLY_BUILDING_DOCKER_IMAGE" '!=' '1' ] ; then
uid="`id -u`"
if [ "$uid" '=' '0' ] ; then
key_types="dsa ecdsa rsa"
if [ "$DOCKERFILE_BASE" '!=' 'centos:6' ] ; then
key_types="${key_types} ed25519"
fi
for key_type in $key_types ; do
private_key_file="/etc/ssh/ssh_host_${key_type}_key"
public_key_file="$private_key_file.pub"
if [ '!' -f "$private_key_file" ] ; then
ssh-keygen \
-q -t "$key_type" -N "" -f "$private_key_file"
chmod 600 "$private_key_file"
chmod 644 "$public_key_file"
fi
done
mkdir -p /var/run/sshd
pgrep -u 0 -U 0 sshd &> /dev/null
if [ '!' "$?" '=' '0' ] ; then
nohup /usr/sbin/sshd -f /etc/ssh/sshd_config < /dev/null &> /dev/null
fi
fi
if [ '!' -f "$HOME/.ssh/id_rsa" ] ; then
ssh-keygen \
-t rsa -C "spack.developer@docker.host" -N "" -f "$HOME/.ssh/id_rsa"
cat "$HOME/.ssh/id_rsa.pub" >> "$HOME/.ssh/authorized_keys"
chmod 600 "$HOME/.ssh/authorized_keys"
docker_ip="`ip address show dev eth0 |
grep inet |
cut -d' ' -f 6 |
cut -d/ -f 1`"
ssh-keyscan -t rsa 127.0.0.1 localhost "$docker_ip" "`hostname`" \
> "$HOME/.ssh/known_hosts" 2> /dev/null
fi
fi # [ "$CURRENTLY_BUILDING_DOCKER_IMAGE" '!=' '1' ]

View File

@@ -16,29 +16,36 @@ COPY share $SPACK_ROOT/share
COPY var $SPACK_ROOT/var
RUN mkdir -p $SPACK_ROOT/opt/spack
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends \
build-essential \
ca-certificates \
curl \
file \
g++ \
gcc \
gfortran \
git \
gnupg2 \
iproute2 \
lmod \
locales \
lua-posix \
make \
openssh-server \
python3 \
python3-pip \
tcl \
unzip \
&& locale-gen en_US.UTF-8 \
&& pip3 install boto3 \
RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/docker-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/interactive-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/spack-env
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends \
build-essential \
ca-certificates \
curl \
file \
g++ \
gcc \
gfortran \
git \
gnupg2 \
iproute2 \
lmod \
locales \
lua-posix \
make \
python3 \
python3-pip \
python3-setuptools \
tcl \
unzip \
&& locale-gen en_US.UTF-8 \
&& pip3 install boto3 \
&& rm -rf /var/lib/apt/lists/*
# Add LANG default to en_US.UTF-8
@@ -46,33 +53,10 @@ ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN ( echo ". /usr/share/lmod/lmod/init/bash" \
&& echo ". \$SPACK_ROOT/share/spack/setup-env.sh" \
&& echo "if [ \"\$CURRENTLY_BUILDING_DOCKER_IMAGE\" '!=' '1' ]" \
&& echo "then" \
&& echo " . \$SPACK_ROOT/share/spack/spack-completion.bash" \
&& echo "fi" ) \
>> /etc/profile.d/spack.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-ssh.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-ssh.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-ssh.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-prompt.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-prompt.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-prompt.sh \
&& mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* $SPACK_ROOT/.git
RUN mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
# [WORKAROUND]
# https://superuser.com/questions/1241548/
@@ -82,10 +66,10 @@ RUN [ -f ~/.profile ] \
|| true
WORKDIR /root
SHELL ["/bin/bash", "-l", "-c"]
SHELL ["docker-shell"]
# TODO: add a command to Spack that (re)creates the package cache
RUN spack spec hdf5+mpi
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["docker-shell"]
CMD ["interactive-shell"]

View File

@@ -16,29 +16,36 @@ COPY share $SPACK_ROOT/share
COPY var $SPACK_ROOT/var
RUN mkdir -p $SPACK_ROOT/opt/spack
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends \
build-essential \
ca-certificates \
curl \
file \
g++ \
gcc \
gfortran \
git \
gnupg2 \
iproute2 \
lmod \
locales \
lua-posix \
make \
openssh-server \
python3 \
python3-pip \
tcl \
unzip \
&& locale-gen en_US.UTF-8 \
&& pip3 install boto3 \
RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/docker-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/interactive-shell \
&& ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
/usr/local/bin/spack-env
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends \
build-essential \
ca-certificates \
curl \
file \
g++ \
gcc \
gfortran \
git \
gnupg2 \
iproute2 \
lmod \
locales \
lua-posix \
make \
python3 \
python3-pip \
python3-setuptools \
tcl \
unzip \
&& locale-gen en_US.UTF-8 \
&& pip3 install boto3 \
&& rm -rf /var/lib/apt/lists/*
# Add LANG default to en_US.UTF-8
@@ -46,33 +53,10 @@ ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN ( echo ". /usr/share/lmod/lmod/init/bash" \
&& echo ". \$SPACK_ROOT/share/spack/setup-env.sh" \
&& echo "if [ \"\$CURRENTLY_BUILDING_DOCKER_IMAGE\" '!=' '1' ]" \
&& echo "then" \
&& echo " . \$SPACK_ROOT/share/spack/spack-completion.bash" \
&& echo "fi" ) \
>> /etc/profile.d/spack.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-ssh.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-ssh.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-ssh.sh \
&& ( echo "f=\"\$SPACK_ROOT/share/spack/docker/handle-prompt.sh\"" \
&& echo "if [ -f \"\$f\" ]" \
&& echo "then" \
&& echo " . \"\$f\"" \
&& echo "else" \
&& cat $SPACK_ROOT/share/spack/docker/handle-prompt.sh \
&& echo "fi" ) \
>> /etc/profile.d/handle-prompt.sh \
&& mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* $SPACK_ROOT/.git
RUN mkdir -p /root/.spack \
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
/root/.spack/modules.yaml \
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
# [WORKAROUND]
# https://superuser.com/questions/1241548/
@@ -86,10 +70,10 @@ RUN [ -f ~/.profile ] \
RUN ln -s posix_c.so /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so
WORKDIR /root
SHELL ["/bin/bash", "-l", "-c"]
SHELL ["docker-shell"]
# TODO: add a command to Spack that (re)creates the package cache
RUN spack spec hdf5+mpi
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["docker-shell"]
CMD ["interactive-shell"]

View File

@@ -0,0 +1,20 @@
pr_pipeline:
only:
- external_pull_requests
variables:
SPACK_REPO: https://github.com/spack/spack.git
SPACK_REF: ${CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME}
SPACK_IS_PR_PIPELINE: "True"
trigger:
project: spack/e4s
strategy: depend
merge_pipeline:
only:
- develop
variables:
SPACK_REPO: https://github.com/spack/spack.git
SPACK_REF: develop
trigger:
project: spack/e4s
strategy: depend

View File

@@ -1,37 +0,0 @@
#!/bin/bash -e
#
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# Description:
# Checks that Spack shell integration with modules works correctly.
#
# Usage:
# run-bootstrap-tests
#
. "$(dirname $0)/setup.sh"
check_dependencies ${coverage} git hg svn
# Fetch the sources in a mirror, and add it to Spack
mkdir -p ~/.mirror
bin/spack mirror add travis ~/.mirror
bin/spack mirror create -D -d ~/.mirror environment-modules~X
# Move to root directory of Spack
# Allows script to be run from anywhere
cd "$SPACK_ROOT"
# Print compiler information
spack config get compilers
# Run some build smoke tests, potentially with code coverage
${coverage_run} bin/spack bootstrap
# Check module integration
. "share/spack/setup-env.sh"
module av || exit 1
spack load tcl || exit 1

43
share/spack/qa/run-shell-tests Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash -e
#
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# Description:
# Runs Spack shell tests.
#
# Usage:
# run-shell-tests
#-----------------------------------------------------------
# Run a few initial commands and set up test environment
#-----------------------------------------------------------
ORIGINAL_PATH="$PATH"
. "$(dirname $0)/setup.sh"
check_dependencies $coverage git hg svn
# Clean the environment by removing Spack from the path and getting rid of
# the spack shell function
export PATH="$ORIGINAL_PATH"
unset spack
# Start in the spack root directory
cd "$SPACK_ROOT"
# Run bash tests with coverage enabled, but pipe output to /dev/null
# because it seems that kcov seems to undo the script's redirection
if [ "$COVERAGE" = true ]; then
"$QA_DIR/bashcov" "$QA_DIR/setup-env-test.sh" &> /dev/null
"$QA_DIR/bashcov" "$QA_DIR/completion-test.sh" &> /dev/null
else
bash "$QA_DIR/setup-env-test.sh"
bash "$QA_DIR/completion-test.sh"
fi
# Run the test scripts for their output (these will print nicely)
zsh "$QA_DIR/setup-env-test.sh"
dash "$QA_DIR/setup-env-test.sh"

View File

@@ -37,34 +37,13 @@ bin/spack -h
bin/spack help -a
# Profile and print top 20 lines for a simple call to spack spec
spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
spack -p --lines 20 spec openmpi
else
spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170
fi
#-----------------------------------------------------------
# Run unit tests with code coverage
#-----------------------------------------------------------
$coverage_run $(which spack) test -x --verbose
#-----------------------------------------------------------
# Run tests for setup-env.sh
#-----------------------------------------------------------
# Clean the environment by removing Spack from the path and getting rid of
# the spack shell function
export PATH="$ORIGINAL_PATH"
unset spack
# start in the spack root directory
cd "$SPACK_ROOT"
# Run bash tests with coverage enabled, but pipe output to /dev/null
# because it seems that kcov seems to undo the script's redirection
if [ "$BASH_COVERAGE" = true ]; then
"$QA_DIR/bashcov" "$QA_DIR/setup-env-test.sh" &> /dev/null
"$QA_DIR/bashcov" "$QA_DIR/completion-test.sh" &> /dev/null
fi
# run the test scripts for their output (these will print nicely)
bash "$QA_DIR/setup-env-test.sh"
zsh "$QA_DIR/setup-env-test.sh"
dash "$QA_DIR/setup-env-test.sh"
bash "$QA_DIR/completion-test.sh"

View File

@@ -20,24 +20,15 @@ export SPACK_ROOT=$(realpath "$QA_DIR/../../..")
coverage=""
coverage_run=""
# bash coverage depends on some other factors -- there are issues with
# kcov for Python 2.6, unit tests, and build tests.
if [[ $TEST_SUITE == unit && # kcov segfaults for the MPICH build test
$TRAVIS_OS_NAME == linux &&
$TRAVIS_PYTHON_VERSION != 2.6 ]];
then
BASH_COVERAGE="true"
else
BASH_COVERAGE="false"
fi
# Set up some variables for running coverage tests.
if [[ "$COVERAGE" == "true" ]]; then
# these set up coverage for Python
coverage=coverage
coverage_run="coverage run"
if [ "$BASH_COVERAGE" = true ]; then
# bash coverage depends on some other factors -- there are issues with
# kcov for Python 2.6, unit tests, and build tests.
if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then
mkdir -p coverage
cc_script="$SPACK_ROOT/lib/spack/env/cc"
bashcov=$(realpath ${QA_DIR}/bashcov)

View File

@@ -18,6 +18,7 @@ if ($?SPACK_ROOT) then
# Command aliases point at separate source files
alias spack 'set _sp_args = (\!*); source $_spack_share_dir/csh/spack.csh'
alias spacktivate 'spack env activate'
alias _spack_pathadd 'set _pa_args = (\!*) && source $_spack_share_dir/csh/pathadd.csh'
# Set variables needed by this script

View File

@@ -242,6 +242,8 @@ if [ "$_sp_shell" = bash ]; then
export -f spack
fi
alias spacktivate="spack env activate"
#
# Figure out where this file is.
#

View File

@@ -304,6 +304,13 @@ _pretty_print() {
complete -o bashdefault -o default -F _bash_completion_spack spack
# Completion for spacktivate
complete -o bashdefault -o default -F _bash_completion_spack spacktivate
_spacktivate() {
_spack_env_activate
}
# Spack commands
#
# Everything below here is auto-generated.
@@ -313,7 +320,7 @@ _spack() {
then
SPACK_COMPREPLY="-h --help -H --all-help --color -C --config-scope -d --debug --timestamp --pdb -e --env -D --env-dir -E --no-env --use-env-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock -p --profile --sorted-profile --lines -v --verbose --stacktrace -V --version --print-shell-vars"
else
SPACK_COMPREPLY="activate add arch blame bootstrap build build-env buildcache cd checksum ci clean clone commands compiler compilers concretize config configure containerize create deactivate debug dependencies dependents deprecate dev-build diy docs edit env extensions fetch find flake8 gc gpg graph help info install license list load location log-parse maintainers mirror module patch pkg providers pydoc python reindex remove rm repo resource restage setup spec stage test uninstall unload upload-s3 url verify versions view"
SPACK_COMPREPLY="activate add arch blame build build-env buildcache cd checksum ci clean clone commands compiler compilers concretize config configure containerize create deactivate debug dependencies dependents deprecate dev-build diy docs edit env extensions external fetch find flake8 gc gpg graph help info install license list load location log-parse maintainers mirror module patch pkg providers pydoc python reindex remove rm repo resource restage setup spec stage test uninstall unload upload-s3 url verify versions view"
fi
}
@@ -348,10 +355,6 @@ _spack_blame() {
fi
}
_spack_bootstrap() {
SPACK_COMPREPLY="-h --help -j --jobs --keep-prefix --keep-stage -n --no-checksum -v --verbose --use-cache --no-cache --cache-only --clean --dirty"
}
_spack_build() {
if $list_options
then
@@ -455,7 +458,7 @@ _spack_cd() {
_spack_checksum() {
if $list_options
then
SPACK_COMPREPLY="-h --help --keep-stage"
SPACK_COMPREPLY="-h --help --keep-stage -b --batch"
else
_all_packages
fi
@@ -466,20 +469,12 @@ _spack_ci() {
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="start generate pushyaml rebuild"
SPACK_COMPREPLY="generate rebuild"
fi
}
_spack_ci_start() {
SPACK_COMPREPLY="-h --help --output-file --copy-to --spack-repo --spack-ref --downstream-repo --branch-name --commit-sha"
}
_spack_ci_generate() {
SPACK_COMPREPLY="-h --help --output-file --copy-to --spack-repo --spack-ref"
}
_spack_ci_pushyaml() {
SPACK_COMPREPLY="-h --help --downstream-repo --branch-name --commit-sha"
SPACK_COMPREPLY="-h --help --output-file --copy-to --spack-repo --spack-ref --optimize"
}
_spack_ci_rebuild() {
@@ -697,7 +692,7 @@ _spack_deprecate() {
_spack_dev_build() {
if $list_options
then
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet -u --until --clean --dirty"
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet --drop-in -b --before -u --until --clean --dirty"
else
_all_packages
fi
@@ -706,7 +701,7 @@ _spack_dev_build() {
_spack_diy() {
if $list_options
then
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet -u --until --clean --dirty"
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet --drop-in -b --before -u --until --clean --dirty"
else
_all_packages
fi
@@ -817,6 +812,24 @@ _spack_extensions() {
fi
}
_spack_external() {
if $list_options
then
SPACK_COMPREPLY="-h --help"
else
SPACK_COMPREPLY="find"
fi
}
_spack_external_find() {
if $list_options
then
SPACK_COMPREPLY="-h --help --not-buildable"
else
_all_packages
fi
}
_spack_fetch() {
if $list_options
then
@@ -1029,7 +1042,7 @@ _spack_mirror() {
_spack_mirror_create() {
if $list_options
then
SPACK_COMPREPLY="-h --help -d --directory -a --all -f --file --skip-unstable-versions -D --dependencies -n --versions-per-spec"
SPACK_COMPREPLY="-h --help -d --directory -a --all -f --file --exclude-file --exclude-specs --skip-unstable-versions -D --dependencies -n --versions-per-spec"
else
_all_packages
fi
@@ -1497,7 +1510,7 @@ _spack_verify() {
_spack_versions() {
if $list_options
then
SPACK_COMPREPLY="-h --help -s --safe-only"
SPACK_COMPREPLY="-h --help -s --safe-only -c --concurrency"
else
_all_packages
fi
@@ -1508,7 +1521,7 @@ _spack_view() {
then
SPACK_COMPREPLY="-h --help -v --verbose -e --exclude -d --dependencies"
else
SPACK_COMPREPLY="symlink add soft hardlink hard remove rm statlink status check"
SPACK_COMPREPLY="symlink add soft hardlink hard copy relocate remove rm statlink status check"
fi
}
@@ -1557,6 +1570,24 @@ _spack_view_hard() {
fi
}
_spack_view_copy() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_relocate() {
if $list_options
then
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
else
_all_packages
fi
}
_spack_view_remove() {
if $list_options
then