summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/utils.bbclass')
-rw-r--r--meta/classes/utils.bbclass71
1 files changed, 0 insertions, 71 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 02e803a702..746f46ce52 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -83,77 +83,6 @@ def oe_system(d, cmd, **kwargs):
83 kwargs["shell"] = True 83 kwargs["shell"] = True
84 return oe_popen(d, cmd, **kwargs).wait() 84 return oe_popen(d, cmd, **kwargs).wait()
85 85
86# for MD5/SHA handling
87def base_chk_load_parser(config_paths):
88 import ConfigParser
89 parser = ConfigParser.ConfigParser()
90 if len(parser.read(config_paths)) < 1:
91 raise ValueError("no ini files could be found")
92
93 return parser
94
95def base_chk_file(parser, pn, pv, src_uri, localpath, data):
96 no_checksum = False
97 # Try PN-PV-SRC_URI first and then try PN-SRC_URI
98 # we rely on the get method to create errors
99 pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri)
100 pn_src = "%s-%s" % (pn,src_uri)
101 if parser.has_section(pn_pv_src):
102 md5 = parser.get(pn_pv_src, "md5")
103 sha256 = parser.get(pn_pv_src, "sha256")
104 elif parser.has_section(pn_src):
105 md5 = parser.get(pn_src, "md5")
106 sha256 = parser.get(pn_src, "sha256")
107 elif parser.has_section(src_uri):
108 md5 = parser.get(src_uri, "md5")
109 sha256 = parser.get(src_uri, "sha256")
110 else:
111 no_checksum = True
112
113 # md5 and sha256 should be valid now
114 if not os.path.exists(localpath):
115 bb.note("The localpath does not exist '%s'" % localpath)
116 raise Exception("The path does not exist '%s'" % localpath)
117
118
119 # Calculate the MD5 and 256-bit SHA checksums
120 md5data = bb.utils.md5_file(localpath)
121 shadata = bb.utils.sha256_file(localpath)
122
123 # sha256_file() can return None if we are running on Python 2.4 (hashlib is
124 # 2.5 onwards, sha in 2.4 is 160-bit only), so check for this and call the
125 # standalone shasum binary if required.
126 if shadata is None:
127 try:
128 shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
129 shadata = (shapipe.readline().split() or [ "" ])[0]
130 shapipe.close()
131 except OSError:
132 raise Exception("Executing shasum failed, please build shasum-native")
133
134 if no_checksum == True: # we do not have conf/checksums.ini entry
135 try:
136 file = open("%s/checksums.ini" % bb.data.getVar("TMPDIR", data, 1), "a")
137 except:
138 return False
139
140 if not file:
141 raise Exception("Creating checksums.ini failed")
142
143 file.write("[%s]\nmd5=%s\nsha256=%s\n\n" % (src_uri, md5data, shadata))
144 file.close()
145 return False
146
147 if not md5 == md5data:
148 bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data))
149 raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data))
150
151 if not sha256 == shadata:
152 bb.note("The SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256,shadata))
153 raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256, shadata))
154
155 return True
156
157oe_soinstall() { 86oe_soinstall() {
158 # Purpose: Install shared library file and 87 # Purpose: Install shared library file and
159 # create the necessary links 88 # create the necessary links