diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-05-29 18:17:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-05-30 10:20:25 +0100 |
commit | 429bb2ae80cf73d738f6d79caee0f103f166bef7 (patch) | |
tree | ca3816fba4dbd21522555b5c63aefce334f8e829 /bitbake/lib/bb/fetch2 | |
parent | 91b6edd0925df5d939a6d48e71bc59aaa9e9f494 (diff) | |
download | poky-429bb2ae80cf73d738f6d79caee0f103f166bef7.tar.gz |
bitbake: fetch2: improve handling of two classes of URL parameter mistakes
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".
(Bitbake rev: bfd13dfbc4c9f1dd8315002271791b1d9e274989)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index f571fc45e6..dcada12ead 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -56,8 +56,11 @@ class BBFetchException(Exception): | |||
56 | 56 | ||
57 | class MalformedUrl(BBFetchException): | 57 | class MalformedUrl(BBFetchException): |
58 | """Exception raised when encountering an invalid url""" | 58 | """Exception raised when encountering an invalid url""" |
59 | def __init__(self, url): | 59 | def __init__(self, url, message=''): |
60 | msg = "The URL: '%s' is invalid and cannot be interpreted" % url | 60 | if message: |
61 | msg = message | ||
62 | else: | ||
63 | msg = "The URL: '%s' is invalid and cannot be interpreted" % url | ||
61 | self.url = url | 64 | self.url = url |
62 | BBFetchException.__init__(self, msg) | 65 | BBFetchException.__init__(self, msg) |
63 | self.args = (url,) | 66 | self.args = (url,) |
@@ -371,8 +374,11 @@ def decodeurl(url): | |||
371 | p = {} | 374 | p = {} |
372 | if parm: | 375 | if parm: |
373 | for s in parm.split(';'): | 376 | for s in parm.split(';'): |
374 | s1, s2 = s.split('=') | 377 | if s: |
375 | p[s1] = s2 | 378 | if not '=' in s: |
379 | raise MalformedUrl(url, "The URL: '%s' is invalid: parameter %s does not specify a value (missing '=')" % (url, s)) | ||
380 | s1, s2 = s.split('=') | ||
381 | p[s1] = s2 | ||
376 | 382 | ||
377 | return type, host, urllib.unquote(path), user, pswd, p | 383 | return type, host, urllib.unquote(path), user, pswd, p |
378 | 384 | ||