Jürg Billeter pushed to branch juerg/cas-mtime at BuildStream / buildstream
Commits:
-
b8f69946
by Daniel Silverstone at 2018-10-18T09:32:09Z
-
892866e1
by richardmaw-codethink at 2018-10-18T10:04:32Z
-
f1aa0974
by Javier Jardón at 2018-10-18T14:13:35Z
-
f1550c8e
by Valentin David at 2018-10-18T16:02:45Z
-
1c24979a
by Angelos Evripiotis at 2018-10-19T21:17:01Z
-
43a2eee3
by Angelos Evripiotis at 2018-10-19T21:48:59Z
-
12719f0d
by Jürg Billeter at 2018-10-22T17:05:41Z
-
a7a28d14
by Jürg Billeter at 2018-10-22T17:05:41Z
24 changed files:
- buildstream/_artifactcache/artifactcache.py
- buildstream/_artifactcache/cascache.py
- buildstream/_context.py
- buildstream/_includes.py
- buildstream/_loader/loadelement.py
- buildstream/_loader/loader.py
- buildstream/_options/optionpool.py
- buildstream/_project.py
- buildstream/_scheduler/queues/queue.py
- buildstream/_yaml.py
- buildstream/buildelement.py
- buildstream/element.py
- buildstream/plugin.py
- buildstream/plugins/elements/autotools.yaml
- buildstream/plugins/elements/cmake.yaml
- buildstream/plugins/elements/junction.py
- buildstream/plugins/elements/make.yaml
- buildstream/plugins/elements/manual.yaml
- buildstream/plugins/elements/meson.yaml
- buildstream/plugins/elements/qmake.yaml
- buildstream/plugins/sources/git.py
- buildstream/source.py
- tests/loader/dependencies.py
- tests/yaml/yaml.py
Changes:
... | ... | @@ -19,7 +19,8 @@ |
19 | 19 |
|
20 | 20 |
import os
|
21 | 21 |
import string
|
22 |
-from collections import Mapping, namedtuple
|
|
22 |
+from collections import namedtuple
|
|
23 |
+from collections.abc import Mapping
|
|
23 | 24 |
|
24 | 25 |
from ..types import _KeyStrength
|
25 | 26 |
from .._exceptions import ArtifactError, ImplError, LoadError, LoadErrorReason
|
... | ... | @@ -227,7 +228,7 @@ class ArtifactCache(): |
227 | 228 |
self._required_elements.update(elements)
|
228 | 229 |
|
229 | 230 |
# For the cache keys which were resolved so far, we bump
|
230 |
- # the atime of them.
|
|
231 |
+ # the mtime of them.
|
|
231 | 232 |
#
|
232 | 233 |
# This is just in case we have concurrent instances of
|
233 | 234 |
# BuildStream running with the same artifact cache, it will
|
... | ... | @@ -239,7 +240,7 @@ class ArtifactCache(): |
239 | 240 |
for key in (strong_key, weak_key):
|
240 | 241 |
if key:
|
241 | 242 |
try:
|
242 |
- self.update_atime(key)
|
|
243 |
+ self.update_mtime(element, key)
|
|
243 | 244 |
except ArtifactError:
|
244 | 245 |
pass
|
245 | 246 |
|
... | ... | @@ -390,15 +391,16 @@ class ArtifactCache(): |
390 | 391 |
def preflight(self):
|
391 | 392 |
pass
|
392 | 393 |
|
393 |
- # update_atime()
|
|
394 |
+ # update_mtime()
|
|
394 | 395 |
#
|
395 |
- # Update the atime of an artifact.
|
|
396 |
+ # Update the mtime of an artifact.
|
|
396 | 397 |
#
|
397 | 398 |
# Args:
|
399 |
+ # element (Element): The Element to update
|
|
398 | 400 |
# key (str): The key of the artifact.
|
399 | 401 |
#
|
400 |
- def update_atime(self, key):
|
|
401 |
- raise ImplError("Cache '{kind}' does not implement contains()"
|
|
402 |
+ def update_mtime(self, element, key):
|
|
403 |
+ raise ImplError("Cache '{kind}' does not implement update_mtime()"
|
|
402 | 404 |
.format(kind=type(self).__name__))
|
403 | 405 |
|
404 | 406 |
# initialize_remotes():
|
... | ... | @@ -538,8 +538,9 @@ class CASCache(ArtifactCache): |
538 | 538 |
except FileNotFoundError as e:
|
539 | 539 |
raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e
|
540 | 540 |
|
541 |
- def update_atime(self, ref):
|
|
541 |
+ def update_mtime(self, element, key):
|
|
542 | 542 |
try:
|
543 |
+ ref = self.get_artifact_fullname(element, key)
|
|
543 | 544 |
os.utime(self._refpath(ref))
|
544 | 545 |
except FileNotFoundError as e:
|
545 | 546 |
raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e
|
... | ... | @@ -19,7 +19,8 @@ |
19 | 19 |
|
20 | 20 |
import os
|
21 | 21 |
import datetime
|
22 |
-from collections import deque, Mapping
|
|
22 |
+from collections import deque
|
|
23 |
+from collections.abc import Mapping
|
|
23 | 24 |
from contextlib import contextmanager
|
24 | 25 |
from . import utils
|
25 | 26 |
from . import _cachekey
|
1 | 1 |
import os
|
2 |
-from collections import Mapping
|
|
2 |
+from collections.abc import Mapping
|
|
3 | 3 |
from . import _yaml
|
4 | 4 |
from ._exceptions import LoadError, LoadErrorReason
|
5 | 5 |
|
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 |
# Tristan Van Berkom <tristan vanberkom codethink co uk>
|
19 | 19 |
|
20 | 20 |
# System imports
|
21 |
-from collections import Mapping
|
|
21 |
+from collections.abc import Mapping
|
|
22 | 22 |
|
23 | 23 |
# BuildStream toplevel imports
|
24 | 24 |
from .._exceptions import LoadError, LoadErrorReason
|
... | ... | @@ -19,7 +19,8 @@ |
19 | 19 |
|
20 | 20 |
import os
|
21 | 21 |
from functools import cmp_to_key
|
22 |
-from collections import Mapping, namedtuple
|
|
22 |
+from collections import namedtuple
|
|
23 |
+from collections.abc import Mapping
|
|
23 | 24 |
import tempfile
|
24 | 25 |
import shutil
|
25 | 26 |
|
... | ... | @@ -296,12 +297,14 @@ class Loader(): |
296 | 297 |
# Raises:
|
297 | 298 |
# (LoadError): In case there was a circular dependency error
|
298 | 299 |
#
|
299 |
- def _check_circular_deps(self, element_name, check_elements=None, validated=None):
|
|
300 |
+ def _check_circular_deps(self, element_name, check_elements=None, validated=None, sequence=None):
|
|
300 | 301 |
|
301 | 302 |
if check_elements is None:
|
302 | 303 |
check_elements = {}
|
303 | 304 |
if validated is None:
|
304 | 305 |
validated = {}
|
306 |
+ if sequence is None:
|
|
307 |
+ sequence = []
|
|
305 | 308 |
|
306 | 309 |
element = self._elements[element_name]
|
307 | 310 |
|
... | ... | @@ -314,16 +317,24 @@ class Loader(): |
314 | 317 |
return
|
315 | 318 |
|
316 | 319 |
if check_elements.get(element_name) is not None:
|
320 |
+ # Create `chain`, the loop of element dependencies from this
|
|
321 |
+ # element back to itself, by trimming everything before this
|
|
322 |
+ # element from the sequence under consideration.
|
|
323 |
+ chain = sequence[sequence.index(element_name):]
|
|
324 |
+ chain.append(element_name)
|
|
317 | 325 |
raise LoadError(LoadErrorReason.CIRCULAR_DEPENDENCY,
|
318 |
- "Circular dependency detected for element: {}"
|
|
319 |
- .format(element.name))
|
|
326 |
+ ("Circular dependency detected at element: {}\n" +
|
|
327 |
+ "Dependency chain: {}")
|
|
328 |
+ .format(element.name, " -> ".join(chain)))
|
|
320 | 329 |
|
321 | 330 |
# Push / Check each dependency / Pop
|
322 | 331 |
check_elements[element_name] = True
|
332 |
+ sequence.append(element_name)
|
|
323 | 333 |
for dep in element.deps:
|
324 | 334 |
loader = self._get_loader_for_dep(dep)
|
325 |
- loader._check_circular_deps(dep.name, check_elements, validated)
|
|
335 |
+ loader._check_circular_deps(dep.name, check_elements, validated, sequence)
|
|
326 | 336 |
del check_elements[element_name]
|
337 |
+ sequence.pop()
|
|
327 | 338 |
|
328 | 339 |
# Eliminate duplicate paths
|
329 | 340 |
validated[element_name] = True
|
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 |
# Tristan Van Berkom <tristan vanberkom codethink co uk>
|
19 | 19 |
#
|
20 | 20 |
|
21 |
-from collections import Mapping
|
|
21 |
+from collections.abc import Mapping
|
|
22 | 22 |
import jinja2
|
23 | 23 |
|
24 | 24 |
from .. import _yaml
|
... | ... | @@ -19,7 +19,8 @@ |
19 | 19 |
# Tiago Gomes <tiago gomes codethink co uk>
|
20 | 20 |
|
21 | 21 |
import os
|
22 |
-from collections import Mapping, OrderedDict
|
|
22 |
+from collections import OrderedDict
|
|
23 |
+from collections.abc import Mapping
|
|
23 | 24 |
from pluginbase import PluginBase
|
24 | 25 |
from . import utils
|
25 | 26 |
from . import _cachekey
|
... | ... | @@ -208,7 +208,7 @@ class Queue(): |
208 | 208 |
# This will have different results for elements depending
|
209 | 209 |
# on the Queue.status() implementation.
|
210 | 210 |
#
|
211 |
- # o Elements which are QueueStatus.WAIT will not be effected
|
|
211 |
+ # o Elements which are QueueStatus.WAIT will not be affected
|
|
212 | 212 |
#
|
213 | 213 |
# o Elements which are QueueStatus.SKIP will move directly
|
214 | 214 |
# to the dequeue pool
|
... | ... | @@ -972,7 +972,7 @@ def node_validate(node, valid_keys): |
972 | 972 |
#
|
973 | 973 |
# The purpose of this is to create a virtual copy-on-write
|
974 | 974 |
# copy of a dictionary, so that mutating it in any way does
|
975 |
-# not effect the underlying dictionaries.
|
|
975 |
+# not affect the underlying dictionaries.
|
|
976 | 976 |
#
|
977 | 977 |
# collections.ChainMap covers this already mostly, but fails
|
978 | 978 |
# to record internal state so as to hide keys which have been
|
... | ... | @@ -176,7 +176,7 @@ class BuildElement(Element): |
176 | 176 |
|
177 | 177 |
# Specifying notparallel for a given element effects the
|
178 | 178 |
# cache key, while having the side effect of setting max-jobs to 1,
|
179 |
- # which is normally automatically resolved and does not effect
|
|
179 |
+ # which is normally automatically resolved and does not affect
|
|
180 | 180 |
# the cache key.
|
181 | 181 |
if self.get_variable('notparallel'):
|
182 | 182 |
dictionary['notparallel'] = True
|
... | ... | @@ -76,7 +76,8 @@ import os |
76 | 76 |
import re
|
77 | 77 |
import stat
|
78 | 78 |
import copy
|
79 |
-from collections import Mapping, OrderedDict
|
|
79 |
+from collections import OrderedDict
|
|
80 |
+from collections.abc import Mapping
|
|
80 | 81 |
from contextlib import contextmanager
|
81 | 82 |
import tempfile
|
82 | 83 |
import shutil
|
... | ... | @@ -266,7 +266,7 @@ class Plugin(): |
266 | 266 |
such as an sha256 sum of a tarball content.
|
267 | 267 |
|
268 | 268 |
Elements and Sources should implement this by collecting any configurations
|
269 |
- which could possibly effect the output and return a dictionary of these settings.
|
|
269 |
+ which could possibly affect the output and return a dictionary of these settings.
|
|
270 | 270 |
|
271 | 271 |
For Sources, this is guaranteed to only be called if
|
272 | 272 |
:func:`Source.get_consistency() <buildstream.source.Source.get_consistency>`
|
... | ... | @@ -123,7 +123,7 @@ environment: |
123 | 123 |
V: 1
|
124 | 124 |
|
125 | 125 |
# And dont consider MAKEFLAGS or V as something which may
|
126 |
-# effect build output.
|
|
126 |
+# affect build output.
|
|
127 | 127 |
environment-nocache:
|
128 | 128 |
- MAKEFLAGS
|
129 | 129 |
- V
|
... | ... | @@ -66,7 +66,7 @@ environment: |
66 | 66 |
V: 1
|
67 | 67 |
|
68 | 68 |
# And dont consider JOBS or V as something which may
|
69 |
-# effect build output.
|
|
69 |
+# affect build output.
|
|
70 | 70 |
environment-nocache:
|
71 | 71 |
- JOBS
|
72 | 72 |
- V
|
... | ... | @@ -124,7 +124,7 @@ the user to resolve possibly conflicting nested junctions by creating a junction |
124 | 124 |
with the same name in the top-level project, which then takes precedence.
|
125 | 125 |
"""
|
126 | 126 |
|
127 |
-from collections import Mapping
|
|
127 |
+from collections.abc import Mapping
|
|
128 | 128 |
from buildstream import Element
|
129 | 129 |
from buildstream._pipeline import PipelineError
|
130 | 130 |
|
... | ... | @@ -36,7 +36,7 @@ environment: |
36 | 36 |
V: 1
|
37 | 37 |
|
38 | 38 |
# And dont consider MAKEFLAGS or V as something which may
|
39 |
-# effect build output.
|
|
39 |
+# affect build output.
|
|
40 | 40 |
environment-nocache:
|
41 | 41 |
- MAKEFLAGS
|
42 | 42 |
- V
|
... | ... | @@ -35,7 +35,7 @@ environment: |
35 | 35 |
V: 1
|
36 | 36 |
|
37 | 37 |
# And dont consider MAKEFLAGS or V as something which may
|
38 |
-# effect build output.
|
|
38 |
+# affect build output.
|
|
39 | 39 |
environment-nocache:
|
40 | 40 |
- MAKEFLAGS
|
41 | 41 |
- V
|
... | ... | @@ -74,6 +74,6 @@ environment: |
74 | 74 |
%{max-jobs}
|
75 | 75 |
|
76 | 76 |
# And dont consider NINJAJOBS as something which may
|
77 |
-# effect build output.
|
|
77 |
+# affect build output.
|
|
78 | 78 |
environment-nocache:
|
79 | 79 |
- NINJAJOBS
|
... | ... | @@ -44,7 +44,7 @@ environment: |
44 | 44 |
V: 1
|
45 | 45 |
|
46 | 46 |
# And dont consider MAKEFLAGS or V as something which may
|
47 |
-# effect build output.
|
|
47 |
+# affect build output.
|
|
48 | 48 |
environment-nocache:
|
49 | 49 |
- MAKEFLAGS
|
50 | 50 |
- V
|
... | ... | @@ -89,7 +89,7 @@ import os |
89 | 89 |
import errno
|
90 | 90 |
import re
|
91 | 91 |
import shutil
|
92 |
-from collections import Mapping
|
|
92 |
+from collections.abc import Mapping
|
|
93 | 93 |
from io import StringIO
|
94 | 94 |
|
95 | 95 |
from configparser import RawConfigParser
|
... | ... | @@ -415,7 +415,7 @@ class GitSource(Source): |
415 | 415 |
def get_unique_key(self):
|
416 | 416 |
# Here we want to encode the local name of the repository and
|
417 | 417 |
# the ref, if the user changes the alias to fetch the same sources
|
418 |
- # from another location, it should not effect the cache key.
|
|
418 |
+ # from another location, it should not affect the cache key.
|
|
419 | 419 |
key = [self.original_url, self.mirror.ref]
|
420 | 420 |
|
421 | 421 |
# Only modify the cache key with checkout_submodules if it's something
|
... | ... | @@ -155,7 +155,7 @@ Class Reference |
155 | 155 |
"""
|
156 | 156 |
|
157 | 157 |
import os
|
158 |
-from collections import Mapping
|
|
158 |
+from collections.abc import Mapping
|
|
159 | 159 |
from contextlib import contextmanager
|
160 | 160 |
|
161 | 161 |
from . import Plugin, Consistency
|
... | ... | @@ -110,6 +110,7 @@ def test_circular_dependency(datafiles): |
110 | 110 |
element = loader.load(['elements/circulartarget.bst'])[0]
|
111 | 111 |
|
112 | 112 |
assert (exc.value.reason == LoadErrorReason.CIRCULAR_DEPENDENCY)
|
113 |
+ assert ("seconddep" in exc.value.args[0])
|
|
113 | 114 |
|
114 | 115 |
|
115 | 116 |
@pytest.mark.datafiles(DATA_DIR)
|
1 | 1 |
import os
|
2 | 2 |
import pytest
|
3 | 3 |
import tempfile
|
4 |
-from collections import Mapping
|
|
4 |
+from collections.abc import Mapping
|
|
5 | 5 |
|
6 | 6 |
from buildstream import _yaml
|
7 | 7 |
from buildstream._exceptions import LoadError, LoadErrorReason
|