diff --git a/bin/build-spack-env.sh b/bin/build-spack-env.sh index 4b04a27..12c1e6e 100755 --- a/bin/build-spack-env.sh +++ b/bin/build-spack-env.sh @@ -360,7 +360,7 @@ EOF _cache_info() { if [[ "$cache_spec" =~ ^(([^|]+)\|)?((source|binary):)?(.*)$ ]]; then cache_name="${BASH_REMATCH[2]:-buildcache_$((++cache_count))}" - cache_type="${BASH_REMATCH[4]}" + (( have_mirror_add_type )) && cache_type="${BASH_REMATCH[4]}" cache_url="${BASH_REMATCH[5]}" else _die $EXIT_SPACK_CONFIG_FAILURE "unable to parse cache_spec \"$cache_spec\"" @@ -528,6 +528,12 @@ _configure_spack() { buildcache_rel_arg="-r" #################################### + #################################### + # Check whether spack mirror add supports --type + mirror_add_help="$(spack mirror add --help | grep -Ee '^[[:space:]]--type[[:space:]]+')" + [ -n "$mirror_add_help" ] && have_mirror_add_type=1 + #################################### + #################################### # Make sure we know about compilers. _report $PROGRESS "configuring compilers"