diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-07-08 20:18:20 +0000 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2020-07-08 20:55:42 +0000 |
commit | df201d0c6b4e1838ce34fcf78382098e7c557132 (patch) | |
tree | cbfb43ed7b04a6cad4b941cd3f0b54e93920da25 | |
parent | 99d827faad1d38e85532e056561a967636cfc4b5 (diff) | |
download | buildstream-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
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/buildstream/plugins/sources/tar.py | 11 |
2 files changed, 13 insertions, 2 deletions
@@ -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 |