You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/07/26 08:48:25 UTC
[buildstream] branch tristan/source-set-ref-mapping-node created (now e8b664a30)
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a change to branch tristan/source-set-ref-mapping-node
in repository https://gitbox.apache.org/repos/asf/buildstream.git
at e8b664a30 source.py: Pass MappingNode to Source.set_ref()
This branch includes the following new commits:
new d08d0dd67 tests/integration/interactive_build.py: Use integration cache for sources
new e8b664a30 source.py: Pass MappingNode to Source.set_ref()
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[buildstream] 01/02: tests/integration/interactive_build.py: Use integration cache for sources
Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/source-set-ref-mapping-node
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit d08d0dd67edcb5f0fec6ae37aa008367f1be9272
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Tue Jul 26 17:41:24 2022 +0900
tests/integration/interactive_build.py: Use integration cache for sources
These tests don't need to redownload the alpine image for each test.
---
tests/integration/interactive_build.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/integration/interactive_build.py b/tests/integration/interactive_build.py
index cf0492717..adf06f984 100644
--- a/tests/integration/interactive_build.py
+++ b/tests/integration/interactive_build.py
@@ -5,7 +5,7 @@ import os
import pexpect
import pytest
-from buildstream._testing import runcli
+from buildstream._testing import runcli, integration_cache
from buildstream._testing._utils.site import HAVE_SANDBOX
from tests.testutils.constants import PEXPECT_TIMEOUT_SHORT, PEXPECT_TIMEOUT_LONG
@@ -19,12 +19,12 @@ DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
# This fixture launches a `bst build` of given element, and returns a
# `pexpect.spawn` object for the interactive session.
@pytest.fixture
-def build_session(datafiles, element_name):
+def build_session(integration_cache, datafiles, element_name):
project = str(datafiles)
# Spawn interactive session using `configured()` context manager in order
# to get the same config file as the `cli` fixture.
- with runcli.configured(project) as config_file:
+ with runcli.configured(project, config={"sourcedir": integration_cache.sources}) as config_file:
session = pexpect.spawn(
"bst",
[
[buildstream] 02/02: source.py: Pass MappingNode to Source.set_ref()
Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/source-set-ref-mapping-node
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit e8b664a305626873268af9fa15919cd0d4f5d162
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Tue Jul 26 17:44:59 2022 +0900
source.py: Pass MappingNode to Source.set_ref()
The API documentation calls for a MappingNode so we should be passing
the plugin a MappingNode here.
Fixes #1685
---
src/buildstream/source.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index e35d734a1..6c7713c3f 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -965,7 +965,7 @@ class Source(Plugin):
# First warn if there is a ref already loaded, and reset it
redundant_ref = self.get_ref() # pylint: disable=assignment-from-no-return
if redundant_ref is not None:
- self.set_ref(None, {})
+ self.set_ref(None, MappingNode.from_dict({}))
# Try to load the ref
refs = self._project_refs(project)
@@ -1015,14 +1015,18 @@ class Source(Plugin):
#
# Step 2 - Set the ref in memory, and determine changed state
#
- # TODO: we are working on dictionaries here, would be nicer to just work on the nodes themselves
clean = node.strip_node_info()
- to_modify = node.strip_node_info()
# Set the ref regardless of whether it changed, the
# TrackQueue() will want to update a specific node with
# the ref, regardless of whether the original has changed.
- self.set_ref(new_ref, to_modify)
+ #
+ # In the following add/del/mod merge algorithm we are working with
+ # dictionaries, but the plugin API calls for a MappingNode.
+ #
+ modify = node.clone()
+ self.set_ref(new_ref, modify)
+ to_modify = modify.strip_node_info()
# FIXME: this will save things too often, as a ref might not have
# changed. We should optimize this to detect it differently