You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ak...@apache.org on 2022/06/17 06:11:33 UTC

[buildstream] 01/02: platform: merge check_sandbox_config into create_sandbox

This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a commit to branch dummy-sandbox
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 0c825fc6362e583f8722edec76f4cdd7d0e4dcd8
Author: Abderrahim Kitouni <ak...@gnome.org>
AuthorDate: Wed Jan 6 13:07:57 2021 +0100

    platform: merge check_sandbox_config into create_sandbox
    
    It's only called just before creating a sandbox
---
 src/buildstream/_platform/platform.py          | 17 +----------------
 src/buildstream/element.py                     |  1 -
 src/buildstream/sandbox/_sandboxbuildboxrun.py |  2 +-
 3 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py
index e924f0bb8..6af8ebb22 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -161,42 +161,27 @@ class Platform:
     def create_sandbox(self, *args, **kwargs):  # pylint: disable=method-hidden
         raise ImplError("Platform {platform} does not implement create_sandbox()".format(platform=type(self).__name__))
 
-    def check_sandbox_config(self, config):  # pylint: disable=method-hidden
-        raise ImplError(
-            "Platform {platform} does not implement check_sandbox_config()".format(platform=type(self).__name__)
-        )
-
     # Buildbox run sandbox methods
-    def _check_sandbox_config_buildboxrun(self, config):
-        from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
-
-        SandboxBuildBoxRun.check_sandbox_config(self, config)
-
     @staticmethod
     def _create_buildboxrun_sandbox(*args, **kwargs):
         from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
 
+        SandboxBuildBoxRun.check_sandbox_config(kwargs['config'])
         return SandboxBuildBoxRun(*args, **kwargs)
 
     def _setup_buildboxrun_sandbox(self):
         from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
 
         self._check_sandbox(SandboxBuildBoxRun)
-        self.check_sandbox_config = self._check_sandbox_config_buildboxrun
         self.create_sandbox = self._create_buildboxrun_sandbox
         return True
 
     # Dummy sandbox methods
-    @staticmethod
-    def _check_dummy_sandbox_config(config):
-        pass
-
     def _create_dummy_sandbox(self, *args, **kwargs):
         dummy_reasons = " and ".join(self.dummy_reasons)
         kwargs["dummy_reason"] = dummy_reasons
         return SandboxDummy(*args, **kwargs)
 
     def _setup_dummy_sandbox(self):
-        self.check_sandbox_config = Platform._check_dummy_sandbox_config
         self.create_sandbox = self._create_dummy_sandbox
         return True
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index a53ab331f..0ca7f59b7 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2707,7 +2707,6 @@ class Element(Plugin):
 
         elif directory is not None and os.path.exists(directory):
             platform = context.platform
-            platform.check_sandbox_config(config)
 
             sandbox = platform.create_sandbox(
                 context,
diff --git a/src/buildstream/sandbox/_sandboxbuildboxrun.py b/src/buildstream/sandbox/_sandboxbuildboxrun.py
index 5bbe93f76..765caf166 100644
--- a/src/buildstream/sandbox/_sandboxbuildboxrun.py
+++ b/src/buildstream/sandbox/_sandboxbuildboxrun.py
@@ -69,7 +69,7 @@ class SandboxBuildBoxRun(SandboxREAPI):
             cls._isas.add(Platform.get_host_arch())
 
     @classmethod
-    def check_sandbox_config(cls, platform, config):
+    def check_sandbox_config(cls, config):
         if config.build_os not in cls._osfamilies:
             raise SandboxError("OS '{}' is not supported by buildbox-run.".format(config.build_os))
         if config.build_arch not in cls._isas: