summaryrefslogtreecommitdiff
path: root/buildstream/source.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-29 19:39:53 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-29 19:39:53 +0900
commita703de6ac374dfd22d2e0db0454f19ebb9722adf (patch)
tree9bbf0e71ee7fadf55fef046f97052c9fe83c19dc /buildstream/source.py
parent48c031745d2e7f1a89a8a318eb40f289672cc4a4 (diff)
downloadbuildstream-a703de6ac374dfd22d2e0db0454f19ebb9722adf.tar.gz
source.py: Inherit unique ID in cloned sourcestristan/fix-cloned-plugin-ids-1.2
When cloning a Source, we should inherit the same unique ID for the sake of sending a valid ID in any messages sent back to the frontend from a source cloned in a child task.
Diffstat (limited to 'buildstream/source.py')
-rw-r--r--buildstream/source.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index b8759c0d8..f72aeae86 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -225,10 +225,10 @@ class Source(Plugin):
__defaults = {} # The defaults from the project
__defaults_set = False # Flag, in case there are not defaults at all
- def __init__(self, context, project, meta, *, alias_override=None):
+ def __init__(self, context, project, meta, *, alias_override=None, unique_id=None):
provenance = _yaml.node_get_provenance(meta.config)
super().__init__("{}-{}".format(meta.element_name, meta.element_index),
- context, project, provenance, "source")
+ context, project, provenance, "source", unique_id=unique_id)
self.__element_name = meta.element_name # The name of the element owning this source
self.__element_index = meta.element_index # The index of the source in the owning element's source list
@@ -916,7 +916,9 @@ class Source(Plugin):
alias = self._get_alias()
source_kind = type(self)
- clone = source_kind(context, project, self.__meta, alias_override=(alias, uri))
+ clone = source_kind(context, project, self.__meta,
+ alias_override=(alias, uri),
+ unique_id=self._unique_id)
# Do the necessary post instantiation routines here
#