Valentin David pushed to branch valentindavid/fix-broken-indentation-after-track at BuildStream / buildstream
Commits:
-
0066d701
by Tiago Gomes at 2018-08-16T12:33:01Z
-
898aa8a0
by Tiago Gomes at 2018-08-16T13:43:06Z
-
b62c361c
by Tiago Gomes at 2018-08-16T13:54:54Z
-
1e3e2a93
by Tiago Gomes at 2018-08-16T15:00:12Z
-
1f3a252f
by Valentin David at 2018-08-16T21:49:12Z
-
22a3f8bf
by Valentin David at 2018-08-16T21:49:12Z
6 changed files:
- buildstream/_artifactcache/cascache.py
- buildstream/_includes.py
- buildstream/_loader/loader.py
- buildstream/_project.py
- buildstream/source.py
- doc/examples/autotools/project.conf
Changes:
... | ... | @@ -25,6 +25,7 @@ import signal |
25 | 25 |
import stat
|
26 | 26 |
import tempfile
|
27 | 27 |
import uuid
|
28 |
+import errno
|
|
28 | 29 |
from urllib.parse import urlparse
|
29 | 30 |
|
30 | 31 |
import grpc
|
... | ... | @@ -82,7 +83,8 @@ class CASCache(ArtifactCache): |
82 | 83 |
|
83 | 84 |
tree = self.resolve_ref(ref, update_mtime=True)
|
84 | 85 |
|
85 |
- dest = os.path.join(self.extractdir, element._get_project().name, element.normal_name, tree.hash)
|
|
86 |
+ dest = os.path.join(self.extractdir, element._get_project().name,
|
|
87 |
+ element.normal_name, tree.hash)
|
|
86 | 88 |
if os.path.isdir(dest):
|
87 | 89 |
# artifact has already been extracted
|
88 | 90 |
return dest
|
... | ... | @@ -100,7 +102,7 @@ class CASCache(ArtifactCache): |
100 | 102 |
#
|
101 | 103 |
# If rename fails with these errors, another process beat
|
102 | 104 |
# us to it so just ignore.
|
103 |
- if e.errno not in [os.errno.ENOTEMPTY, os.errno.EEXIST]:
|
|
105 |
+ if e.errno not in [errno.ENOTEMPTY, errno.EEXIST]:
|
|
104 | 106 |
raise ArtifactError("Failed to extract artifact for ref '{}': {}"
|
105 | 107 |
.format(ref, e)) from e
|
106 | 108 |
|
... | ... | @@ -10,11 +10,15 @@ from ._exceptions import LoadError, LoadErrorReason |
10 | 10 |
#
|
11 | 11 |
# Args:
|
12 | 12 |
# loader (Loader): The Loader object
|
13 |
+# copy_tree (bool): Whether to make a copy, of tree in
|
|
14 |
+# provenance. Should be true if intended to be
|
|
15 |
+# serialized.
|
|
13 | 16 |
class Includes:
|
14 | 17 |
|
15 |
- def __init__(self, loader):
|
|
18 |
+ def __init__(self, loader, *, copy_tree=False):
|
|
16 | 19 |
self._loader = loader
|
17 | 20 |
self._loaded = {}
|
21 |
+ self._copy_tree = copy_tree
|
|
18 | 22 |
|
19 | 23 |
# process()
|
20 | 24 |
#
|
... | ... | @@ -96,10 +100,11 @@ class Includes: |
96 | 100 |
directory = project.directory
|
97 | 101 |
file_path = os.path.join(directory, include)
|
98 | 102 |
key = (current_loader, file_path)
|
99 |
- if file_path not in self._loaded:
|
|
103 |
+ if key not in self._loaded:
|
|
100 | 104 |
self._loaded[key] = _yaml.load(os.path.join(directory, include),
|
101 | 105 |
shortname=shortname,
|
102 |
- project=project)
|
|
106 |
+ project=project,
|
|
107 |
+ copy_tree=self._copy_tree)
|
|
103 | 108 |
return self._loaded[key], file_path, current_loader
|
104 | 109 |
|
105 | 110 |
# _process_value()
|
... | ... | @@ -78,7 +78,7 @@ class Loader(): |
78 | 78 |
self._elements = {} # Dict of elements
|
79 | 79 |
self._loaders = {} # Dict of junction loaders
|
80 | 80 |
|
81 |
- self._includes = Includes(self)
|
|
81 |
+ self._includes = Includes(self, copy_tree=True)
|
|
82 | 82 |
|
83 | 83 |
# load():
|
84 | 84 |
#
|
... | ... | @@ -419,7 +419,7 @@ class Project(): |
419 | 419 |
parent=parent_loader,
|
420 | 420 |
tempdir=tempdir)
|
421 | 421 |
|
422 |
- self._project_includes = Includes(self.loader)
|
|
422 |
+ self._project_includes = Includes(self.loader, copy_tree=False)
|
|
423 | 423 |
|
424 | 424 |
project_conf_first_pass = _yaml.node_copy(self._project_conf)
|
425 | 425 |
self._project_includes.process(project_conf_first_pass, only_local=True)
|
... | ... | @@ -794,7 +794,7 @@ class Source(Plugin): |
794 | 794 |
# Save the ref in the originating file
|
795 | 795 |
#
|
796 | 796 |
try:
|
797 |
- _yaml.dump(_yaml.node_sanitize(provenance.toplevel), provenance.filename.name)
|
|
797 |
+ _yaml.dump(provenance.toplevel, provenance.filename.name)
|
|
798 | 798 |
except OSError as e:
|
799 | 799 |
raise SourceError("{}: Error saving source reference to '{}': {}"
|
800 | 800 |
.format(self, provenance.filename.name, e),
|
... | ... | @@ -10,4 +10,4 @@ element-path: elements |
10 | 10 |
# Define some aliases for the tarballs we download
|
11 | 11 |
aliases:
|
12 | 12 |
alpine: https://gnome7.codethink.co.uk/tarballs/
|
13 |
- gnu: https://ftpmirror.gnu.org/gnu/automake/
|
|
13 |
+ gnu: http://ftpmirror.gnu.org/gnu/automake/
|