diff options
authorPeter Kjellerstedt <>2017-08-29 22:33:01 +0200
committerMartin Jansa <>2020-09-11 13:56:08 +0200
commit2169659d502faf2eef2ba3284a7656543d5497ae (patch)
parentb4860b292406698f3c8af9a3708a09df21c96300 (diff)
fetch2: Allow to warn instead of errorjansa/1.42
Under some situations it can be allowed for to fail to fetch a file without causing bitbake to fail. By adding only_warn=True as argument to, it will call logger.warning() instead of logger.error() and thus not cause build failures. Signed-off-by: Peter Kjellerstedt <> Signed-off-by: Martin Jansa <>
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/bb/fetch2/ b/lib/bb/fetch2/
index 2ada43befc..ac7986b43d 100644
--- a/lib/bb/fetch2/
+++ b/lib/bb/fetch2/
@@ -1629,9 +1629,10 @@ class Fetch(object):
return local
- def download(self, urls=None):
+ def download(self, urls=None, only_warn=False):
- Fetch all urls
+ Fetch all urls. In case only_warn is True, a failure to fetch a url
+ will only result in a warning message, rather than an error message.
if not urls:
urls = self.urls
@@ -1709,19 +1710,28 @@ class Fetch(object):
if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
if firsterr:
- logger.error(str(firsterr))
+ if only_warn:
+ logger.warning(str(firsterr))
+ else:
+ logger.error(str(firsterr))
raise FetchError("Unable to fetch URL from any source.", u)
update_stamp(ud, self.d)
except IOError as e:
if e.errno in [errno.ESTALE]:
- logger.error("Stale Error Observed %s." % u)
+ if only_warn:
+ logger.warning("Stale Error Observed %s." % u)
+ else:
+ logger.error("Stale Error Observed %s." % u)
raise ChecksumError("Stale Error Detected")
except BBFetchException as e:
if isinstance(e, ChecksumError):
- logger.error("Checksum failure fetching %s" % u)
+ if only_warn:
+ logger.warning("Checksum failure fetching %s" % u)
+ else:
+ logger.error("Checksum failure fetching %s" % u)