summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-19 10:33:59 +0000
committerJürg Billeter <j@bitron.ch>2019-02-19 10:33:59 +0000
commitafe823e8fa22f1376f6edca6183b3db76fa3535e (patch)
treeefaab1e9d2394d4898cfa216c670fce5de5d6670
parentcfbe409df6eb11b05ee8f0a9d2915ce4cdcd5689 (diff)
parent1ae1796854055f4b9e3202d9629e059b327f3a8d (diff)
downloadbuildstream-afe823e8fa22f1376f6edca6183b3db76fa3535e.tar.gz
Merge branch 'valentindavid/absolute-whitelist' into 'master'
Allow absolute paths in whitelist Closes #721 See merge request BuildStream/buildstream!968
-rw-r--r--NEWS3
-rw-r--r--buildstream/element.py4
-rw-r--r--tests/frontend/overlaps/a-whitelisted.bst2
-rw-r--r--tests/frontend/overlaps/b-whitelisted.bst4
-rw-r--r--tests/frontend/overlaps/c-whitelisted.bst2
5 files changed, 9 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 752434cfe..fe3fda2c3 100644
--- a/NEWS
+++ b/NEWS
@@ -138,6 +138,9 @@ buildstream 1.3.1
o BREAKING CHANGE: Symlinks are no longer resolved during staging and absolute
symlinks are now preserved instead of being converted to relative symlinks.
+ o BREAKING CHANGE: Overlap whitelists now require absolute paths. This allows
+ use of variables such as %{prefix} and matches the documentation.
+
=================
buildstream 1.1.5
diff --git a/buildstream/element.py b/buildstream/element.py
index ac1dec4ac..d5ec5c436 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -2609,7 +2609,7 @@ class Element(Plugin):
if include_file and not exclude_file:
yield filename.lstrip(os.sep)
- def __file_is_whitelisted(self, pattern):
+ def __file_is_whitelisted(self, path):
# Considered storing the whitelist regex for re-use, but public data
# can be altered mid-build.
# Public data is not guaranteed to stay the same for the duration of
@@ -2621,7 +2621,7 @@ class Element(Plugin):
whitelist_expressions = [utils._glob2re(self.__variables.subst(exp.strip())) for exp in whitelist]
expression = ('^(?:' + '|'.join(whitelist_expressions) + ')$')
self.__whitelist_regex = re.compile(expression)
- return self.__whitelist_regex.match(pattern)
+ return self.__whitelist_regex.match(os.path.join(os.sep, path))
# __extract():
#
diff --git a/tests/frontend/overlaps/a-whitelisted.bst b/tests/frontend/overlaps/a-whitelisted.bst
index d995b4161..e3b677ec8 100644
--- a/tests/frontend/overlaps/a-whitelisted.bst
+++ b/tests/frontend/overlaps/a-whitelisted.bst
@@ -10,4 +10,4 @@ sources:
public:
bst:
overlap-whitelist:
- - "file*"
+ - "/file*"
diff --git a/tests/frontend/overlaps/b-whitelisted.bst b/tests/frontend/overlaps/b-whitelisted.bst
index 3dfe931e1..f09736669 100644
--- a/tests/frontend/overlaps/b-whitelisted.bst
+++ b/tests/frontend/overlaps/b-whitelisted.bst
@@ -8,9 +8,9 @@ sources:
- kind: local
path: "b"
variables:
- FILE: file
+ FILE: /file
public:
bst:
overlap-whitelist:
- - file2
+ - /file2
- "%{FILE}3"
diff --git a/tests/frontend/overlaps/c-whitelisted.bst b/tests/frontend/overlaps/c-whitelisted.bst
index c71ef3128..47154b277 100644
--- a/tests/frontend/overlaps/c-whitelisted.bst
+++ b/tests/frontend/overlaps/c-whitelisted.bst
@@ -8,4 +8,4 @@ sources:
public:
bst:
overlap-whitelist:
- - "file*"
+ - "/file*"