diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-04-24 10:59:13 +0100 |
---|---|---|
committer | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-04-24 11:04:58 +0100 |
commit | 8ae41d533d2b8a8148f8cf536eeabcb3d5806fb2 (patch) | |
tree | 0155337510b840ccba63423782180b6544e97b5c | |
parent | b44833516dc7b66b2423dc973a2a01748e833c3d (diff) | |
download | buildstream-bschubert/bug-repro-track.tar.gz |
tests:previous_source_access.py: Fix cornercase by changing elementbschubert/bug-repro-track
The 'local' source is always consistent, whereas other sources are not
if they don't have a ref set.
Currently when we are tracking and the previous source doesn't have a
ref, BuildStream will error out and cannot be used to track the refs.
-rw-r--r-- | tests/sources/previous_source_access.py | 8 | ||||
-rw-r--r-- | tests/sources/previous_source_access/elements/target.bst | 4 | ||||
-rw-r--r-- | tests/sources/previous_source_access/project.conf | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/sources/previous_source_access.py b/tests/sources/previous_source_access.py index a0661ca98..800e0ced5 100644 --- a/tests/sources/previous_source_access.py +++ b/tests/sources/previous_source_access.py @@ -4,6 +4,7 @@ import os import pytest +from buildstream import _yaml from buildstream.testing import cli # pylint: disable=unused-import DATA_DIR = os.path.join( @@ -20,6 +21,13 @@ DATA_DIR = os.path.join( def test_custom_transform_source(cli, datafiles): project = str(datafiles) + # Set the project_dir alias in project.conf to the path to the tested project + project_config_path = os.path.join(project, "project.conf") + project_config = _yaml.load(project_config_path) + aliases = _yaml.node_get(project_config, dict, "aliases") + _yaml.node_set(aliases, "project_dir", "file://{}".format(project)) + _yaml.dump(project_config, project_config_path) + # Ensure we can track result = cli.run(project=project, args=[ 'source', 'track', 'target.bst' diff --git a/tests/sources/previous_source_access/elements/target.bst b/tests/sources/previous_source_access/elements/target.bst index c9d3b9bb6..fd54a28d0 100644 --- a/tests/sources/previous_source_access/elements/target.bst +++ b/tests/sources/previous_source_access/elements/target.bst @@ -1,6 +1,6 @@ kind: import sources: -- kind: local - path: files/file +- kind: remote + url: project_dir:/files/file - kind: foo_transform diff --git a/tests/sources/previous_source_access/project.conf b/tests/sources/previous_source_access/project.conf index 1749b3dba..5d50ec2c5 100644 --- a/tests/sources/previous_source_access/project.conf +++ b/tests/sources/previous_source_access/project.conf @@ -3,6 +3,9 @@ name: foo element-path: elements +aliases: + project_dir: file://{project_dir} + plugins: - origin: local path: plugins/sources |