[Notes] [Git][BuildStream/buildstream][master] 2 commits: element.py: Prepare local sandbox for bst checkout and bst shell



Title: GitLab

Jonathan Maw pushed to branch master at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/element.py
    ... ... @@ -1316,7 +1316,8 @@ class Element(Plugin):
    1316 1316
         #
    
    1317 1317
         @contextmanager
    
    1318 1318
         def _prepare_sandbox(self, scope, directory, deps='run', integrate=True):
    
    1319
    -        with self.__sandbox(directory, config=self.__sandbox_config) as sandbox:
    
    1319
    +        # bst shell and bst checkout require a local sandbox.
    
    1320
    +        with self.__sandbox(directory, config=self.__sandbox_config, allow_remote=False) as sandbox:
    
    1320 1321
     
    
    1321 1322
                 # Configure always comes first, and we need it.
    
    1322 1323
                 self.configure_sandbox(sandbox)
    
    ... ... @@ -2149,17 +2150,18 @@ class Element(Plugin):
    2149 2150
         #    stdout (fileobject): The stream for stdout for the sandbox
    
    2150 2151
         #    stderr (fileobject): The stream for stderr for the sandbox
    
    2151 2152
         #    config (SandboxConfig): The SandboxConfig object
    
    2153
    +    #    allow_remote (bool): Whether the sandbox is allowed to be remote
    
    2152 2154
         #
    
    2153 2155
         # Yields:
    
    2154 2156
         #    (Sandbox): A usable sandbox
    
    2155 2157
         #
    
    2156 2158
         @contextmanager
    
    2157
    -    def __sandbox(self, directory, stdout=None, stderr=None, config=None):
    
    2159
    +    def __sandbox(self, directory, stdout=None, stderr=None, config=None, allow_remote=True):
    
    2158 2160
             context = self._get_context()
    
    2159 2161
             project = self._get_project()
    
    2160 2162
             platform = Platform.get_platform()
    
    2161 2163
     
    
    2162
    -        if directory is not None and self.__use_remote_execution():
    
    2164
    +        if directory is not None and allow_remote and self.__use_remote_execution():
    
    2163 2165
     
    
    2164 2166
                 self.info("Using a remote sandbox for artifact {} with directory '{}'".format(self.name, directory))
    
    2165 2167
     
    
    ... ... @@ -2173,7 +2175,7 @@ class Element(Plugin):
    2173 2175
                 yield sandbox
    
    2174 2176
     
    
    2175 2177
             elif directory is not None and os.path.exists(directory):
    
    2176
    -            if self.__remote_execution_url:
    
    2178
    +            if allow_remote and self.__remote_execution_url:
    
    2177 2179
                     self.warn("Artifact {} is configured to use remote execution but element plugin does not support it."
    
    2178 2180
                               .format(self.name), detail="Element plugin '{kind}' does not support virtual directories."
    
    2179 2181
                               .format(kind=self.get_kind()), warning_token="remote-failure")
    
    ... ... @@ -2193,7 +2195,8 @@ class Element(Plugin):
    2193 2195
                 rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), dir=context.builddir)
    
    2194 2196
     
    
    2195 2197
                 # Recursive contextmanager...
    
    2196
    -            with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config) as sandbox:
    
    2198
    +            with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config,
    
    2199
    +                                allow_remote=allow_remote) as sandbox:
    
    2197 2200
                     yield sandbox
    
    2198 2201
     
    
    2199 2202
                 # Cleanup the build dir
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]