Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Show changes
Commits on Source (15)
  • Sam Thursfield's avatar
    Fix crash when --debug is passed · 064abe66
    Sam Thursfield authored and Valentin David's avatar Valentin David committed
    I hit the following backtrace running `bst --debug push` and `bst
    --debug build`:
    
        pid:16736 id:000[--:--:--][][] START   Push
        pid:16736 id:000[--:--:--][][] START   Loading pipeline
        pid:16736 id:000[00:00:00][][] SUCCESS Loading pipeline
        pid:16736 id:000[--:--:--][][] START   Resolving pipeline
        pid:16736 id:000[--:--:--][][] BUG     'MesonElement' object has no attribute '_Element__cache_key'
    
            Traceback (most recent call last):
              File "/home/sam/.local/bin/bst", line 8, in <module>
                sys.exit(cli())
              File "/home/sam/.local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
                return self.main(*args, **kwargs)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/cli.py", line 162, in override_main
                standalone_mode=standalone_mode, **extra)
              File "/home/sam/.local/lib/python3.6/site-packages/click/core.py", line 697, in main
                rv = self.invoke(ctx)
              File "/home/sam/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
                return _process_result(sub_ctx.command.invoke(sub_ctx))
              File "/home/sam/.local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
                return ctx.invoke(self.callback, **ctx.params)
              File "/home/sam/.local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
                return callback(*args, **kwargs)
              File "/home/sam/.local/lib/python3.6/site-packages/click/decorators.py", line 27, in new_func
                return f(get_current_context().obj, *args, **kwargs)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/cli.py", line 471, in push
                app.stream.push(elements, selection=deps, remote=remote)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_stream.py", line 341, in push
                fetch_subprojects=True)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_stream.py", line 814, in _load
                fetch_subprojects=fetch_subprojects)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_pipeline.py", line 119, in load
                for meta in meta_elements
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_pipeline.py", line 119, in <listcomp>
                for meta in meta_elements
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/element.py", line 894, in _new_from_meta
                element = project.create_element(artifacts, meta)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_project.py", line 184, in create_element
                element = self._element_factory.create(self._context, self, artifacts, meta)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_elementfactory.py", line 57, in create
                return element_type(context, project, artifacts, meta, default_config)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/element.py", line 196, in __init__
                super().__init__(meta.name, context, project, meta.provenance, "element")
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/plugin.py", line 171, in __init__
                self.debug("Created: {}".format(self))
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/plugin.py", line 407, in debug
                self.__message(MessageType.DEBUG, brief, detail=detail)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/plugin.py", line 652, in __message
                self.__context.message(message)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_context.py", line 338, in message
                self._message_handler(message, context=self)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/app.py", line 665, in _message_handler
                text = self.logger.render(message)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/widget.py", line 585, in render
                return self._render(message)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/widget.py", line 620, in _render
                text += widget.render(message)
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/_frontend/widget.py", line 228, in render
                _, key, missing = plugin._get_display_key()
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/element.py", line 1138, in _get_display_key
                cache_key = self._get_cache_key()
              File "/home/sam/.local/lib/python3.6/site-packages/buildstream/element.py", line 991, in _get_cache_key
                return self.__cache_key
            AttributeError: 'MesonElement' object has no attribute '_Element__cache_key'
    
    The issue here is that when `--debug` is enabled, Plugin.__init__()
    tries to log a message like this:
    
            pid:16929 id:001[--:--:--][????????][ main:tracker.bst                   ] DEBUG   Created: meson element at tracker.bst [line 1 column 0]
    
    The log formatter is trying to get the cache key of the element in
    order to show it in the log, but the attribute hasn't yet been set
    because we've not got to the Element() constructor.
    064abe66
  • Valentin David's avatar
    Merge branch 'valentindavid/fix-debug-crash-1.2' into 'bst-1.2' · 6a2f3b59
    Valentin David authored
    Fix crash when --debug is passed
    
    See merge request !648
    6a2f3b59
  • Jürg Billeter's avatar
    _artifactcache/cascache.py: Fix for PEP 479 / Python 3.7 · 002749b5
    Jürg Billeter authored and Valentin David's avatar Valentin David committed
    Do not rely on `StopIteration` bubbling up.
    
    https://www.python.org/dev/peps/pep-0479/
    002749b5
  • Valentin David's avatar
    Merge branch 'valentindavid/python3.7-1.2' into 'bst-1.2' · 60df233d
    Valentin David authored
    Python 3.7 support
    
    See merge request !649
    60df233d
  • Phillip Smyth's avatar
    _stream.py: Added functionality for workspace open -f · 60c817c0
    Phillip Smyth authored and Valentin David's avatar Valentin David committed
    tests/frontend/workspace.py: Added tests
    60c817c0
  • Valentin David's avatar
    Merge branch 'valentindavid/bst_workspace_open_force_does_nothing-1.2' into 'bst-1.2' · 2315fff0
    Valentin David authored
    _stream.py: Added functionality for workspace open -f
    
    See merge request !651
    2315fff0
  • Francisco Redondo Marchena's avatar
    source-bundle: Enable --except option · b3fac258
    Francisco Redondo Marchena authored and Valentin David's avatar Valentin David committed
    Before this option was listed in help but was ignored when
    creating the source-bundle.
    
    Issue #468
    b3fac258
  • Valentin David's avatar
    Merge branch 'valentindavid/fix-except-argument-in-source-bundle-1.2' into 'bst-1.2' · 41d97b7e
    Valentin David authored
    source-bundle: Enable --except option
    
    See merge request !650
    41d97b7e
  • Martin Blanchard's avatar
    complete.py: Ensure paths get completed from 'element-path' · 83710050
    Martin Blanchard authored and Valentin David's avatar Valentin David committed
    Element paths should always be completed from the root element folder
    defined by the element-path key in project.conf. Fix complete_path() to
    always search into its given base_directory argument.
    
    See issue #448
    83710050
  • Valentin David's avatar
    Merge branch 'valentindavid/448-autocompletion-broken-defaults' into 'bst-1.2' · d6714dc2
    Valentin David authored
    Fix autocompletion for elements in sub-folders
    
    See merge request !652
    d6714dc2
  • Phil Dawson's avatar
    tests/frontend/show.py: Add test case for maximum recursion depth being exceeded · b82d6793
    Phil Dawson authored and Tristan Van Berkom's avatar Tristan Van Berkom committed
    Add test to ensure gracefull handling of exception thrown while loading
    a pipeline due the python's max recursion depth being exceeded.
    
    This is part of the work for issue #203
    b82d6793
  • Phil Dawson's avatar
    app.py: Handle exception thrown when recursion limit is exceeded · 9e2b66cc
    Phil Dawson authored and Tristan Van Berkom's avatar Tristan Van Berkom committed
    Because the RecursionError exception was introduced in Python 3.5, until we
    drop support for for Python 3.4, we must use RuntimeError.
    9e2b66cc
  • Tristan Van Berkom's avatar
    Merge branch 'valentindavid/203-BuildStream-crashes-when-dependency-tree-too-deep' into 'bst-1.2' · cbdeba7b
    Tristan Van Berkom authored
    203 build stream crashes when dependency tree too deep
    
    See merge request !654
    cbdeba7b
  • Martin Blanchard's avatar
    element.py: Raise an exception on unbuilt element checkout · 3088aca2
    Martin Blanchard authored and Valentin David's avatar Valentin David committed
    Trying to checkout an element that has no cached artifacts should be and
    handled failure. See #447.
    3088aca2
  • Martin Blanchard's avatar
    _stream.py: Print details on checkout failure · 7a9cd5ff
    Martin Blanchard authored and Valentin David's avatar Valentin David committed
    7a9cd5ff
Showing
with 178 additions and 12 deletions
......@@ -845,6 +845,9 @@ class _CASRemote():
def _grouper(iterable, n):
# pylint: disable=stop-iteration-return
while True:
yield itertools.chain([next(iterable)], itertools.islice(iterable, n - 1))
try:
current = next(iterable)
except StopIteration:
return
yield itertools.chain([current], itertools.islice(iterable, n - 1))
......@@ -275,6 +275,10 @@ class App():
# Exit with the error
self._error_exit(e)
except RecursionError:
click.echo("RecursionError: Depency depth is too large. Maximum recursion depth exceeded.",
err=True)
sys.exit(-1)
else:
# No exceptions occurred, print session time and summary
......
......@@ -827,4 +827,5 @@ def source_bundle(app, element, force, directory,
app.stream.source_bundle(element, directory,
track_first=track_,
force=force,
compression=compression)
compression=compression,
except_targets=except_)
......@@ -68,9 +68,10 @@ def complete_path(path_type, incomplete, base_directory='.'):
# If there was nothing on the left of the last separator,
# we are completing files in the filesystem root
base_path = os.path.join(base_directory, base_path)
elif os.path.isdir(incomplete):
base_path = incomplete
else:
incomplete_base_path = os.path.join(base_directory, incomplete)
if os.path.isdir(incomplete_base_path):
base_path = incomplete_base_path
try:
if base_path:
......
......@@ -437,7 +437,7 @@ class Stream():
except BstError as e:
raise StreamError("Error while staging dependencies into a sandbox"
": '{}'".format(e), reason=e.reason) from e
": '{}'".format(e), detail=e.detail, reason=e.reason) from e
# workspace_open
#
......@@ -478,7 +478,7 @@ class Stream():
# Check for workspace config
workspace = workspaces.get_workspace(target._get_full_name())
if workspace:
if workspace and not force:
raise StreamError("Workspace '{}' is already defined at: {}"
.format(target.name, workspace.path))
......@@ -497,6 +497,10 @@ class Stream():
"fetch the latest version of the " +
"source.")
if workspace:
workspaces.delete_workspace(target._get_full_name())
workspaces.save_config()
shutil.rmtree(directory)
try:
os.makedirs(directory, exist_ok=True)
except OSError as e:
......@@ -654,7 +658,8 @@ class Stream():
def source_bundle(self, target, directory, *,
track_first=False,
force=False,
compression="gz"):
compression="gz",
except_targets=()):
if track_first:
track_targets = (target,)
......@@ -663,6 +668,7 @@ class Stream():
elements, track_elements = self._load((target,), track_targets,
selection=PipelineSelection.ALL,
except_targets=except_targets,
track_selection=PipelineSelection.ALL,
fetch_subprojects=True)
......
......@@ -194,6 +194,9 @@ class Element(Plugin):
def __init__(self, context, project, artifacts, meta, plugin_conf):
self.__cache_key_dict = None # Dict for cache key calculation
self.__cache_key = None # Our cached cache key
super().__init__(meta.name, context, project, meta.provenance, "element")
self.__is_junction = meta.kind == "junction"
......@@ -212,8 +215,6 @@ class Element(Plugin):
self.__runtime_dependencies = [] # Direct runtime dependency Elements
self.__build_dependencies = [] # Direct build dependency Elements
self.__sources = [] # List of Sources
self.__cache_key_dict = None # Dict for cache key calculation
self.__cache_key = None # Our cached cache key
self.__weak_cache_key = None # Our cached weak cache key
self.__strict_cache_key = None # Our cached cache key for strict builds
self.__artifacts = artifacts # Artifact cache
......@@ -612,6 +613,12 @@ class Element(Plugin):
dep.stage_artifact(sandbox)
"""
if not self._cached():
detail = "No artifacts have been cached yet for that element\n" + \
"Try building the element first with `bst build`\n"
raise ElementError("No artifacts to stage",
detail=detail, reason="uncached-checkout-attempt")
if update_mtimes is None:
update_mtimes = []
......
......@@ -212,6 +212,10 @@ def test_option_directory(datafiles, cli, cmd, word_idx, expected, subdir):
# Also try multi arguments together
('no-element-path', 'bst --directory ../ checkout t ', 4, ['target.bst '], 'files'),
('no-element-path', 'bst --directory ../ checkout target.bst ', 5, ['bin-files/', 'dev-files/'], 'files'),
# When element-path have sub-folders
('sub-folders', 'bst show base', 2, ['base/wanted.bst '], None),
('sub-folders', 'bst show base/', 2, ['base/wanted.bst '], None),
])
def test_argument_element(datafiles, cli, project, cmd, word_idx, expected, subdir):
cwd = os.path.join(str(datafiles), project)
......
kind: autotools
description: |
Not auto-completed element
kind: stack
description: Base stack
depends:
- base/wanted.bst
kind: autotools
description: |
Auto-completed element
kind: autotools
description: |
Hello world
# Project config for frontend build test
name: test
element-path: elements
......@@ -96,6 +96,16 @@ def test_build_checkout_deps(datafiles, cli, deps):
assert not os.path.exists(filename)
@pytest.mark.datafiles(DATA_DIR)
def test_build_checkout_unbuilt(datafiles, cli):
project = os.path.join(datafiles.dirname, datafiles.basename)
checkout = os.path.join(cli.directory, 'checkout')
# Check that checking out an unbuilt element fails nicely
result = cli.run(project=project, args=['checkout', 'target.bst', checkout])
result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
@pytest.mark.datafiles(DATA_DIR)
def test_build_checkout_tarball(datafiles, cli):
project = os.path.join(datafiles.dirname, datafiles.basename)
......
import os
import pytest
import sys
import shutil
import itertools
import pytest
from tests.testutils import cli, generate_junction
from buildstream import _yaml
......@@ -232,3 +234,58 @@ def test_fetched_junction(cli, tmpdir, datafiles, element_name):
results = result.output.strip().splitlines()
assert 'junction.bst:import-etc.bst-buildable' in results
###############################################################
# Testing recursion depth #
###############################################################
@pytest.mark.parametrize("dependency_depth", [100, 500, 1200])
def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth):
project_name = "recursion-test"
path = str(tmpdir)
project_path = os.path.join(path, project_name)
def setup_test():
"""
Creates a bst project with dependencydepth + 1 elements, each of which
depends of the previous element to be created. Each element created
is of type import and has an empty source file.
"""
os.mkdir(project_path)
result = cli.run(project=project_path, silent=True,
args=['init', '--project-name', project_name])
result.assert_success()
sourcefiles_path = os.path.join(project_path, "files")
os.mkdir(sourcefiles_path)
element_path = os.path.join(project_path, "elements")
for i in range(0, dependency_depth + 1):
element = {
'kind': 'import',
'sources': [{'kind': 'local',
'path': 'files/source{}'.format(str(i))}],
'depends': ['element{}.bst'.format(str(i - 1))]
}
if i == 0:
del element['depends']
_yaml.dump(element, os.path.join(element_path, "element{}.bst".format(str(i))))
source = os.path.join(sourcefiles_path, "source{}".format(str(i)))
open(source, 'x').close()
assert os.path.exists(source)
setup_test()
result = cli.run(project=project_path, silent=True,
args=['show', "element{}.bst".format(str(dependency_depth))])
recursion_limit = sys.getrecursionlimit()
if dependency_depth <= recursion_limit:
result.assert_success()
else:
# Assert exception is thown and handled
assert not result.unhandled_exception
assert result.exit_code == -1
shutil.rmtree(project_path)
......@@ -123,6 +123,58 @@ def test_open_force(cli, tmpdir, datafiles, kind):
result.assert_success()
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", repo_kinds)
def test_open_force_open(cli, tmpdir, datafiles, kind):
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False)
# Assert the workspace dir exists
assert os.path.exists(workspace)
# Now open the workspace again with --force, this should happily succeed
result = cli.run(project=project, args=[
'workspace', 'open', '--force', element_name, workspace
])
result.assert_success()
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", repo_kinds)
def test_open_force_different_workspace(cli, tmpdir, datafiles, kind):
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False, "-alpha")
# Assert the workspace dir exists
assert os.path.exists(workspace)
hello_path = os.path.join(workspace, 'usr', 'bin', 'hello')
hello1_path = os.path.join(workspace, 'usr', 'bin', 'hello1')
tmpdir = os.path.join(str(tmpdir), "-beta")
shutil.move(hello_path, hello1_path)
element_name2, project2, workspace2 = open_workspace(cli, tmpdir, datafiles, kind, False, "-beta")
# Assert the workspace dir exists
assert os.path.exists(workspace2)
# Assert that workspace 1 contains the modified file
assert os.path.exists(hello1_path)
# Assert that workspace 2 contains the unmodified file
assert os.path.exists(os.path.join(workspace2, 'usr', 'bin', 'hello'))
# Now open the workspace again with --force, this should happily succeed
result = cli.run(project=project, args=[
'workspace', 'open', '--force', element_name2, workspace
])
# Assert that the file in workspace 1 has been replaced
# With the file from workspace 2
assert os.path.exists(hello_path)
assert not os.path.exists(hello1_path)
result.assert_success()
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", repo_kinds)
def test_close(cli, tmpdir, datafiles, kind):
......