Skip to content

bst shell crashes when staging dependencies

runnig bst shell core-deps/vala.bst gives me this error

[--:--:--] START   Staging dependencies
Traceback (most recent call last):
  File "/usr/lib/python3.5/pdb.py", line 1665, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python3.5/pdb.py", line 1546, in _runscript
    self.run(statement)
  File "/usr/lib/python3.5/bdb.py", line 431, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/home/abderrahim/.local/bin/bst", line 3, in <module>
    import sys
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/abderrahim/dev/buildstream/buildstream/_frontend/main.py", line 142, in override_main
    standalone_mode=standalone_mode, **extra)
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/abderrahim/.local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/abderrahim/dev/buildstream/buildstream/_frontend/main.py", line 534, in shell
    exitcode = app.pipeline.targets[0]._shell(scope, sysroot, command=command)
  File "/home/abderrahim/dev/buildstream/buildstream/element.py", line 1354, in _shell
    with self._prepare_sandbox(scope, directory) as sandbox:
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/abderrahim/dev/buildstream/buildstream/element.py", line 1328, in _prepare_sandbox
    self.stage_dependency_artifacts(sandbox, scope)
  File "/home/abderrahim/dev/buildstream/buildstream/element.py", line 486, in stage_dependency_artifacts
    element_project = element._get_project()
AttributeError: 'NoneType' object has no attribute '_get_project'

This simple patch solves it. I'd like to send a merge request but I'm not sure what to do about the tests.

diff --git a/buildstream/element.py b/buildstream/element.py
index 8ae45d3..4b672df 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -482,7 +482,7 @@ class Element(Plugin):
                 # The bottom item overlaps nothing
                 overlapping_elements = elements[1:]
                 for elm in overlapping_elements:
-                    element = self.search(Scope.BUILD, elm)
+                    element = self.search(scope, elm)
                     element_project = element._get_project()
                     if not element.__file_is_whitelisted(f):
                         forbidden_overlap = True
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information