summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/buildstream/plugins/sources/tar.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f82483e6e..8c97dc6e0 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ CLI
o Add `bst source push` subcommand. This command pushes element sources to a
remote source cache.
+Plugins
+-------
+
+ o tar: filter out 'dev' nodes from the tar archives when extracting them
==================
buildstream 1.93.4
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