From ce1b569b69b0ab24f3d3c52f2101fd8723c11ebc Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 16 Jul 2024 18:15:29 +0200 Subject: Fix order of deserialization in subprocess context (#45229) Since the the MetaPathFinder now owns a lazily constructed RepoPath object, we need to deserialize environments before the package that needs to be restored. Before we were relying on globals to be inconsistent in a way that let the entire process go. --- lib/spack/spack/subprocess_context.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/subprocess_context.py b/lib/spack/spack/subprocess_context.py index c90dcf8409..cd0c24676d 100644 --- a/lib/spack/spack/subprocess_context.py +++ b/lib/spack/spack/subprocess_context.py @@ -79,9 +79,11 @@ class PackageInstallContext: self.test_state.restore() spack.main.spack_working_dir = self.spack_working_dir env = pickle.load(self.serialized_env) if _SERIALIZE else self.env - pkg = pickle.load(self.serialized_pkg) if _SERIALIZE else self.pkg if env: spack.environment.activate(env) + # Order of operation is important, since the package might be retrieved + # from a repo defined within the environment configuration + pkg = pickle.load(self.serialized_pkg) if _SERIALIZE else self.pkg return pkg -- cgit v1.2.3-70-g09d2