diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-30 09:50:41 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-03 16:58:14 +0100 |
| commit | 37e7d50bc315d5a84703ebe6b86d337044535d0c (patch) | |
| tree | c04eb10f92e87db3554e188ea6259f7296957924 | |
| parent | 0cf150a398d816f8d9d5ff43ff0ccf33e5edb029 (diff) | |
| download | poky-37e7d50bc315d5a84703ebe6b86d337044535d0c.tar.gz | |
bitbake: fetch2: Fix missing function call
Fix the issue:
File: '/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/build-appliance/build/bitbake/lib/bb/fetch2/__init__.py', lineno: 813, function: try_mirror_url
0809: except bb.fetch2.BBFetchException as e:
0810: if isinstance(e, ChecksumError):
0811: logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
0812: logger.warn(str(e))
*** 0813: self.rename_bad_checksum(ud, e.checksum)
0814: elif isinstance(e, NoChecksumError):
0815: raise
0816: else:
0817: logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
Exception: NameError: global name 'self' is not defined
(Bitbake rev: 4de0831b3183a0a146a9395f48b7ff30604912dd)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index dd1cc932d4..2eb5ae929d 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -756,6 +756,19 @@ def build_mirroruris(origud, mirrors, ld): | |||
| 756 | 756 | ||
| 757 | return uris, uds | 757 | return uris, uds |
| 758 | 758 | ||
| 759 | def rename_bad_checksum(ud, suffix): | ||
| 760 | """ | ||
| 761 | Renames files to have suffix from parameter | ||
| 762 | """ | ||
| 763 | |||
| 764 | if ud.localpath is None: | ||
| 765 | return | ||
| 766 | |||
| 767 | new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix) | ||
| 768 | bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath)) | ||
| 769 | bb.utils.movefile(ud.localpath, new_localpath) | ||
| 770 | |||
| 771 | |||
| 759 | def try_mirror_url(newuri, origud, ud, ld, check = False): | 772 | def try_mirror_url(newuri, origud, ud, ld, check = False): |
| 760 | # Return of None or a value means we're finished | 773 | # Return of None or a value means we're finished |
| 761 | # False means try another url | 774 | # False means try another url |
| @@ -807,7 +820,7 @@ def try_mirror_url(newuri, origud, ud, ld, check = False): | |||
| 807 | if isinstance(e, ChecksumError): | 820 | if isinstance(e, ChecksumError): |
| 808 | logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url)) | 821 | logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url)) |
| 809 | logger.warn(str(e)) | 822 | logger.warn(str(e)) |
| 810 | self.rename_bad_checksum(ud, e.checksum) | 823 | rename_bad_checksum(ud, e.checksum) |
| 811 | elif isinstance(e, NoChecksumError): | 824 | elif isinstance(e, NoChecksumError): |
| 812 | raise | 825 | raise |
| 813 | else: | 826 | else: |
| @@ -1392,7 +1405,7 @@ class Fetch(object): | |||
| 1392 | if isinstance(e, ChecksumError): | 1405 | if isinstance(e, ChecksumError): |
| 1393 | logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u) | 1406 | logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u) |
| 1394 | logger.debug(1, str(e)) | 1407 | logger.debug(1, str(e)) |
| 1395 | self.rename_bad_checksum(ud, e.checksum) | 1408 | rename_bad_checksum(ud, e.checksum) |
| 1396 | elif isinstance(e, NoChecksumError): | 1409 | elif isinstance(e, NoChecksumError): |
| 1397 | raise | 1410 | raise |
| 1398 | else: | 1411 | else: |
| @@ -1500,18 +1513,6 @@ class Fetch(object): | |||
| 1500 | if ud.lockfile: | 1513 | if ud.lockfile: |
| 1501 | bb.utils.unlockfile(lf) | 1514 | bb.utils.unlockfile(lf) |
| 1502 | 1515 | ||
| 1503 | def rename_bad_checksum(self, ud, suffix): | ||
| 1504 | """ | ||
| 1505 | Renames files to have suffix from parameter | ||
| 1506 | """ | ||
| 1507 | |||
| 1508 | if ud.localpath is None: | ||
| 1509 | return | ||
| 1510 | |||
| 1511 | new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix) | ||
| 1512 | bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath)) | ||
| 1513 | bb.utils.movefile(ud.localpath, new_localpath) | ||
| 1514 | |||
| 1515 | from . import cvs | 1516 | from . import cvs |
| 1516 | from . import git | 1517 | from . import git |
| 1517 | from . import gitsm | 1518 | from . import gitsm |
