summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-08-03 11:32:29 +0100
committerJosh Smith <qinusty@gmail.com>2018-08-15 12:15:58 +0100
commitf3d58233793cf0249cbac51f72d5c459eb256d44 (patch)
tree1ac54367e79ac7ac3e53f5e66484d05e916b7237 /buildstream/element.py
parent9f675c640d47e844712cb8917018fda163d5e070 (diff)
downloadbuildstream-f3d58233793cf0249cbac51f72d5c459eb256d44.tar.gz
_project.py: Add fatal-warnings configuration item
This allows for users to configure fatal-warnings to be either a list of warnings. This commit deprecates the use of fail-on-overlap within project.conf, this will now use the fatal-warnings configuration item. element.py: Cache key calculation now takes into account all of the fatal-warnings tests: This modifys the tests/frontend/overlaps.py tests to support the new fatal-warnings configuration. Backwards compatibility is also tested for `fail-on-overlap` _versions.py: BST_FORMAT_VERSION bumped to 15 for fatal-warnings BST_CORE_ARTIFACT_VERSION bumpted to 5 for fatal-warnings Fixes: #526
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py26
1 files changed, 8 insertions, 18 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index a099e934b..bb205c777 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -94,6 +94,7 @@ from . import _cachekey
from . import _signals
from . import _site
from ._platform import Platform
+from .plugin import CoreWarnings
from .sandbox._config import SandboxConfig
from .storage.directory import Directory
@@ -746,32 +747,23 @@ class Element(Plugin):
ignored[dep.name] = result.ignored
if overlaps:
- overlap_error = overlap_warning = False
- error_detail = warning_detail = "Staged files overwrite existing files in staging area:\n"
+ overlap_warning = False
+ warning_detail = "Staged files overwrite existing files in staging area:\n"
for f, elements in overlaps.items():
- overlap_error_elements = []
overlap_warning_elements = []
# The bottom item overlaps nothing
overlapping_elements = elements[1:]
for elm in overlapping_elements:
element = self.search(scope, elm)
- element_project = element._get_project()
if not element.__file_is_whitelisted(f):
- if element_project.fail_on_overlap:
- overlap_error_elements.append(elm)
- overlap_error = True
- else:
- overlap_warning_elements.append(elm)
- overlap_warning = True
+ overlap_warning_elements.append(elm)
+ overlap_warning = True
warning_detail += _overlap_error_detail(f, overlap_warning_elements, elements)
- error_detail += _overlap_error_detail(f, overlap_error_elements, elements)
if overlap_warning:
- self.warn("Non-whitelisted overlaps detected", detail=warning_detail)
- if overlap_error:
- raise ElementError("Non-whitelisted overlaps detected and fail-on-overlaps is set",
- detail=error_detail, reason="overlap-error")
+ self.warn("Non-whitelisted overlaps detected", detail=warning_detail,
+ warning_token=CoreWarnings.OVERLAPS)
if ignored:
detail = "Not staging files which would replace non-empty directories:\n"
@@ -2054,9 +2046,7 @@ class Element(Plugin):
'cache': type(self.__artifacts).__name__
}
- # fail-on-overlap setting cannot affect elements without dependencies
- if project.fail_on_overlap and dependencies:
- self.__cache_key_dict['fail-on-overlap'] = True
+ self.__cache_key_dict['fatal-warnings'] = sorted(project._fatal_warnings)
cache_key_dict = self.__cache_key_dict.copy()
cache_key_dict['dependencies'] = dependencies