diff options
author | Jürg Billeter <j@bitron.ch> | 2020-04-01 10:03:42 +0200 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-04-14 15:30:49 +0000 |
commit | 5b48b47c8bd57bd9ad6c8d7f92f3bd08c283e6d0 (patch) | |
tree | 73005328564147367045f410c28b39d353798211 /src/buildstream | |
parent | d2a7f0a1285880c752315262199e230b520579db (diff) | |
download | buildstream-5b48b47c8bd57bd9ad6c8d7f92f3bd08c283e6d0.tar.gz |
sandbox: Reinitialize class when pickle is used
Class data is not pickled and thus, class variables set by
`check_available()` are not set when `check_sandbox_config()` is called
by a job subprocess.
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/sandbox/_sandboxbuildboxrun.py | 4 | ||||
-rw-r--r-- | src/buildstream/sandbox/_sandboxbwrap.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/buildstream/sandbox/_sandboxbuildboxrun.py b/src/buildstream/sandbox/_sandboxbuildboxrun.py index 7f35213af..80858f338 100644 --- a/src/buildstream/sandbox/_sandboxbuildboxrun.py +++ b/src/buildstream/sandbox/_sandboxbuildboxrun.py @@ -61,6 +61,10 @@ class SandboxBuildBoxRun(SandboxREAPI): @classmethod def check_sandbox_config(cls, platform, config): + if platform.does_multiprocessing_start_require_pickling(): + # Reinitialize class as class data is not pickled. + cls.check_available() + # Check host os and architecture match if config.build_os != platform.get_host_os(): raise SandboxError("Configured and host OS don't match.") diff --git a/src/buildstream/sandbox/_sandboxbwrap.py b/src/buildstream/sandbox/_sandboxbwrap.py index 851cc0969..216145938 100644 --- a/src/buildstream/sandbox/_sandboxbwrap.py +++ b/src/buildstream/sandbox/_sandboxbwrap.py @@ -107,6 +107,10 @@ class SandboxBwrap(Sandbox): @classmethod def check_sandbox_config(cls, local_platform, config): + if local_platform.does_multiprocessing_start_require_pickling(): + # Reinitialize class as class data is not pickled. + cls.check_available() + if not cls.user_ns_available: # Without user namespace support, the UID/GID in the sandbox # will match the host UID/GID. |