mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
91b6edd092
commit
429bb2ae80
@@ -56,7 +56,10 @@ class BBFetchException(Exception):
|
|||||||
|
|
||||||
class MalformedUrl(BBFetchException):
|
class MalformedUrl(BBFetchException):
|
||||||
"""Exception raised when encountering an invalid url"""
|
"""Exception raised when encountering an invalid url"""
|
||||||
def __init__(self, url):
|
def __init__(self, url, message=''):
|
||||||
|
if message:
|
||||||
|
msg = message
|
||||||
|
else:
|
||||||
msg = "The URL: '%s' is invalid and cannot be interpreted" % url
|
msg = "The URL: '%s' is invalid and cannot be interpreted" % url
|
||||||
self.url = url
|
self.url = url
|
||||||
BBFetchException.__init__(self, msg)
|
BBFetchException.__init__(self, msg)
|
||||||
@@ -371,6 +374,9 @@ def decodeurl(url):
|
|||||||
p = {}
|
p = {}
|
||||||
if parm:
|
if parm:
|
||||||
for s in parm.split(';'):
|
for s in parm.split(';'):
|
||||||
|
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('=')
|
s1, s2 = s.split('=')
|
||||||
p[s1] = s2
|
p[s1] = s2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user