mirror of
https://git.yoctoproject.org/poky
synced 2026-04-26 18:32:13 +02:00
base/utils.bbclass: Drop former checksum code now bitbake is handling this for us
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -83,77 +83,6 @@ def oe_system(d, cmd, **kwargs):
|
||||
kwargs["shell"] = True
|
||||
return oe_popen(d, cmd, **kwargs).wait()
|
||||
|
||||
# for MD5/SHA handling
|
||||
def base_chk_load_parser(config_paths):
|
||||
import ConfigParser
|
||||
parser = ConfigParser.ConfigParser()
|
||||
if len(parser.read(config_paths)) < 1:
|
||||
raise ValueError("no ini files could be found")
|
||||
|
||||
return parser
|
||||
|
||||
def base_chk_file(parser, pn, pv, src_uri, localpath, data):
|
||||
no_checksum = False
|
||||
# Try PN-PV-SRC_URI first and then try PN-SRC_URI
|
||||
# we rely on the get method to create errors
|
||||
pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri)
|
||||
pn_src = "%s-%s" % (pn,src_uri)
|
||||
if parser.has_section(pn_pv_src):
|
||||
md5 = parser.get(pn_pv_src, "md5")
|
||||
sha256 = parser.get(pn_pv_src, "sha256")
|
||||
elif parser.has_section(pn_src):
|
||||
md5 = parser.get(pn_src, "md5")
|
||||
sha256 = parser.get(pn_src, "sha256")
|
||||
elif parser.has_section(src_uri):
|
||||
md5 = parser.get(src_uri, "md5")
|
||||
sha256 = parser.get(src_uri, "sha256")
|
||||
else:
|
||||
no_checksum = True
|
||||
|
||||
# md5 and sha256 should be valid now
|
||||
if not os.path.exists(localpath):
|
||||
bb.note("The localpath does not exist '%s'" % localpath)
|
||||
raise Exception("The path does not exist '%s'" % localpath)
|
||||
|
||||
|
||||
# Calculate the MD5 and 256-bit SHA checksums
|
||||
md5data = bb.utils.md5_file(localpath)
|
||||
shadata = bb.utils.sha256_file(localpath)
|
||||
|
||||
# sha256_file() can return None if we are running on Python 2.4 (hashlib is
|
||||
# 2.5 onwards, sha in 2.4 is 160-bit only), so check for this and call the
|
||||
# standalone shasum binary if required.
|
||||
if shadata is None:
|
||||
try:
|
||||
shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
|
||||
shadata = (shapipe.readline().split() or [ "" ])[0]
|
||||
shapipe.close()
|
||||
except OSError:
|
||||
raise Exception("Executing shasum failed, please build shasum-native")
|
||||
|
||||
if no_checksum == True: # we do not have conf/checksums.ini entry
|
||||
try:
|
||||
file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a")
|
||||
except:
|
||||
return False
|
||||
|
||||
if not file:
|
||||
raise Exception("Creating checksums.ini failed")
|
||||
|
||||
file.write("[%s]\nmd5=%s\nsha256=%s\n\n" % (src_uri, md5data, shadata))
|
||||
file.close()
|
||||
return False
|
||||
|
||||
if not md5 == md5data:
|
||||
bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data))
|
||||
raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data))
|
||||
|
||||
if not sha256 == shadata:
|
||||
bb.note("The SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256,shadata))
|
||||
raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256, shadata))
|
||||
|
||||
return True
|
||||
|
||||
oe_soinstall() {
|
||||
# Purpose: Install shared library file and
|
||||
# create the necessary links
|
||||
|
||||
Reference in New Issue
Block a user