... |
... |
@@ -219,10 +219,7 @@ class SourceFetcher(): |
219
|
219
|
Args:
|
220
|
220
|
url (str): The url used to download.
|
221
|
221
|
"""
|
222
|
|
- # Not guaranteed to be a valid alias yet.
|
223
|
|
- # Ensuring it's a valid alias currently happens in Project.get_alias_uris
|
224
|
|
- alias, _ = url.split(utils._ALIAS_SEPARATOR, 1)
|
225
|
|
- self.__alias = alias
|
|
222
|
+ self.__alias = _extract_alias(url)
|
226
|
223
|
|
227
|
224
|
#############################################################
|
228
|
225
|
# Private Methods used in BuildStream #
|
... |
... |
@@ -459,8 +456,7 @@ class Source(Plugin): |
459
|
456
|
|
460
|
457
|
*Since: 1.2*
|
461
|
458
|
"""
|
462
|
|
- alias, _ = url.split(utils._ALIAS_SEPARATOR, 1)
|
463
|
|
- self.__expected_alias = alias
|
|
459
|
+ self.__expected_alias = _extract_alias(url)
|
464
|
460
|
|
465
|
461
|
def get_source_fetchers(self):
|
466
|
462
|
"""Get the objects that are used for fetching
|
... |
... |
@@ -525,8 +521,7 @@ class Source(Plugin): |
525
|
521
|
else:
|
526
|
522
|
# Sneakily store the alias if it hasn't already been stored
|
527
|
523
|
if not self.__expected_alias and url and utils._ALIAS_SEPARATOR in url:
|
528
|
|
- url_alias, _ = url.split(utils._ALIAS_SEPARATOR, 1)
|
529
|
|
- self.__expected_alias = url_alias
|
|
524
|
+ self.mark_download_url(url)
|
530
|
525
|
|
531
|
526
|
project = self._get_project()
|
532
|
527
|
return project.translate_url(url, first_pass=self.__first_pass)
|
... |
... |
@@ -914,12 +909,12 @@ class Source(Plugin): |
914
|
909
|
# Tries to call track for every mirror, stopping once it succeeds
|
915
|
910
|
def __do_track(self, **kwargs):
|
916
|
911
|
project = self._get_project()
|
917
|
|
- # If there are no mirrors, or no aliases to replace, there's nothing to do here.
|
918
|
912
|
alias = self._get_alias()
|
919
|
913
|
if self.__first_pass:
|
920
|
914
|
mirrors = project.first_pass_config.mirrors
|
921
|
915
|
else:
|
922
|
916
|
mirrors = project.config.mirrors
|
|
917
|
+ # If there are no mirrors, or no aliases to replace, there's nothing to do here.
|
923
|
918
|
if not mirrors or not alias:
|
924
|
919
|
return self.track(**kwargs)
|
925
|
920
|
|
... |
... |
@@ -988,3 +983,33 @@ class Source(Plugin): |
988
|
983
|
|
989
|
984
|
if src.get_consistency() == Consistency.RESOLVED:
|
990
|
985
|
src._fetch(previous_sources[0:index])
|
|
986
|
+ #
|
|
987
|
+ def __ensure_previous_sources(self, previous_sources):
|
|
988
|
+ for index, src in enumerate(previous_sources):
|
|
989
|
+ # BuildStream should track sources in the order they appear so
|
|
990
|
+ # previous sources should never be in an inconsistent state
|
|
991
|
+ assert src.get_consistency() != Consistency.INCONSISTENT
|
|
992
|
+
|
|
993
|
+ if src.get_consistency() == Consistency.RESOLVED:
|
|
994
|
+ src._fetch(previous_sources[0:index])
|
|
995
|
+ assert src.get_consistency() != Consistency.INCONSISTENT
|
|
996
|
+
|
|
997
|
+ if src.get_consistency() == Consistency.RESOLVED:
|
|
998
|
+ src._fetch(previous_sources[0:index])
|
|
999
|
+ #
|
|
1000
|
+ def __ensure_previous_sources(self, previous_sources):
|
|
1001
|
+ for index, src in enumerate(previous_sources):
|
|
1002
|
+ # BuildStream should track sources in the order they appear so
|
|
1003
|
+ # previous sources should never be in an inconsistent state
|
|
1004
|
+ assert src.get_consistency() != Consistency.INCONSISTENT
|
|
1005
|
+
|
|
1006
|
+ if src.get_consistency() == Consistency.RESOLVED:
|
|
1007
|
+ src._fetch(previous_sources[0:index])
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+def _extract_alias(url):
|
|
1011
|
+ parts = url.split(utils._ALIAS_SEPARATOR, 1)
|
|
1012
|
+ if len(parts) > 1 and not parts[0].lower() in utils._URI_SCHEMES:
|
|
1013
|
+ return parts[0]
|
|
1014
|
+ else:
|
|
1015
|
+ return ""
|