Skip to content
Snippets Groups Projects
Commit d3bc665b authored by Oriol Tintó's avatar Oriol Tintó
Browse files

Add upstream file only if it doesn't exist yet

parent 0ace322d
No related branches found
No related tags found
No related merge requests found
...@@ -14,17 +14,21 @@ function _install_spack() { ...@@ -14,17 +14,21 @@ function _install_spack() {
if [ ! -z "${SPACK_UPSTREAMS}" ]; then if [ ! -z "${SPACK_UPSTREAMS}" ]; then
UPSTREAMS_CONFIG=${SPACK_ROOT}/etc/spack/upstreams.yaml UPSTREAMS_CONFIG=${SPACK_ROOT}/etc/spack/upstreams.yaml
tmpfile=$(mktemp) # If the upstream file already exists, just skip it.
if [ ! -f ${UPSTREAMS_CONFIG} ]; then
echo "upstreams:" > $tmpfile tmpfile=$(mktemp)
i=0 echo "upstreams:" > $tmpfile
for UP in ${SPACK_UPSTREAMS}; do i=0
echo "Adding upstream repo to config $UPSTREAMS_CONFIG <= $UP" for UP in ${SPACK_UPSTREAMS}; do
i=$((i+1)) echo "Adding upstream repo to config $UPSTREAMS_CONFIG <= $UP"
echo " spack-instance-$i:" >> $tmpfile i=$((i+1))
echo " install_tree: $UP" >> $tmpfile echo " spack-instance-$i:" >> $tmpfile
done echo " install_tree: $UP" >> $tmpfile
mv $tmpfile $UPSTREAMS_CONFIG done
mv $tmpfile $UPSTREAMS_CONFIG
else
echo "upstreams was already present: ${UPSTREAMS_CONFIG}"
fi
fi fi
if [ ! -z "${SPACK_EXTERNALS}" ] ; then if [ ! -z "${SPACK_EXTERNALS}" ] ; then
......
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