Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion repos/spack_repo/builtin/packages/rust/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ def get_test_path(p):
def setup_dependent_build_environment(
self, env: EnvironmentModifications, dependent_spec: Spec
) -> None:
env.set("CARGO_HOME", join_path(dependent_spec.package.stage.path, "cargo"))
# Respect an explicitly configured Cargo cache for offline builds.
# Otherwise retain Spack's isolated per-package cache.
cargo_home = os.environ.get("CARGO_HOME")
cargo_offline = os.environ.get("CARGO_NET_OFFLINE", "").lower() == "true"
Comment thread
mathomp4 marked this conversation as resolved.
Outdated
if cargo_home and cargo_offline:
env.set("CARGO_HOME", cargo_home)
else:
env.set("CARGO_HOME", join_path(dependent_spec.package.stage.path, "cargo"))
Comment thread
mathomp4 marked this conversation as resolved.

# Until we get a little more integration with cargo or offload solving to spack
# (how to do this is TBD), we need it to fall back to older package versions
Expand Down
Loading