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:
parent
b8d69d6f6e
commit
edd290bd1a
|
@ -78,18 +78,6 @@ def base_dep_prepend(d):
|
|||
#
|
||||
|
||||
deps = ""
|
||||
|
||||
# bb.utils.sha256_file() will return None on Python 2.4 because hashlib
|
||||
# isn't present. In this case we use a shasum-native to checksum, so if
|
||||
# hashlib isn't present then add shasum-native to the dependencies.
|
||||
try:
|
||||
import hashlib
|
||||
except ImportError:
|
||||
# Adding shasum-native as a dependency of shasum-native would be
|
||||
# stupid, so don't do that.
|
||||
if bb.data.getVar('PN', d, True) != "shasum-native":
|
||||
deps = "shasum-native "
|
||||
|
||||
# INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
|
||||
# we need that built is the responsibility of the patch function / class, not
|
||||
# the application.
|
||||
|
@ -160,35 +148,6 @@ python base_do_fetch() {
|
|||
except:
|
||||
(type, value, traceback) = sys.exc_info()
|
||||
raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
|
||||
|
||||
|
||||
# Verify the SHA and MD5 sums we have in OE and check what do
|
||||
# in
|
||||
check_sum = bb.which(bb.data.getVar('BBPATH', d, True), "conf/checksums.ini")
|
||||
if not check_sum:
|
||||
bb.note("No conf/checksums.ini found, not checking checksums")
|
||||
return
|
||||
|
||||
try:
|
||||
parser = base_chk_load_parser(check_sum)
|
||||
except:
|
||||
bb.note("Creating the CheckSum parser failed")
|
||||
return
|
||||
|
||||
pv = bb.data.getVar('PV', d, True)
|
||||
pn = bb.data.getVar('PN', d, True)
|
||||
|
||||
# Check each URI
|
||||
for url in src_uri.split():
|
||||
localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
|
||||
(type,host,path,_,_,_) = bb.decodeurl(url)
|
||||
uri = "%s://%s%s" % (type,host,path)
|
||||
try:
|
||||
if type == "http" or type == "https" or type == "ftp" or type == "ftps":
|
||||
if not base_chk_file(parser, pn, pv,uri, localpath, d):
|
||||
bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
|
||||
except Exception:
|
||||
raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
|
||||
}
|
||||
|
||||
def subprocess_setup():
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue