diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-08-28 16:12:45 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-10-30 13:15:48 +0000 |
commit | 2c0d7a614de63eacda257fbfc8898bcdb2a79492 (patch) | |
tree | c37337efc98b25f674503136222ee72192345242 /buildstream/plugins/sources/tar.py | |
parent | 7f8d0b9cac97b830b718b00ed3db9096c06d525c (diff) | |
download | buildstream-jonathan/expose-downloadablefilesource.tar.gz |
Make DownloadableFileSource clearly define public and private fieldsjonathan/expose-downloadablefilesource
TarSource and RemoteSource now parse url from the config themselves,
because they need it, but the url is private.
Diffstat (limited to 'buildstream/plugins/sources/tar.py')
-rw-r--r-- | buildstream/plugins/sources/tar.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/buildstream/plugins/sources/tar.py b/buildstream/plugins/sources/tar.py index 75219dc89..667b28379 100644 --- a/buildstream/plugins/sources/tar.py +++ b/buildstream/plugins/sources/tar.py @@ -71,6 +71,10 @@ class TarSource(DownloadableFileSource): def configure(self, node): super().configure(node) + # url in DownloadableFileSource is private, so we read it again + original_url = self.node_get_member(node, str, 'url') + self.url = self.translate_url(original_url) + self.base_dir = self.node_get_member(node, str, 'base-dir', '*') or None self.node_validate(node, DownloadableFileSource.COMMON_CONFIG_KEYS + ['base-dir']) @@ -87,7 +91,7 @@ class TarSource(DownloadableFileSource): def _run_lzip(self): assert self.host_lzip with TemporaryFile() as lzip_stdout: - with open(self._get_mirror_file(), 'r') as lzip_file: + with open(self.get_mirror_file(), 'r') as lzip_file: self.call([self.host_lzip, '-d'], stdin=lzip_file, stdout=lzip_stdout) @@ -102,7 +106,7 @@ class TarSource(DownloadableFileSource): with tarfile.open(fileobj=lzip_dec, mode='r:') as tar: yield tar else: - with tarfile.open(self._get_mirror_file()) as tar: + with tarfile.open(self.get_mirror_file()) as tar: yield tar def stage(self, directory): |