[oe-commits] org.oe.dev classes/base.bbclass: Make the checksum code work and test it with file-native

freyther commit openembedded-commits at lists.openembedded.org
Sat Mar 31 21:03:13 UTC 2007


classes/base.bbclass: Make the checksum code work and test it with file-native
conf/checksums.ini: Provide an example on how this can be used

Author: freyther at openembedded.org
Branch: org.openembedded.dev
Revision: f8de7adfcce2320064828f2c28f14f0e0e4298f4
ViewMTN: http://monotone.openembedded.org/revision.psp?id=f8de7adfcce2320064828f2c28f14f0e0e4298f4
Files:
1
classes/base.bbclass
conf/checksums.ini
Diffs:

#
# mt diff -r9998a3bcb4643161af23476cb4f37abe0c6a55fd -rf8de7adfcce2320064828f2c28f14f0e0e4298f4
#
# 
# 
# patch "classes/base.bbclass"
#  from [0457c31b3c81ffa4fa3cdcf5ba7fdabd417ac7b5]
#    to [006ad453eaf8bd5e1aed92af95d36743bef8e480]
# 
# patch "conf/checksums.ini"
#  from [1673be984f1830ab54dab19020af6b437f534ec1]
#    to [0c38bb7a1017481435b26403e8e11e18f1b562f6]
# 
============================================================
--- classes/base.bbclass	0457c31b3c81ffa4fa3cdcf5ba7fdabd417ac7b5
+++ classes/base.bbclass	006ad453eaf8bd5e1aed92af95d36743bef8e480
@@ -12,15 +12,16 @@ def base_chk_load_parser(config_path):
 
 # for MD5/SHA handling
 def base_chk_load_parser(config_path):
-    import ConfigParser, os
+    import ConfigParser, os, bb
     parser = ConfigParser.ConfigParser()
     if not len(parser.read(config_path)) == 1:
+        bb.note("Can not open the '%s' ini file" % config_path)
         raise Exception("Can not open the '%s'" % config_path)
 
     return parser
 
 def base_chk_file(parser, pn, pv, src_uri, localpath):
-    import os
+    import os, bb
     # Try PN-PV-SRC_URI first and then try PN-SRC_URI
     # we rely on the get method to create errors
     pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri)
@@ -37,6 +38,7 @@ def base_chk_file(parser, pn, pv, src_ur
 
     # md5 and sha256 should be valid now
     if not os.path.exists(localpath):
+        bb.note("The locapath does not exist '%s'" % localpath)
         raise Exception("The path does not exist '%s'" % localpath)
 
 
@@ -56,9 +58,11 @@ def base_chk_file(parser, pn, pv, src_ur
         raise Exception("Executing shasum failed")
 
     if not md5 == md5data:
+        bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data))
         raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data))
 
     if not sha256 == shadata:
+        bb.note("The SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256,shadata))
         raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256, shadata))
 
     return True
@@ -472,7 +476,7 @@ python base_do_fetch() {
 		return
 
 	try:
-		parser = base_chk_load_parser(ckeck_sum)
+		parser = base_chk_load_parser(check_sum)
 	except:
 		bb.note("Creating the CheckSum parser failed")
 		return
@@ -484,13 +488,12 @@ python base_do_fetch() {
 	for url in src_uri.split():
 		localpath = bb.fetch.localpath(url,localdata)
 		(type,host,path,_,_,_) = bb.decodeurl(url)
-		print type, host, path
 		uri = "%s://%s%s" % (type,host,path)
 		try:
-			if not base_chk_file(parser, pn, pv,uri, localpath):
-				bb.note("%s-%s-%s has no section, not checking URI" % pn,pv,uri)
-		except Exception, e:
-			raise bb.func.FuncFailed("Checksum of '%s' failed", uri)
+		    if not base_chk_file(parser, pn, pv,uri, localpath):
+			    bb.note("%s-%s-%s has no section, not checking URI" % (pn,pv,uri))
+		except Exception:
+			raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
 }
 
 addtask fetchall after do_fetch
============================================================
--- conf/checksums.ini	1673be984f1830ab54dab19020af6b437f534ec1
+++ conf/checksums.ini	0c38bb7a1017481435b26403e8e11e18f1b562f6
@@ -1,3 +1,3 @@
-[file-native-4.20]
-md5=1
-sha256=1
+[file-native-4.20-ftp://ftp.astron.com/pub/file/file-4.20.tar.gz]
+md5=402bdb26356791bd5d277099adacc006
+sha256=c0810fb3ddb6cb73c9ff045965e542af6e3eaa7f2995b3037181766d26d5e6e7






More information about the Openembedded-commits mailing list