diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 20:46:42 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 21:13:13 +0000 |
| commit | d4b4b48addfa781d7b94965e0477974c3fb6dbb3 (patch) | |
| tree | 862d5b35ca263a6b6ef73eb3e0a9592f822f21a9 | |
| parent | 94faffdaf6c13ce59987aab28383d66a9a0bf100 (diff) | |
| download | poky-d4b4b48addfa781d7b94965e0477974c3fb6dbb3.tar.gz | |
bitbake/fetch2: Fix pickling issues with fetcher exceptions
See the problems in http://bugs.python.org/issue1692335, need to set self.args
correctly.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index dda70db489..a37bd2b53e 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -49,55 +49,62 @@ class BBFetchException(Exception): | |||
| 49 | class MalformedUrl(BBFetchException): | 49 | class MalformedUrl(BBFetchException): |
| 50 | """Exception raised when encountering an invalid url""" | 50 | """Exception raised when encountering an invalid url""" |
| 51 | def __init__(self, url): | 51 | def __init__(self, url): |
| 52 | self.msg = "The URL: '%s' is invalid and cannot be interpreted" % url | 52 | msg = "The URL: '%s' is invalid and cannot be interpreted" % url |
| 53 | self.url = url | 53 | self.url = url |
| 54 | Exception.__init__(self, self.msg) | 54 | BBFetchException.__init__(self, msg) |
| 55 | self.args = url | ||
| 55 | 56 | ||
| 56 | class FetchError(BBFetchException): | 57 | class FetchError(BBFetchException): |
| 57 | """General fetcher exception when something happens incorrectly""" | 58 | """General fetcher exception when something happens incorrectly""" |
| 58 | def __init__(self, message, url = None): | 59 | def __init__(self, message, url = None): |
| 59 | self.msg = "Fetcher failure for URL: '%s'. %s" % (url, message) | 60 | msg = "Fetcher failure for URL: '%s'. %s" % (url, message) |
| 60 | self.url = url | 61 | self.url = url |
| 61 | Exception.__init__(self, self.msg) | 62 | BBFetchException.__init__(self, msg) |
| 63 | self.args = (message, url) | ||
| 62 | 64 | ||
| 63 | class UnpackError(BBFetchException): | 65 | class UnpackError(BBFetchException): |
| 64 | """General fetcher exception when something happens incorrectly when unpacking""" | 66 | """General fetcher exception when something happens incorrectly when unpacking""" |
| 65 | def __init__(self, message, url): | 67 | def __init__(self, message, url): |
| 66 | self.msg = "Unpack failure for URL: '%s'. %s" % (url, message) | 68 | msg = "Unpack failure for URL: '%s'. %s" % (url, message) |
| 67 | self.url = url | 69 | self.url = url |
| 68 | Exception.__init__(self, self.msg) | 70 | BBFetchException.__init__(self, msg) |
| 71 | self.args = (message, url) | ||
| 69 | 72 | ||
| 70 | class NoMethodError(BBFetchException): | 73 | class NoMethodError(BBFetchException): |
| 71 | """Exception raised when there is no method to obtain a supplied url or set of urls""" | 74 | """Exception raised when there is no method to obtain a supplied url or set of urls""" |
| 72 | def __init__(self, url): | 75 | def __init__(self, url): |
| 73 | self.msg = "Could not find a fetcher which supports the URL: '%s'" % url | 76 | msg = "Could not find a fetcher which supports the URL: '%s'" % url |
| 74 | self.url = url | 77 | self.url = url |
| 75 | Exception.__init__(self, self.msg) | 78 | BBFetchException.__init__(self, msg) |
| 79 | self.args = url | ||
| 76 | 80 | ||
| 77 | class MissingParameterError(BBFetchException): | 81 | class MissingParameterError(BBFetchException): |
| 78 | """Exception raised when a fetch method is missing a critical parameter in the url""" | 82 | """Exception raised when a fetch method is missing a critical parameter in the url""" |
| 79 | def __init__(self, missing, url): | 83 | def __init__(self, missing, url): |
| 80 | self.msg = "URL: '%s' is missing the required parameter '%s'" % (url, missing) | 84 | msg = "URL: '%s' is missing the required parameter '%s'" % (url, missing) |
| 81 | self.url = url | 85 | self.url = url |
| 82 | self.missing = missing | 86 | self.missing = missing |
| 83 | Exception.__init__(self, self.msg) | 87 | BBFetchException.__init__(self, msg) |
| 88 | self.args = (missing, url) | ||
| 84 | 89 | ||
| 85 | class ParameterError(BBFetchException): | 90 | class ParameterError(BBFetchException): |
| 86 | """Exception raised when a url cannot be proccessed due to invalid parameters.""" | 91 | """Exception raised when a url cannot be proccessed due to invalid parameters.""" |
| 87 | def __init__(self, message, url): | 92 | def __init__(self, message, url): |
| 88 | self.msg = "URL: '%s' has invalid parameters. %s" % (url, message) | 93 | msg = "URL: '%s' has invalid parameters. %s" % (url, message) |
| 89 | self.url = url | 94 | self.url = url |
| 90 | Exception.__init__(self, self.msg) | 95 | BBFetchException.__init__(self, msg) |
| 96 | self.args = (message, url) | ||
| 91 | 97 | ||
| 92 | class MD5SumError(BBFetchException): | 98 | class MD5SumError(BBFetchException): |
| 93 | """Exception raised when a MD5 checksum of a file does not match for a downloaded file""" | 99 | """Exception raised when a MD5 checksum of a file does not match for a downloaded file""" |
| 94 | def __init__(self, path, wanted, got, url): | 100 | def __init__(self, path, wanted, got, url): |
| 95 | self.msg = "File: '%s' has md5 sum %s when %s was expected (from URL: '%s')" % (path, got, wanted, url) | 101 | msg = "File: '%s' has md5 sum %s when %s was expected (from URL: '%s')" % (path, got, wanted, url) |
| 96 | self.url = url | 102 | self.url = url |
| 97 | self.path = path | 103 | self.path = path |
| 98 | self.wanted = wanted | 104 | self.wanted = wanted |
| 99 | self.got = got | 105 | self.got = got |
| 100 | Exception.__init__(self, self.msg) | 106 | BBFetchException.__init__(self, msg) |
| 107 | self.args = (path, wanted, got, url) | ||
| 101 | 108 | ||
| 102 | class SHA256SumError(MD5SumError): | 109 | class SHA256SumError(MD5SumError): |
| 103 | """Exception raised when a SHA256 checksum of a file does not match for a downloaded file""" | 110 | """Exception raised when a SHA256 checksum of a file does not match for a downloaded file""" |
