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