mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
bitbake/fetch: Only checksum downloads when they're first downloaded and a checksum is present
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -247,9 +247,6 @@ def verify_checksum(u, ud, d):
|
|||||||
if not ud.type in ["http", "https", "ftp", "ftps"]:
|
if not ud.type in ["http", "https", "ftp", "ftps"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
md5data = bb.utils.md5_file(ud.localpath)
|
|
||||||
sha256data = bb.utils.sha256_file(ud.localpath)
|
|
||||||
|
|
||||||
if (ud.md5_expected == None or ud.sha256_expected == None):
|
if (ud.md5_expected == None or ud.sha256_expected == None):
|
||||||
bb.warn("Missing SRC_URI checksum for %s, consider to add\n" \
|
bb.warn("Missing SRC_URI checksum for %s, consider to add\n" \
|
||||||
"SRC_URI[%s] = \"%s\"\nSRC_URI[%s] = \"%s\"" \
|
"SRC_URI[%s] = \"%s\"\nSRC_URI[%s] = \"%s\"" \
|
||||||
@@ -258,6 +255,9 @@ def verify_checksum(u, ud, d):
|
|||||||
raise FetchError("No checksum specified for %s." % u)
|
raise FetchError("No checksum specified for %s." % u)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
md5data = bb.utils.md5_file(ud.localpath)
|
||||||
|
sha256data = bb.utils.sha256_file(ud.localpath)
|
||||||
|
|
||||||
if (ud.md5_expected != md5data or ud.sha256_expected != sha256data):
|
if (ud.md5_expected != md5data or ud.sha256_expected != sha256data):
|
||||||
bb.error("The checksums for '%s' did not match." % ud.localpath)
|
bb.error("The checksums for '%s' did not match." % ud.localpath)
|
||||||
bb.error("Expected MD5: '%s' and Got: '%s'" % (ud.md5_expected, md5data))
|
bb.error("Expected MD5: '%s' and Got: '%s'" % (ud.md5_expected, md5data))
|
||||||
@@ -307,8 +307,6 @@ def go(d, urls = None):
|
|||||||
|
|
||||||
ud.localpath = localpath
|
ud.localpath = localpath
|
||||||
|
|
||||||
verify_checksum(u, ud, d)
|
|
||||||
|
|
||||||
if os.path.exists(ud.md5):
|
if os.path.exists(ud.md5):
|
||||||
# Touch the md5 file to show active use of the download
|
# Touch the md5 file to show active use of the download
|
||||||
try:
|
try:
|
||||||
@@ -317,6 +315,8 @@ def go(d, urls = None):
|
|||||||
# Errors aren't fatal here
|
# Errors aren't fatal here
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
# Only check the checksums if we've not seen this item before
|
||||||
|
verify_checksum(u, ud, d)
|
||||||
Fetch.write_md5sum(u, ud, d)
|
Fetch.write_md5sum(u, ud, d)
|
||||||
|
|
||||||
bb.utils.unlockfile(lf)
|
bb.utils.unlockfile(lf)
|
||||||
|
|||||||
Reference in New Issue
Block a user