You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:55:16 UTC

[buildstream] 02/09: Added FUSE check, as WSL does not support FUSE yet

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

not-in-ldap pushed a commit to branch workspace_list_error_message
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit bb17975bebcc5a2faf46fc58f01c14299551711b
Author: knownexus <ph...@codethink.co.uk>
AuthorDate: Thu Aug 30 11:56:23 2018 +0100

    Added FUSE check, as WSL does not support FUSE yet
    
    _platform/linux.py: Add FUSE check
    And Ensure exception is not raised when performing sandbox availability check
    Without this check, WSL would error upon finding FUSE missing
    This must be bypassed to allow remote execution
---
 buildstream/_platform/linux.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/buildstream/_platform/linux.py b/buildstream/_platform/linux.py
index d29a1d5..5543aee 100644
--- a/buildstream/_platform/linux.py
+++ b/buildstream/_platform/linux.py
@@ -17,6 +17,7 @@
 #  Authors:
 #        Tristan Maat <tr...@codethink.co.uk>
 
+import os
 import subprocess
 
 from .. import _site
@@ -35,7 +36,11 @@ class Linux(Platform):
         super().__init__(context)
 
         self._die_with_parent_available = _site.check_bwrap_version(0, 1, 8)
-        self._user_ns_available = self._check_user_ns_available(context)
+
+        if self._local_sandbox_available():
+            self._user_ns_available = self._check_user_ns_available(context)
+        else:
+            self._user_ns_available = False
         self._artifact_cache = CASCache(context, enable_push=self._user_ns_available)
 
     @property
@@ -51,6 +56,12 @@ class Linux(Platform):
     ################################################
     #              Private Methods                 #
     ################################################
+    def _local_sandbox_available(self):
+        try:
+            return os.path.exists(utils.get_host_tool('bwrap')) and os.path.exists('/dev/fuse')
+        except utils.ProgramNotFoundError:
+            return False
+
     def _check_user_ns_available(self, context):
         # Here, lets check if bwrap is able to create user namespaces,
         # issue a warning if it's not available, and save the state