summaryrefslogtreecommitdiff
path: root/src/buildstream/plugins
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2020-07-08 20:18:20 +0000
committerBenjamin Schubert <contact@benschubert.me>2020-07-08 20:55:42 +0000
commitdf201d0c6b4e1838ce34fcf78382098e7c557132 (patch)
treecbfb43ed7b04a6cad4b941cd3f0b54e93920da25 /src/buildstream/plugins
parent99d827faad1d38e85532e056561a967636cfc4b5 (diff)
downloadbuildstream-df201d0c6b4e1838ce34fcf78382098e7c557132.tar.gz
tar.py: Don't import 'dev' nodesbschubert/tar-filter-nondev
This filters out all the 'dev' nodes when extracting tar files since they are not supported by any of our backends anyways
Diffstat (limited to 'src/buildstream/plugins')
-rw-r--r--src/buildstream/plugins/sources/tar.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py
index aba927b99..f9df802a7 100644
--- a/src/buildstream/plugins/sources/tar.py
+++ b/src/buildstream/plugins/sources/tar.py
@@ -133,10 +133,17 @@ class TarSource(DownloadableFileSource):
if self.base_dir:
base_dir = self._find_base_dir(tar, self.base_dir)
+ def filter_non_dev(tarfiles):
+ for file in tarfiles:
+ if not file.isdev():
+ yield file
+
if base_dir:
- tar.extractall(path=directory, members=self._extract_members(tar, base_dir, directory))
+ tar.extractall(
+ path=directory, members=filter_non_dev(self._extract_members(tar, base_dir, directory))
+ )
else:
- tar.extractall(path=directory)
+ tar.extractall(path=directory, members=filter_non_dev(tar.getmembers()))
except (tarfile.TarError, OSError) as e:
raise SourceError("{}: Error staging source: {}".format(self, e)) from e