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/remote.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/remote.py')
-rw-r--r-- | buildstream/plugins/sources/remote.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/buildstream/plugins/sources/remote.py b/buildstream/plugins/sources/remote.py index c296d3158..fbfff9056 100644 --- a/buildstream/plugins/sources/remote.py +++ b/buildstream/plugins/sources/remote.py @@ -61,7 +61,13 @@ class RemoteSource(DownloadableFileSource): def configure(self, node): super().configure(node) - self.filename = self.node_get_member(node, str, 'filename', os.path.basename(self.url)) + self.filename = self.node_get_member(node, str, 'filename', None) + if not self.filename: + # url in DownloadableFileSource is private, so we read it again + original_url = self.node_get_member(node, str, 'url') + url = self.translate_url(original_url) + self.filename = os.path.basename(url) + self.executable = self.node_get_member(node, bool, 'executable', False) if os.sep in self.filename: @@ -78,7 +84,7 @@ class RemoteSource(DownloadableFileSource): dest = os.path.join(directory, self.filename) with self.timed_activity("Staging remote file to {}".format(dest)): - utils.safe_copy(self._get_mirror_file(), dest) + utils.safe_copy(self.get_mirror_file(), dest) # To prevent user's umask introducing variability here, explicitly set # file modes. |