From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/2] bitbake: fetch2: Allow Fetch.download() to warn instead of error
Date: Tue, 29 Aug 2017 22:00:29 +0200 [thread overview]
Message-ID: <67d6fbf684b8d011e19a35db0c037170222709fd.1504036763.git.pkj@axis.com> (raw)
In-Reply-To: <cover.1504036763.git.pkj@axis.com>
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>
---
bitbake/lib/bb/fetch2/__init__.py | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 3eb0e4d211..58f65ada84 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1608,9 +1608,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
@@ -1688,19 +1689,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 [os.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:
--
2.12.0
next prev parent reply other threads:[~2017-08-29 20:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 20:00 [PATCH 0/2] Avoid build failures due to setscene errors Peter Kjellerstedt
2017-08-29 20:00 ` Peter Kjellerstedt [this message]
2017-08-29 20:00 ` [PATCH 2/2] sstate.bbclass: Do not cause " Peter Kjellerstedt
2017-08-29 20:04 ` ✗ patchtest: failure for Avoid " Patchwork
2017-08-29 20:25 ` Peter Kjellerstedt
2017-08-29 22:35 ` Philip Balister
2017-08-30 7:41 ` Peter Kjellerstedt
2017-08-29 20:38 ` [PATCH 0/2] " Andre McCurdy
2017-08-29 20:59 ` Peter Kjellerstedt
2017-08-29 21:49 ` Richard Purdie
2017-08-30 6:44 ` Peter Kjellerstedt
2017-08-30 7:54 ` Martin Jansa
2019-11-29 16:48 ` Martin Jansa
2020-01-09 12:26 ` Ricardo Ribalda Delgado
2017-08-30 8:02 ` Richard Purdie
2017-08-30 9:52 ` Peter Kjellerstedt
2017-08-29 22:03 ` Andre McCurdy
2017-08-30 9:55 ` Peter Kjellerstedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67d6fbf684b8d011e19a35db0c037170222709fd.1504036763.git.pkj@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.