mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
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
This commit is contained in:
@@ -22,11 +22,19 @@ def patch_init():
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Command Error: exit status: %d Output:\n%s" % (self.status, self.output)
|
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):
|
def runcmd(args, dir = None):
|
||||||
import commands
|
import commands
|
||||||
|
|
||||||
if dir:
|
if dir:
|
||||||
olddir = os.path.abspath(os.curdir)
|
olddir = os.path.abspath(os.curdir)
|
||||||
|
if not os.path.exists(dir):
|
||||||
|
raise NotFoundError(dir)
|
||||||
os.chdir(dir)
|
os.chdir(dir)
|
||||||
# print("cwd: %s -> %s" % (olddir, self.dir))
|
# print("cwd: %s -> %s" % (olddir, self.dir))
|
||||||
|
|
||||||
@@ -120,9 +128,8 @@ def patch_init():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise PatchError("Unable to clean patches from tree:\n"+str(sys.exc_value))
|
raise PatchError("Unable to clean patches from tree:\n"+str(sys.exc_value))
|
||||||
except OSError:
|
except NotFoundError:
|
||||||
if str(sys.exc_value).startswith('OSError: [Errno 2]'):
|
pass
|
||||||
pass
|
|
||||||
runcmd(["rm", "-rf", os.path.join(self.dir, "patches"), os.path.join(self.dir, ".pc")])
|
runcmd(["rm", "-rf", os.path.join(self.dir, "patches"), os.path.join(self.dir, ".pc")])
|
||||||
self.initialized = True
|
self.initialized = True
|
||||||
|
|
||||||
@@ -311,6 +318,8 @@ def patch_init():
|
|||||||
g["QuiltTree"] = QuiltTree
|
g["QuiltTree"] = QuiltTree
|
||||||
g["Resolver"] = Resolver
|
g["Resolver"] = Resolver
|
||||||
g["UserResolver"] = UserResolver
|
g["UserResolver"] = UserResolver
|
||||||
|
g["NotFoundError"] = NotFoundError
|
||||||
|
g["CmdError"] = CmdError
|
||||||
|
|
||||||
addtask patch after do_unpack
|
addtask patch after do_unpack
|
||||||
do_patch[dirs] = "${WORKDIR}"
|
do_patch[dirs] = "${WORKDIR}"
|
||||||
@@ -400,6 +409,10 @@ python base_do_patch() {
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
bb.note("Applying patch '%s'" % pname)
|
bb.note("Applying patch '%s'" % pname)
|
||||||
patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
|
try:
|
||||||
|
patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
|
||||||
|
except NotFoundError:
|
||||||
|
import sys
|
||||||
|
raise bb.build.FuncFailed(str(sys.exc_value))
|
||||||
resolver.Resolve()
|
resolver.Resolve()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user