summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-12-20 15:34:50 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2010-12-20 15:34:50 +0000
commitedd290bd1ae192e7f03b4d2336e6412a96e7f37e (patch)
treed248ccfd338c4a57ffdd4780bbbb6dad8a3d49e5 /meta/classes
parentb8d69d6f6e41896046a07f6ffb5d156ed23c6556 (diff)
downloadpoky-edd290bd1ae192e7f03b4d2336e6412a96e7f37e.tar.gz
base/utils.bbclass: Drop former checksum code now bitbake is handling this for us
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/base.bbclass41
-rw-r--r--meta/classes/utils.bbclass71
2 files changed, 0 insertions, 112 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 384e723cf5..c60048bd50 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -78,18 +78,6 @@ def base_dep_prepend(d):
78 # 78 #
79 79
80 deps = "" 80 deps = ""
81
82 # bb.utils.sha256_file() will return None on Python 2.4 because hashlib
83 # isn't present. In this case we use a shasum-native to checksum, so if
84 # hashlib isn't present then add shasum-native to the dependencies.
85 try:
86 import hashlib
87 except ImportError:
88 # Adding shasum-native as a dependency of shasum-native would be
89 # stupid, so don't do that.
90 if bb.data.getVar('PN', d, True) != "shasum-native":
91 deps = "shasum-native "
92
93 # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not 81 # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
94 # we need that built is the responsibility of the patch function / class, not 82 # we need that built is the responsibility of the patch function / class, not
95 # the application. 83 # the application.
@@ -160,35 +148,6 @@ python base_do_fetch() {
160 except: 148 except:
161 (type, value, traceback) = sys.exc_info() 149 (type, value, traceback) = sys.exc_info()
162 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value) 150 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
163
164
165 # Verify the SHA and MD5 sums we have in OE and check what do
166 # in
167 check_sum = bb.which(bb.data.getVar('BBPATH', d, True), "conf/checksums.ini")
168 if not check_sum:
169 bb.note("No conf/checksums.ini found, not checking checksums")
170 return
171
172 try:
173 parser = base_chk_load_parser(check_sum)
174 except:
175 bb.note("Creating the CheckSum parser failed")
176 return
177
178 pv = bb.data.getVar('PV', d, True)
179 pn = bb.data.getVar('PN', d, True)
180
181 # Check each URI
182 for url in src_uri.split():
183 localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
184 (type,host,path,_,_,_) = bb.decodeurl(url)
185 uri = "%s://%s%s" % (type,host,path)
186 try:
187 if type == "http" or type == "https" or type == "ftp" or type == "ftps":
188 if not base_chk_file(parser, pn, pv,uri, localpath, d):
189 bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
190 except Exception:
191 raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
192} 151}
193 152
194def subprocess_setup(): 153def subprocess_setup():
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