summaryrefslogtreecommitdiff
path: root/classes/base.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r--classes/base.bbclass70
1 files changed, 50 insertions, 20 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 9d063f2151..e6cfeccc46 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths):
return parser
+def base_chk_file_vars(parser, localpath, params, data):
+ try:
+ name = params["name"]
+ except KeyError:
+ return False
+ flagName = "%s.md5sum" % name
+ want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+ flagName = "%s.sha256sum" % name
+ want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+
+ if (want_sha256sum == None and want_md5sum == None):
+ # no checksums to check, nothing to do
+ return False
+
+ if not os.path.exists(localpath):
+ localpath = base_path_out(localpath, data)
+ bb.note("The localpath does not exist '%s'" % localpath)
+ raise Exception("The path does not exist '%s'" % localpath)
+
+ if want_md5sum:
+ try:
+ md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+ md5data = (md5pipe.readline().split() or [ "" ])[0]
+ md5pipe.close()
+ except OSError, e:
+ raise Exception("Executing md5sum failed")
+ if want_md5sum != md5data:
+ bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data))
+ raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data))
+
+ if want_sha256sum:
+ try:
+ shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+ sha256data = (shapipe.readline().split() or [ "" ])[0]
+ shapipe.close()
+ except OSError, e:
+ raise Exception("Executing shasum failed")
+ if want_sha256sum != sha256data:
+ bb.note("The SHA256Sums did not match. Wanted: '%s' and Got: '%s'" % (want_sha256sum, sha256data))
+ raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (want_sha256sum, sha256data))
+
+ return True
+
+
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
@@ -639,15 +683,15 @@ python base_do_fetch() {
# 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)
+ (type,host,path,_,_,params) = 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):
- if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True):
- bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
+ if type in [ "http", "https", "ftp", "ftps" ]:
+ if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)):
+ if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS", d, True):
+ bb.fatal("%s-%s: %s has no checksum defined, cannot check archive integrity" % (pn,pv,uri))
else:
- bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
+ bb.note("%s-%s: %s has no checksum defined, archive integrity not checked" % (pn,pv,uri))
except Exception:
raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
}
@@ -1028,7 +1072,6 @@ sysroot_stage_all() {
}
def is_legacy_staging(d):
- import bb
stagefunc = bb.data.getVar('do_stage', d, True)
legacy = True
if stagefunc is None:
@@ -1264,19 +1307,6 @@ def check_app_exists(app, d):
path = data.getVar('PATH', d, 1)
return len(which(path, app)) != 0
-def check_gcc3(data):
- # Primarly used by qemu to make sure we have a workable gcc-3.4.x.
- # Start by checking for the program name as we build it, was not
- # all host-provided gcc-3.4's will work.
-
- gcc3_versions = 'gcc-3.4.6 gcc-3.4.4 gcc34 gcc-3.4 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
-
- for gcc3 in gcc3_versions.split():
- if check_app_exists(gcc3, data):
- return gcc3
-
- return False
-
# Patch handling
inherit patch