You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:27:41 UTC

[buildstream] branch pedro/backport-721-into-bst1-2 created (now 49569cf)

This is an automated email from the ASF dual-hosted git repository.

root pushed a change to branch pedro/backport-721-into-bst1-2
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 49569cf  element.py: Expect absolute paths in overlap whitelists

This branch includes the following new commits:

     new 49569cf  element.py: Expect absolute paths in overlap whitelists

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/01: element.py: Expect absolute paths in overlap whitelists

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch pedro/backport-721-into-bst1-2
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 49569cf85f6e3eba4096c11743ec0a289e53982c
Author: Pedro Alvarez <pe...@codethink.co.uk>
AuthorDate: Wed Sep 4 09:49:35 2019 +0100

    element.py: Expect absolute paths in overlap whitelists
    
    This allows use of variables such as %{prefix} and matches the
    documentation.
    
    Backport of: 1ae1796854055f4b9e3202d9629e059b327f3a8d
---
 buildstream/element.py                    | 5 +++--
 tests/frontend/overlaps/c-whitelisted.bst | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/buildstream/element.py b/buildstream/element.py
index 703f062..257d5f3 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 c71ef31..47154b2 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*"