Skip to content

Commit

Permalink
Make prefix-finding robust against uninstalled build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Aug 19, 2024
1 parent 731a7a9 commit 7d50a6a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/build-spack-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -786,16 +786,23 @@ _maybe_cache_binaries() {
# avoid unnecessary overhead.
{
cat > "$TMP/location_cmds.py" <<\EOF
import spack.cmd
import spack.environment
import spack.store
all_hashes = spack.environment.active_environment().all_hashes()
def print_prefix_for_hash(spec, hash):
matching_specs = spack.store.STORE.db.query(hash, hashes=all_hashes, installed=True)
if len(matching_specs) == 1:
print(spec, matching_specs[0].prefix)
env = spack.environment.active_environment()
EOF
} ||
_die "I/O error writing to $TMP/location_cmds.py"
for hash in ${hashes_to_cache_tmp[*]:+"${hashes_to_cache_tmp[@]}"}; do
_report $DEBUG_4 "scheduling location lookup of $hash"
echo 'print("'"$hash"'", spack.cmd.disambiguate_spec("'"/${hash//*\///}"'", env, False).prefix)' >> "$TMP/location_cmds.py"
echo 'print_prefix_for_hash("'"$hash"'", "'"/${hash//*\///}"'")' >> "$TMP/location_cmds.py"
done ||
_die "I/O error writing to $TMP/location_cmds.py"
local hashes_to_cache=(
Expand Down

0 comments on commit 7d50a6a

Please sign in to comment.