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:47:03 UTC

[buildstream] 01/17: Revert "Replace bwrap checks with calls to check_bwrap_version"

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

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

commit 5034957ebbd4248be352b7b6be118f09f7d3cd4e
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu May 10 20:52:15 2018 +0900

    Revert "Replace bwrap checks with calls to check_bwrap_version"
    
    This reverts commit f8952d6b8a775026d8a566969dd2570badf838fe.
    
    For some reason, the changes introduced here cause issue #395 to
    occur, without these changes we are not hitting the spurrious errors
    described in #395.
---
 buildstream/_platform/linux.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/buildstream/_platform/linux.py b/buildstream/_platform/linux.py
index 26dafb9..c4e87de 100644
--- a/buildstream/_platform/linux.py
+++ b/buildstream/_platform/linux.py
@@ -20,7 +20,6 @@
 
 import subprocess
 
-from .. import _site
 from .. import utils
 from .._artifactcache.ostreecache import OSTreeCache
 from .._message import Message, MessageType
@@ -35,8 +34,8 @@ class Linux(Platform):
 
         super().__init__(context, project)
 
-        self._die_with_parent_available = _site.check_bwrap_version(0, 1, 8)
         self._user_ns_available = self._check_user_ns_available(context)
+        self._die_with_parent_available = self._check_die_with_parent_available(context)
         self._artifact_cache = OSTreeCache(context, enable_push=self._user_ns_available)
 
     @property
@@ -82,3 +81,20 @@ class Linux(Platform):
                         detail="Some builds may not function due to lack of uid / gid 0, " +
                         "artifacts created will not be trusted for push purposes."))
             return False
+
+    def _check_die_with_parent_available(self, context):
+
+        # bwrap supports --die-with-parent since 0.1.8.
+        # Let's check whether the host bwrap supports it.
+        bwrap = utils.get_host_tool('bwrap')
+
+        try:
+            subprocess.check_call([
+                bwrap,
+                '--ro-bind', '/', '/',
+                '--die-with-parent',
+                'true'
+            ], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+            return True
+        except subprocess.CalledProcessError:
+            return False