diff options
author | Ross Burton <ross@openedhand.com> | 2008-05-01 11:00:27 +0000 |
---|---|---|
committer | Ross Burton <ross@openedhand.com> | 2008-05-01 11:00:27 +0000 |
commit | 9fb8bc41bf3e9369aa213ac5397851ffe3aafc7c (patch) | |
tree | 8ae717d8c3d3d8a24bb7565ab140d4e86946b6d2 /meta/classes/base.bbclass | |
parent | 8bfb9258cf612488d568eb67bc89a9c271b70a70 (diff) | |
download | poky-9fb8bc41bf3e9369aa213ac5397851ffe3aafc7c.tar.gz |
When checksuming tarballs use bb.utils.*_sum instead of calling commands directly
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4387 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 2e8f3f08fb..0c048b997b 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -45,21 +45,21 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): | |||
45 | raise Exception("The path does not exist '%s'" % localpath) | 45 | raise Exception("The path does not exist '%s'" % localpath) |
46 | 46 | ||
47 | 47 | ||
48 | # call md5(sum) and shasum | 48 | # Calculate the MD5 and 256-bit SHA checksums |
49 | try: | 49 | md5data = bb.utils.md5_file(localpath) |
50 | md5pipe = os.popen('md5sum ' + localpath) | 50 | shadata = bb.utils.sha256_file(localpath) |
51 | md5data = (md5pipe.readline().split() or [ "" ])[0] | 51 | |
52 | md5pipe.close() | 52 | # sha256_file() can return None if we are running on Python 2.4 (hashlib is |
53 | except OSError: | 53 | # 2.5 onwards, sha in 2.4 is 160-bit only), so check for this and call the |
54 | raise Exception("Executing md5sum failed") | 54 | # standalone shasum binary if required. |
55 | 55 | if shadata is None: | |
56 | try: | 56 | try: |
57 | shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) | 57 | shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) |
58 | shadata = (shapipe.readline().split() or [ "" ])[0] | 58 | shadata = (shapipe.readline().split() or [ "" ])[0] |
59 | shapipe.close() | 59 | shapipe.close() |
60 | except OSError: | 60 | except OSError: |
61 | raise Exception("Executing shasum failed") | 61 | raise Exception("Executing shasum failed, please build shasum-native") |
62 | 62 | ||
63 | if no_checksum == True: # we do not have conf/checksums.ini entry | 63 | if no_checksum == True: # we do not have conf/checksums.ini entry |
64 | try: | 64 | try: |
65 | file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a") | 65 | file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a") |