diff options
Diffstat (limited to 'meta/classes/base.bbclass')
| -rw-r--r-- | meta/classes/base.bbclass | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 27f031c014..13c76431c6 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
| @@ -22,6 +22,7 @@ def base_chk_load_parser(config_path): | |||
| 22 | 22 | ||
| 23 | def base_chk_file(parser, pn, pv, src_uri, localpath, data): | 23 | def base_chk_file(parser, pn, pv, src_uri, localpath, data): |
| 24 | import os, bb | 24 | import os, bb |
| 25 | no_checksum = False | ||
| 25 | # Try PN-PV-SRC_URI first and then try PN-SRC_URI | 26 | # Try PN-PV-SRC_URI first and then try PN-SRC_URI |
| 26 | # we rely on the get method to create errors | 27 | # we rely on the get method to create errors |
| 27 | pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri) | 28 | pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri) |
| @@ -36,8 +37,7 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): | |||
| 36 | md5 = parser.get(src_uri, "md5") | 37 | md5 = parser.get(src_uri, "md5") |
| 37 | sha256 = parser.get(src_uri, "sha256") | 38 | sha256 = parser.get(src_uri, "sha256") |
| 38 | else: | 39 | else: |
| 39 | return False | 40 | no_checksum = True |
| 40 | #raise Exception("Can not find a section for '%s' '%s' and '%s'" % (pn,pv,src_uri)) | ||
| 41 | 41 | ||
| 42 | # md5 and sha256 should be valid now | 42 | # md5 and sha256 should be valid now |
| 43 | if not os.path.exists(localpath): | 43 | if not os.path.exists(localpath): |
| @@ -60,6 +60,19 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): | |||
| 60 | except OSError: | 60 | except OSError: |
| 61 | raise Exception("Executing shasum failed") | 61 | raise Exception("Executing shasum failed") |
| 62 | 62 | ||
| 63 | if no_checksum == True: # we do not have conf/checksums.ini entry | ||
| 64 | try: | ||
| 65 | file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a") | ||
| 66 | except: | ||
| 67 | return False | ||
| 68 | |||
| 69 | if not file: | ||
| 70 | raise Exception("Creating checksums.ini failed") | ||
| 71 | |||
| 72 | file.write("[%s]\nmd5=%s\nsha256=%s\n\n" % (src_uri, md5data, shadata)) | ||
| 73 | file.close() | ||
| 74 | return False | ||
| 75 | |||
| 63 | if not md5 == md5data: | 76 | if not md5 == md5data: |
| 64 | bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data)) | 77 | bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data)) |
| 65 | raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data)) | 78 | raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data)) |
| @@ -482,11 +495,9 @@ python base_do_fetch() { | |||
| 482 | (type,host,path,_,_,_) = bb.decodeurl(url) | 495 | (type,host,path,_,_,_) = bb.decodeurl(url) |
| 483 | uri = "%s://%s%s" % (type,host,path) | 496 | uri = "%s://%s%s" % (type,host,path) |
| 484 | try: | 497 | try: |
| 485 | if not base_chk_file(parser, pn, pv,uri, localpath, d): | 498 | if type == "http" or type == "https" or type == "ftp" or type == "ftps": |
| 486 | if type != "file": | 499 | if not base_chk_file(parser, pn, pv,uri, localpath, d): |
| 487 | bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) | 500 | bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) |
| 488 | else: | ||
| 489 | bb.debug("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) | ||
| 490 | except Exception: | 501 | except Exception: |
| 491 | raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) | 502 | raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) |
| 492 | } | 503 | } |
