* [PATCH 0/2] Error handling fixes
@ 2014-05-29 17:17 Paul Eggleton
2014-05-29 17:17 ` [PATCH 1/2] fetch2: improve handling of two classes of URL parameter mistakes Paul Eggleton
2014-05-29 17:17 ` [PATCH 2/2] utils: avoid printing traceback on ExpansionError during parsing Paul Eggleton
0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-05-29 17:17 UTC (permalink / raw)
To: bitbake-devel
The following changes since commit 0e7b594ccbceb3149f38776cea204807031ef69f:
fetch2/hg: Fix missing proto param for hg checkout with user and pw (2014-05-28 08:28:17 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib paule/bb-errors
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-errors
Paul Eggleton (2):
fetch2: improve handling of two classes of URL parameter mistakes
utils: avoid printing traceback on ExpansionError during parsing
lib/bb/fetch2/__init__.py | 14 ++++++++++----
lib/bb/utils.py | 2 ++
2 files changed, 12 insertions(+), 4 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] fetch2: improve handling of two classes of URL parameter mistakes
2014-05-29 17:17 [PATCH 0/2] Error handling fixes Paul Eggleton
@ 2014-05-29 17:17 ` Paul Eggleton
2014-05-29 17:17 ` [PATCH 2/2] utils: avoid printing traceback on ExpansionError during parsing Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-05-29 17:17 UTC (permalink / raw)
To: bitbake-devel
Handle the following situations in a URL (e.g. in SRC_URI):
* Trailing semicolon in a URL - this is now ignored.
* Parameter specified with no value (no equals sign). This still
produces an error, but at least it is MalformedUrl with a proper
message rather than "ValueError: need more than 1 value to unpack".
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/fetch2/__init__.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index f571fc4..dcada12 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -56,8 +56,11 @@ class BBFetchException(Exception):
class MalformedUrl(BBFetchException):
"""Exception raised when encountering an invalid url"""
- def __init__(self, url):
- msg = "The URL: '%s' is invalid and cannot be interpreted" % url
+ def __init__(self, url, message=''):
+ if message:
+ msg = message
+ else:
+ msg = "The URL: '%s' is invalid and cannot be interpreted" % url
self.url = url
BBFetchException.__init__(self, msg)
self.args = (url,)
@@ -371,8 +374,11 @@ def decodeurl(url):
p = {}
if parm:
for s in parm.split(';'):
- s1, s2 = s.split('=')
- p[s1] = s2
+ if s:
+ if not '=' in s:
+ raise MalformedUrl(url, "The URL: '%s' is invalid: parameter %s does not specify a value (missing '=')" % (url, s))
+ s1, s2 = s.split('=')
+ p[s1] = s2
return type, host, urllib.unquote(path), user, pswd, p
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] utils: avoid printing traceback on ExpansionError during parsing
2014-05-29 17:17 [PATCH 0/2] Error handling fixes Paul Eggleton
2014-05-29 17:17 ` [PATCH 1/2] fetch2: improve handling of two classes of URL parameter mistakes Paul Eggleton
@ 2014-05-29 17:17 ` Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-05-29 17:17 UTC (permalink / raw)
To: bitbake-devel
If an ExpansionError occurs during better_exec() we should just raise it
instead of printing the traceback, so that recipe errors (such as broken
URLs in SRC_URI) are more easily comprehensible.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/utils.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 1be1874..ead5f36 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -357,6 +357,8 @@ def better_exec(code, context, text = None, realfile = "<code>"):
except bb.BBHandledException:
# Error already shown so passthrough
raise
+ except bb.data_smart.ExpansionError:
+ raise
except Exception as e:
(t, value, tb) = sys.exc_info()
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-29 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29 17:17 [PATCH 0/2] Error handling fixes Paul Eggleton
2014-05-29 17:17 ` [PATCH 1/2] fetch2: improve handling of two classes of URL parameter mistakes Paul Eggleton
2014-05-29 17:17 ` [PATCH 2/2] utils: avoid printing traceback on ExpansionError during parsing Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox