summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com>2020-01-24 18:08:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-27 16:48:10 +0000
commit4d771e269956fafae95561ab780c1fcff9c54245 (patch)
treeecf28af6682d3f957bfca2266a52a68b6e26a410 /bitbake
parentfb69936b63484ea5934b2af6e643488ff6714f4e (diff)
downloadpoky-4d771e269956fafae95561ab780c1fcff9c54245.tar.gz
bitbake: fetch2: allow fetchers to forward the mirrors management
This commit is necessary to introduce proxy fetchers and do not modify the behavior of existing fetchers. This commit allows fetchers to forwards the "try_mirrors" functions to a proxy fetcher. (Bitbake rev: 462c9a2b368a1720da276310b1d5d0423b7cefea) Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index b3b92e5c61..9a0e396fde 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1565,6 +1565,12 @@ class FetchMethod(object):
1565 """ 1565 """
1566 return True 1566 return True
1567 1567
1568 def try_mirrors(self, fetch, urldata, d, mirrors, check=False):
1569 """
1570 Try to use a mirror
1571 """
1572 return try_mirrors(fetch, d, urldata, mirrors, check)
1573
1568 def checkstatus(self, fetch, urldata, d): 1574 def checkstatus(self, fetch, urldata, d):
1569 """ 1575 """
1570 Check the status of a URL 1576 Check the status of a URL
@@ -1679,7 +1685,7 @@ class Fetch(object):
1679 elif m.try_premirror(ud, self.d): 1685 elif m.try_premirror(ud, self.d):
1680 logger.debug(1, "Trying PREMIRRORS") 1686 logger.debug(1, "Trying PREMIRRORS")
1681 mirrors = mirror_from_string(self.d.getVar('PREMIRRORS')) 1687 mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
1682 localpath = try_mirrors(self, self.d, ud, mirrors, False) 1688 localpath = m.try_mirrors(self, ud, self.d, mirrors)
1683 if localpath: 1689 if localpath:
1684 try: 1690 try:
1685 # early checksum verification so that if the checksum of the premirror 1691 # early checksum verification so that if the checksum of the premirror
@@ -1728,7 +1734,7 @@ class Fetch(object):
1728 m.clean(ud, self.d) 1734 m.clean(ud, self.d)
1729 logger.debug(1, "Trying MIRRORS") 1735 logger.debug(1, "Trying MIRRORS")
1730 mirrors = mirror_from_string(self.d.getVar('MIRRORS')) 1736 mirrors = mirror_from_string(self.d.getVar('MIRRORS'))
1731 localpath = try_mirrors(self, self.d, ud, mirrors) 1737 localpath = m.try_mirrors(self, ud, self.d, mirrors)
1732 1738
1733 if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1): 1739 if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
1734 if firsterr: 1740 if firsterr:
@@ -1766,14 +1772,14 @@ class Fetch(object):
1766 logger.debug(1, "Testing URL %s", u) 1772 logger.debug(1, "Testing URL %s", u)
1767 # First try checking uri, u, from PREMIRRORS 1773 # First try checking uri, u, from PREMIRRORS
1768 mirrors = mirror_from_string(self.d.getVar('PREMIRRORS')) 1774 mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
1769 ret = try_mirrors(self, self.d, ud, mirrors, True) 1775 ret = m.try_mirrors(self, ud, self.d, mirrors, True)
1770 if not ret: 1776 if not ret:
1771 # Next try checking from the original uri, u 1777 # Next try checking from the original uri, u
1772 ret = m.checkstatus(self, ud, self.d) 1778 ret = m.checkstatus(self, ud, self.d)
1773 if not ret: 1779 if not ret:
1774 # Finally, try checking uri, u, from MIRRORS 1780 # Finally, try checking uri, u, from MIRRORS
1775 mirrors = mirror_from_string(self.d.getVar('MIRRORS')) 1781 mirrors = mirror_from_string(self.d.getVar('MIRRORS'))
1776 ret = try_mirrors(self, self.d, ud, mirrors, True) 1782 ret = m.try_mirrors(self, ud, self.d, mirrors, True)
1777 1783
1778 if not ret: 1784 if not ret:
1779 raise FetchError("URL %s doesn't work" % u, u) 1785 raise FetchError("URL %s doesn't work" % u, u)