[oe-commits] org.oe.dev classes/patch.bbclass: Make sure to raise func_failed on any exception from within Import

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


classes/patch.bbclass: Make sure to raise func_failed on any exception from within Import

    non existing patches raised a IOError by the md5sum method which was not
    catched at all and lead bitbake to exit due an unhandled exception. This
    is bad for all autobuilders.

Author: freyther at openembedded.org
Branch: org.openembedded.dev
Revision: a1ada670e1090a4a0d8aeca19ac7ce206efe34ba
ViewMTN: http://monotone.openembedded.org/revision.psp?id=a1ada670e1090a4a0d8aeca19ac7ce206efe34ba
Files:
1
classes/patch.bbclass
Diffs:

#
# mt diff -rc292afe16b4dd552782773c1185f8733d61bdfb3 -ra1ada670e1090a4a0d8aeca19ac7ce206efe34ba
#
# 
# 
# patch "classes/patch.bbclass"
#  from [e2224211341bed82184504c229e87898c5519d9b]
#    to [c003cee48863ad38aa2a48daab2a06cceaaee977]
# 
============================================================
--- classes/patch.bbclass	e2224211341bed82184504c229e87898c5519d9b
+++ classes/patch.bbclass	c003cee48863ad38aa2a48daab2a06cceaaee977
@@ -1,12 +1,22 @@ def patch_init(d):
 # Copyright (C) 2006  OpenedHand LTD
 
 def patch_init(d):
 	import os, sys
 
+	class NotFoundError(Exception):
+		def __init__(self, path):
+			self.path = path
+		def __str__(self):
+			return "Error: %s not found." % self.path
+
 	def md5sum(fname):
 		import md5, sys
 
-		f = file(fname, 'rb')
+		try:
+			f = file(fname, 'rb')
+		except IOError:
+			raise NotFoundError(fname)
+
 		m = md5.new()
 		while True:
 			d = f.read(8096)
@@ -24,11 +34,6 @@ def patch_init(d):
 		def __str__(self):
 			return "Command Error: exit status: %d  Output:\n%s" % (self.status, self.output)
 
-	class NotFoundError(Exception):
-		def __init__(self, path):
-			self.path = path
-		def __str__(self):
-			return "Error: %s not found." % self.path
 
 	def runcmd(args, dir = None):
 		import commands
@@ -482,7 +487,7 @@ python patch_do_patch() {
 		bb.note("Applying patch '%s'" % pname)
 		try:
 			patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
-		except NotFoundError:
+		except:
 			import sys
 			raise bb.build.FuncFailed(str(sys.exc_value))
 		resolver.Resolve()






More information about the Openembedded-commits mailing list