patch.bbclass: Merge in git resolver changes from OE.dev. Catch all exceptions rather than print horrid backtraces

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Richard Purdie
2009-09-03 22:22:10 +01:00
parent 0deeea4f90
commit 43fa53c9f3

View File

@@ -187,6 +187,24 @@ def patch_init(d):
def Clean(self):
""""""
class GitApplyTree(PatchTree):
def __init__(self, dir, d):
PatchTree.__init__(self, dir, d)
def _applypatch(self, patch, force = False, reverse = False, run = True):
shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']]
if reverse:
shellcmd.append('-R')
shellcmd.append(patch['file'])
if not run:
return "sh" + "-c" + " ".join(shellcmd)
return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
class QuiltTree(PatchSet):
def _runcmd(self, args, run = True):
quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1)
@@ -425,6 +443,7 @@ def patch_init(d):
g["PatchSet"] = PatchSet
g["PatchTree"] = PatchTree
g["QuiltTree"] = QuiltTree
g["GitApplyTree"] = GitApplyTree
g["Resolver"] = Resolver
g["UserResolver"] = UserResolver
g["NOOPResolver"] = NOOPResolver
@@ -451,6 +470,7 @@ python patch_do_patch() {
patchsetmap = {
"patch": PatchTree,
"quilt": QuiltTree,
"git": GitApplyTree,
}
cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt']
@@ -544,12 +564,8 @@ python patch_do_patch() {
bb.note("Applying patch '%s'" % pname)
try:
patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
except NotFoundError:
import sys
raise bb.build.FuncFailed(str(sys.exc_value))
try:
resolver.Resolve()
except PatchError:
except:
import sys
raise bb.build.FuncFailed(str(sys.exc_value))
}