diff options
author | Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> | 2020-01-24 18:08:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-27 16:48:10 +0000 |
commit | fb69936b63484ea5934b2af6e643488ff6714f4e (patch) | |
tree | 500ed893539015c8093618f6f040686474555834 /bitbake/lib | |
parent | 73912553c73017b63dd59efdc44698f2a5514490 (diff) | |
download | poky-fb69936b63484ea5934b2af6e643488ff6714f4e.tar.gz |
bitbake: fetch2: allow fetchers to forward the donestamp 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 "verify_donestamp" and
"update_stamp" functions to a proxy fetcher.
(Bitbake rev: f7612c0704b4252bba5157ce9a94d8888c6d0760)
Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 28ded462df..b3b92e5c61 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -1379,6 +1379,18 @@ class FetchMethod(object): | |||
1379 | """ | 1379 | """ |
1380 | return False | 1380 | return False |
1381 | 1381 | ||
1382 | def verify_donestamp(self, ud, d): | ||
1383 | """ | ||
1384 | Verify the donestamp file | ||
1385 | """ | ||
1386 | return verify_donestamp(ud, d) | ||
1387 | |||
1388 | def update_donestamp(self, ud, d): | ||
1389 | """ | ||
1390 | Update the donestamp file | ||
1391 | """ | ||
1392 | update_stamp(ud, d) | ||
1393 | |||
1382 | def _strip_leading_slashes(self, relpath): | 1394 | def _strip_leading_slashes(self, relpath): |
1383 | """ | 1395 | """ |
1384 | Remove leading slash as os.path.join can't cope | 1396 | Remove leading slash as os.path.join can't cope |
@@ -1662,7 +1674,7 @@ class Fetch(object): | |||
1662 | try: | 1674 | try: |
1663 | self.d.setVar("BB_NO_NETWORK", network) | 1675 | self.d.setVar("BB_NO_NETWORK", network) |
1664 | 1676 | ||
1665 | if verify_donestamp(ud, self.d) and not m.need_update(ud, self.d): | 1677 | if m.verify_donestamp(ud, self.d) and not m.need_update(ud, self.d): |
1666 | localpath = ud.localpath | 1678 | localpath = ud.localpath |
1667 | elif m.try_premirror(ud, self.d): | 1679 | elif m.try_premirror(ud, self.d): |
1668 | logger.debug(1, "Trying PREMIRRORS") | 1680 | logger.debug(1, "Trying PREMIRRORS") |
@@ -1672,7 +1684,7 @@ class Fetch(object): | |||
1672 | try: | 1684 | try: |
1673 | # early checksum verification so that if the checksum of the premirror | 1685 | # early checksum verification so that if the checksum of the premirror |
1674 | # contents mismatch the fetcher can still try upstream and mirrors | 1686 | # contents mismatch the fetcher can still try upstream and mirrors |
1675 | update_stamp(ud, self.d) | 1687 | m.update_donestamp(ud, self.d) |
1676 | except ChecksumError as e: | 1688 | except ChecksumError as e: |
1677 | logger.warning("Checksum failure encountered with premirror download of %s - will attempt other sources." % u) | 1689 | logger.warning("Checksum failure encountered with premirror download of %s - will attempt other sources." % u) |
1678 | logger.debug(1, str(e)) | 1690 | logger.debug(1, str(e)) |
@@ -1682,7 +1694,7 @@ class Fetch(object): | |||
1682 | self.d.setVar("BB_NO_NETWORK", "1") | 1694 | self.d.setVar("BB_NO_NETWORK", "1") |
1683 | 1695 | ||
1684 | firsterr = None | 1696 | firsterr = None |
1685 | verified_stamp = verify_donestamp(ud, self.d) | 1697 | verified_stamp = m.verify_donestamp(ud, self.d) |
1686 | if not localpath and (not verified_stamp or m.need_update(ud, self.d)): | 1698 | if not localpath and (not verified_stamp or m.need_update(ud, self.d)): |
1687 | try: | 1699 | try: |
1688 | if not trusted_network(self.d, ud.url): | 1700 | if not trusted_network(self.d, ud.url): |
@@ -1694,7 +1706,7 @@ class Fetch(object): | |||
1694 | localpath = ud.localpath | 1706 | localpath = ud.localpath |
1695 | # early checksum verify, so that if checksum mismatched, | 1707 | # early checksum verify, so that if checksum mismatched, |
1696 | # fetcher still have chance to fetch from mirror | 1708 | # fetcher still have chance to fetch from mirror |
1697 | update_stamp(ud, self.d) | 1709 | m.update_donestamp(ud, self.d) |
1698 | 1710 | ||
1699 | except bb.fetch2.NetworkAccess: | 1711 | except bb.fetch2.NetworkAccess: |
1700 | raise | 1712 | raise |
@@ -1723,7 +1735,7 @@ class Fetch(object): | |||
1723 | logger.error(str(firsterr)) | 1735 | logger.error(str(firsterr)) |
1724 | raise FetchError("Unable to fetch URL from any source.", u) | 1736 | raise FetchError("Unable to fetch URL from any source.", u) |
1725 | 1737 | ||
1726 | update_stamp(ud, self.d) | 1738 | m.update_donestamp(ud, self.d) |
1727 | 1739 | ||
1728 | except IOError as e: | 1740 | except IOError as e: |
1729 | if e.errno in [errno.ESTALE]: | 1741 | if e.errno in [errno.ESTALE]: |