summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQinusty <jrsmith9822@gmail.com>2018-08-21 09:38:39 +0000
committerQinusty <jrsmith9822@gmail.com>2018-08-21 09:38:39 +0000
commit4cab18e3e90d990eb1f9f0ff2795c9dc12c7dbaf (patch)
treee9fa9a6985b1774507173a59b7e20e5b994be203
parentba74a128d5bd7f18574d0f61039a55f1f63d28b7 (diff)
parent6bd688cfa6d309018a57c6125a2240e90aeb730f (diff)
downloadbuildstream-4cab18e3e90d990eb1f9f0ff2795c9dc12c7dbaf.tar.gz
Merge branch 'valentindavid/fix-broken-indentation-after-track' into 'master'
Fix broken indentation after track See merge request BuildStream/buildstream!622
-rw-r--r--buildstream/_includes.py11
-rw-r--r--buildstream/_loader/loader.py2
-rw-r--r--buildstream/_project.py2
-rw-r--r--buildstream/source.py2
4 files changed, 11 insertions, 6 deletions
diff --git a/buildstream/_includes.py b/buildstream/_includes.py
index e4afeaf82..e30003630 100644
--- a/buildstream/_includes.py
+++ b/buildstream/_includes.py
@@ -10,11 +10,15 @@ from ._exceptions import LoadError, LoadErrorReason
#
# Args:
# loader (Loader): The Loader object
+# copy_tree (bool): Whether to make a copy, of tree in
+# provenance. Should be true if intended to be
+# serialized.
class Includes:
- def __init__(self, loader):
+ def __init__(self, loader, *, copy_tree=False):
self._loader = loader
self._loaded = {}
+ self._copy_tree = copy_tree
# process()
#
@@ -96,10 +100,11 @@ class Includes:
directory = project.directory
file_path = os.path.join(directory, include)
key = (current_loader, file_path)
- if file_path not in self._loaded:
+ if key not in self._loaded:
self._loaded[key] = _yaml.load(os.path.join(directory, include),
shortname=shortname,
- project=project)
+ project=project,
+ copy_tree=self._copy_tree)
return self._loaded[key], file_path, current_loader
# _process_value()
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index 275bc20cf..8553bc6dd 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -78,7 +78,7 @@ class Loader():
self._elements = {} # Dict of elements
self._loaders = {} # Dict of junction loaders
- self._includes = Includes(self)
+ self._includes = Includes(self, copy_tree=True)
# load():
#
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 702fd81f4..c489e9025 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -419,7 +419,7 @@ class Project():
parent=parent_loader,
tempdir=tempdir)
- self._project_includes = Includes(self.loader)
+ self._project_includes = Includes(self.loader, copy_tree=False)
project_conf_first_pass = _yaml.node_copy(self._project_conf)
self._project_includes.process(project_conf_first_pass, only_local=True)
diff --git a/buildstream/source.py b/buildstream/source.py
index 9822beeec..6d5640532 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -794,7 +794,7 @@ class Source(Plugin):
# Save the ref in the originating file
#
try:
- _yaml.dump(_yaml.node_sanitize(provenance.toplevel), provenance.filename.name)
+ _yaml.dump(provenance.toplevel, provenance.filename.name)
except OSError as e:
raise SourceError("{}: Error saving source reference to '{}': {}"
.format(self, provenance.filename.name, e),