summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 09:17:43 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 09:17:43 +0000
commit3086eda561f7a17ebc9aad1fb70fe0c0fd83d8f0 (patch)
tree45257e2956b396b8bba474eb1e8ef7e5b07f036c
parent0e26667e7b8f4e3ba40c4b9364d57609b397b2a6 (diff)
parent813fcd60915a894ee9d8ced15ed282b7f763aaaa (diff)
downloadbuildstream-3086eda561f7a17ebc9aad1fb70fe0c0fd83d8f0.tar.gz
Merge branch 'tristan/source-mirroring-changes-1.2' into 'bst-1.2'
Minor code changes revolving around source mirroring See merge request BuildStream/buildstream!759
-rw-r--r--buildstream/plugins/sources/git.py4
-rw-r--r--buildstream/source.py44
2 files changed, 31 insertions, 17 deletions
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index 56bf40e00..354f80b5d 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -368,8 +368,10 @@ class GitSource(Source):
if not self.tracking:
return None
+ # Resolve the URL for the message
+ resolved_url = self.translate_url(self.mirror.url)
with self.timed_activity("Tracking {} from {}"
- .format(self.tracking, self.mirror.url),
+ .format(self.tracking, resolved_url),
silent_nested=True):
self.mirror.ensure()
self.mirror._fetch()
diff --git a/buildstream/source.py b/buildstream/source.py
index 79d9e014f..8caca4a91 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -372,19 +372,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
@@ -453,6 +440,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
@@ -517,10 +517,12 @@ class Source(Plugin):
def _fetch(self):
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)
@@ -529,10 +531,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:
@@ -556,7 +564,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
# Wrapper for stage() api which gives the source