summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2019-09-04 09:49:35 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2019-09-04 09:49:35 +0100
commit49569cf85f6e3eba4096c11743ec0a289e53982c (patch)
tree24ff40d6ba006cff65cf060257aadaea3c88bc5c
parent2ece1287f75c3a1eaf4bd1a9f4f9c7b895fe3993 (diff)
downloadbuildstream-pedro/backport-721-into-bst1-2.tar.gz
element.py: Expect absolute paths in overlap whitelistspedro/backport-721-into-bst1-2
This allows use of variables such as %{prefix} and matches the documentation. Backport of: 1ae1796854055f4b9e3202d9629e059b327f3a8d
-rw-r--r--buildstream/element.py5
-rw-r--r--tests/frontend/overlaps/c-whitelisted.bst2
2 files changed, 4 insertions, 3 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 703f062da..257d5f335 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -2362,7 +2362,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
@@ -2374,7 +2374,8 @@ 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)) or
+ self.__whitelist_regex.match(os.path.join(path)))
# __extract():
#
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*"