aboutsummaryrefslogtreecommitdiffstats
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-11-03 15:27:20 +0100
commit9a2d996efa18395cedfea8e92d5364aab5a7473f (patch)
tree6033fa0fb55e3a98430651165aff3efc826c0475
parent7150c8286fba6c4b5ab03d3a74f06e068c9c28c8 (diff)
downloadbitbake-contrib-jansa/1.44.tar.gz
fetch2: Allow Fetch.download() to warn instead of errorjansa/1.44
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 4a781bde2..736c7b61b 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1626,9 +1626,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
@@ -1706,19 +1707,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)
raise
finally: