diff options
Diffstat (limited to 'buildstream/source.py')
-rw-r--r-- | buildstream/source.py | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/buildstream/source.py b/buildstream/source.py index a9ae090a5..b86f3fb16 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -445,19 +445,6 @@ class Source(Plugin): """ self.stage(directory) - def mark_download_url(self, url): - """Identifies the URL that this Source uses to download - - This must be called during :func:`~buildstream.plugin.Plugin.configure` if - :func:`~buildstream.source.Source.translate_url` is not called. - - Args: - url (str): The url used to download - - *Since: 1.2* - """ - self.__expected_alias = _extract_alias(url) - def get_source_fetchers(self): """Get the objects that are used for fetching @@ -526,6 +513,19 @@ class Source(Plugin): project = self._get_project() return project.translate_url(url, first_pass=self.__first_pass) + def mark_download_url(self, url): + """Identifies the URL that this Source uses to download + + This must be called during :func:`~buildstream.plugin.Plugin.configure` if + :func:`~buildstream.source.Source.translate_url` is not called. + + Args: + url (str): The url used to download + + *Since: 1.2* + """ + self.__expected_alias = _extract_alias(url) + def get_project_directory(self): """Fetch the project base directory @@ -865,10 +865,12 @@ class Source(Plugin): def __do_fetch(self, **kwargs): project = self._get_project() source_fetchers = self.get_source_fetchers() + + # Use the source fetchers if they are provided + # if source_fetchers: for fetcher in source_fetchers: alias = fetcher._get_alias() - success = False for uri in project.get_alias_uris(alias, first_pass=self.__first_pass): try: fetcher.fetch(uri) @@ -877,10 +879,16 @@ class Source(Plugin): except BstError as e: last_error = e continue - success = True + + # No error, we're done with this fetcher break - if not success: + + else: + # No break occurred, raise the last detected error raise last_error + + # Default codepath is to reinstantiate the Source + # else: alias = self._get_alias() if self.__first_pass: @@ -904,7 +912,11 @@ class Source(Plugin): except BstError as e: last_error = e continue + + # No error, we're done here return + + # Re raise the last detected error raise last_error # Tries to call track for every mirror, stopping once it succeeds |