summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorChris Larson <kergoth@openedhand.com>2006-08-22 08:58:02 +0000
committerChris Larson <kergoth@openedhand.com>2006-08-22 08:58:02 +0000
commit7aa52d7fd99c68d36bb9903de84a6e240ab767cf (patch)
tree7781c50d02a3c3d9661826766ebf9976826b6912 /meta
parent9649cf3dae0f8a56975730aa29ac3bd7f4d6a209 (diff)
downloadpoky-7aa52d7fd99c68d36bb9903de84a6e240ab767cf.tar.gz
Clean up the way patch.bbclass's runcmd handles the directory not existing.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@624 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/patch.bbclass21
1 files changed, 17 insertions, 4 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 0f0d6a686f..aa54d9b32f 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -21,12 +21,20 @@ def patch_init():
21 21
22 def __str__(self): 22 def __str__(self):
23 return "Command Error: exit status: %d Output:\n%s" % (self.status, self.output) 23 return "Command Error: exit status: %d Output:\n%s" % (self.status, self.output)
24
25 class NotFoundError(Exception):
26 def __init__(self, path):
27 self.path = path
28 def __str__(self):
29 return "Error: %s not found." % self.path
24 30
25 def runcmd(args, dir = None): 31 def runcmd(args, dir = None):
26 import commands 32 import commands
27 33
28 if dir: 34 if dir:
29 olddir = os.path.abspath(os.curdir) 35 olddir = os.path.abspath(os.curdir)
36 if not os.path.exists(dir):
37 raise NotFoundError(dir)
30 os.chdir(dir) 38 os.chdir(dir)
31 # print("cwd: %s -> %s" % (olddir, self.dir)) 39 # print("cwd: %s -> %s" % (olddir, self.dir))
32 40
@@ -120,9 +128,8 @@ def patch_init():
120 pass 128 pass
121 else: 129 else:
122 raise PatchError("Unable to clean patches from tree:\n"+str(sys.exc_value)) 130 raise PatchError("Unable to clean patches from tree:\n"+str(sys.exc_value))
123 except OSError: 131 except NotFoundError:
124 if str(sys.exc_value).startswith('OSError: [Errno 2]'): 132 pass
125 pass
126 runcmd(["rm", "-rf", os.path.join(self.dir, "patches"), os.path.join(self.dir, ".pc")]) 133 runcmd(["rm", "-rf", os.path.join(self.dir, "patches"), os.path.join(self.dir, ".pc")])
127 self.initialized = True 134 self.initialized = True
128 135
@@ -311,6 +318,8 @@ def patch_init():
311 g["QuiltTree"] = QuiltTree 318 g["QuiltTree"] = QuiltTree
312 g["Resolver"] = Resolver 319 g["Resolver"] = Resolver
313 g["UserResolver"] = UserResolver 320 g["UserResolver"] = UserResolver
321 g["NotFoundError"] = NotFoundError
322 g["CmdError"] = CmdError
314 323
315addtask patch after do_unpack 324addtask patch after do_unpack
316do_patch[dirs] = "${WORKDIR}" 325do_patch[dirs] = "${WORKDIR}"
@@ -400,6 +409,10 @@ python base_do_patch() {
400 continue 409 continue
401 410
402 bb.note("Applying patch '%s'" % pname) 411 bb.note("Applying patch '%s'" % pname)
403 patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) 412 try:
413 patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
414 except NotFoundError:
415 import sys
416 raise bb.build.FuncFailed(str(sys.exc_value))
404 resolver.Resolve() 417 resolver.Resolve()
405} 418}