Skip to content
Snippets Groups Projects

Feat/stack pinot noir

Merged Nicolas Richart requested to merge feat/stack_pinot_noir into main
1 file
+ 18
3
Compare changes
  • Side-by-side
  • Inline
+ 52
27
@@ -26,30 +26,48 @@ then
spack/bin/spack env create ${environment}
fi
for file in mirrors packages concretizer config spack definitions modules
do
if [ -e "${STACK_CONFIG_PATH}/${file}.yaml" ]; then
echo "Copying ${STACK_CONFIG_PATH}/${file}.yaml to ${SPACK_SYSTEM_CONFIG_PATH}"
cp "${STACK_CONFIG_PATH}/${file}.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}
cp "${STACK_CONFIG_PATH}/${file}.yaml" spack/etc/spack
fi
if [ -e "${STACK_CONFIG_PATH}/${file}_stack.yaml" ]; then
echo "Copying ${STACK_CONFIG_PATH}/${file}_stack.yaml to ${SPACK_SYSTEM_CONFIG_PATH}"
cp "${STACK_CONFIG_PATH}/${file}_stack.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}
fi
if [ -e "${STACK_CONFIG_PATH}/${file}_${environment}.yaml" ]; then
echo "Copying ${STACK_CONFIG_PATH}/${file}_${environment}.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml"
cp "${STACK_CONFIG_PATH}/${file}_${environment}.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml
fi
done
echo "Copying cp ${STACK_CONFIG_PATH}/spack.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/"
cp ${STACK_CONFIG_PATH}/spack.yaml ${SPACK_SYSTEM_CONFIG_PATH}
cp -r "${STACK_CONFIG_PATH}/templates" ${SPACK_SYSTEM_CONFIG_PATH}
declare -A file_mapping
file_mapping["_common"]=""
file_mapping["_stack"]="_stack"
file_mapping["_acc_${acc_type}"]="_accel"
file_mapping["_${environment}"]="_env"
declare -A placeholders
placeholders["{target}"]="${target}"
placeholders["{gcc_version}"]=$(jq -Mrc '.stack.compilers.gcc.version' ${STACK_CONFIG})
if [ "${accelerator}" != "none" ]
then
placeholders["{${acc_type}_arch}"]="${acc_arch}"
fi
echo blip
for file in mirrors packages concretizer config definitions modules
do
for suffix in ${!file_mapping[@]}
do
src=${STACK_CONFIG_PATH}/${file}${suffix}.yaml
dst=${SPACK_SYSTEM_CONFIG_PATH}/${file}"${file_mapping[$suffix]}".yaml
if [ -e "${STACK_CONFIG_PATH}/${file}${suffix}.yaml" ]
then
echo "Copying $src to $dst"
cp "$src" "$dst"
for ph in ${!placeholders[@]}
do
rep=${placeholders[$ph]}
sed -i -e "s/$ph/$rep/g" "$dst"
done
fi
done
done
cat <<EOF > ${SPACK_SYSTEM_CONFIG_PATH}/config_stack.yaml
config:
@@ -78,7 +96,6 @@ mirrors:
${mirrors}
EOF
cp "${SPACK_SYSTEM_CONFIG_PATH}/mirrors.yaml" spack/etc/spack
echo "Setting up packages"
@@ -91,16 +108,19 @@ echo "packages:" > ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
export system_compiler=$(jq -Mrc '
.stack
| .system_arch as $arch
| .system_compiler
| to_entries
| .[].value
| "\(.compiler)@\(.version) \($arch)"
| "\(.compiler)@\(.version)"
' ${STACK_CONFIG})
export system_arch=$(jq -Mrc '
.stack.system_arch
' ${STACK_CONFIG})
jq -Mrc '
.stack.system_packages
| map(" \(.):\n require:\n - spec: \"%\(env.system_compiler)\"")
| map(" \(.):\n require:\n - \"%\(env.system_compiler)\"\n - \"\(env.system_arch)\"")
| .[]
' ${STACK_CONFIG} >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
@@ -111,8 +131,6 @@ then
rm packages.yaml.old
fi
cp "${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml" spack/etc/spack
echo "Setting up extra repos"
EXTERNAL_REPOS=$(jq -r '.spack.repos | keys[]' ${STACK_CONFIG})
@@ -140,7 +158,14 @@ do
fi
done
cp "${SPACK_SYSTEM_CONFIG_PATH}/repos.yaml" spack/etc/spack
for file in mirrors packages concretizer config modules repos
do
if [ -e "${SPACK_SYSTEM_CONFIG_PATH}/${file}.yaml" ]
then
cp "${SPACK_SYSTEM_CONFIG_PATH}/${file}.yaml" spack/etc/spack
fi
done
echo "Setting up buildcache"
Loading