summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2017-08-29 22:33:01 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2021-05-06 12:46:16 +0200
commit60d2e1e7b090ffa55cff3995c13e28c8083fd5fe (patch)
tree12fae1756d94fa34ad137ef93c98fb61ee8a53ff
parente05d79a6ed92c9ce17b90fd5fb6186898a7b3bf8 (diff)
downloadbitbake-contrib-jansa/1.48.tar.gz
bitbake-contrib-jansa/1.48.tar.bz2
bitbake-contrib-jansa/1.48.zip
fetch2: Allow Fetch.download() to warn instead of errorjansa/1.48
Under some situations it can be allowed for Fetch.download() to fail to fetch a file without causing bitbake to fail. By adding only_warn=True as argument to Fetch.download(), it will call logger.warning() instead of logger.error() and thus not cause build failures. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--lib/bb/fetch2/__init__.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 524165bd5f..1675c53588 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1659,9 +1659,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
@@ -1739,19 +1740,28 @@ class Fetch(object):
if not done or not m.done(ud, self.d):
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)
m.update_donestamp(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)
raise
finally: