... |
... |
@@ -372,19 +372,6 @@ class Source(Plugin): |
372
|
372
|
"""
|
373
|
373
|
self.stage(directory)
|
374
|
374
|
|
375
|
|
- def mark_download_url(self, url):
|
376
|
|
- """Identifies the URL that this Source uses to download
|
377
|
|
-
|
378
|
|
- This must be called during :func:`~buildstream.plugin.Plugin.configure` if
|
379
|
|
- :func:`~buildstream.source.Source.translate_url` is not called.
|
380
|
|
-
|
381
|
|
- Args:
|
382
|
|
- url (str): The url used to download
|
383
|
|
-
|
384
|
|
- *Since: 1.2*
|
385
|
|
- """
|
386
|
|
- self.__expected_alias = _extract_alias(url)
|
387
|
|
-
|
388
|
375
|
def get_source_fetchers(self):
|
389
|
376
|
"""Get the objects that are used for fetching
|
390
|
377
|
|
... |
... |
@@ -453,6 +440,19 @@ class Source(Plugin): |
453
|
440
|
project = self._get_project()
|
454
|
441
|
return project.translate_url(url, first_pass=self.__first_pass)
|
455
|
442
|
|
|
443
|
+ def mark_download_url(self, url):
|
|
444
|
+ """Identifies the URL that this Source uses to download
|
|
445
|
+
|
|
446
|
+ This must be called during :func:`~buildstream.plugin.Plugin.configure` if
|
|
447
|
+ :func:`~buildstream.source.Source.translate_url` is not called.
|
|
448
|
+
|
|
449
|
+ Args:
|
|
450
|
+ url (str): The url used to download
|
|
451
|
+
|
|
452
|
+ *Since: 1.2*
|
|
453
|
+ """
|
|
454
|
+ self.__expected_alias = _extract_alias(url)
|
|
455
|
+
|
456
|
456
|
def get_project_directory(self):
|
457
|
457
|
"""Fetch the project base directory
|
458
|
458
|
|
... |
... |
@@ -517,10 +517,12 @@ class Source(Plugin): |
517
|
517
|
def _fetch(self):
|
518
|
518
|
project = self._get_project()
|
519
|
519
|
source_fetchers = self.get_source_fetchers()
|
|
520
|
+
|
|
521
|
+ # Use the source fetchers if they are provided
|
|
522
|
+ #
|
520
|
523
|
if source_fetchers:
|
521
|
524
|
for fetcher in source_fetchers:
|
522
|
525
|
alias = fetcher._get_alias()
|
523
|
|
- success = False
|
524
|
526
|
for uri in project.get_alias_uris(alias, first_pass=self.__first_pass):
|
525
|
527
|
try:
|
526
|
528
|
fetcher.fetch(uri)
|
... |
... |
@@ -529,10 +531,16 @@ class Source(Plugin): |
529
|
531
|
except BstError as e:
|
530
|
532
|
last_error = e
|
531
|
533
|
continue
|
532
|
|
- success = True
|
|
534
|
+
|
|
535
|
+ # No error, we're done with this fetcher
|
533
|
536
|
break
|
534
|
|
- if not success:
|
|
537
|
+
|
|
538
|
+ else:
|
|
539
|
+ # No break occurred, raise the last detected error
|
535
|
540
|
raise last_error
|
|
541
|
+
|
|
542
|
+ # Default codepath is to reinstantiate the Source
|
|
543
|
+ #
|
536
|
544
|
else:
|
537
|
545
|
alias = self._get_alias()
|
538
|
546
|
if self.__first_pass:
|
... |
... |
@@ -556,7 +564,11 @@ class Source(Plugin): |
556
|
564
|
except BstError as e:
|
557
|
565
|
last_error = e
|
558
|
566
|
continue
|
|
567
|
+
|
|
568
|
+ # No error, we're done here
|
559
|
569
|
return
|
|
570
|
+
|
|
571
|
+ # Re raise the last detected error
|
560
|
572
|
raise last_error
|
561
|
573
|
|
562
|
574
|
# Wrapper for stage() api which gives the source
|