diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-09-03 22:22:10 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-09-03 22:22:10 +0100 |
commit | 43fa53c9f3933391a323d4bc6d26b88b750bafeb (patch) | |
tree | 891a8710080e86f595edb776f4fd2f47fbd7166d /meta/classes/patch.bbclass | |
parent | 0deeea4f9003177a1b64bb505a405d6367869e49 (diff) | |
download | poky-43fa53c9f3933391a323d4bc6d26b88b750bafeb.tar.gz |
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>
Diffstat (limited to 'meta/classes/patch.bbclass')
-rw-r--r-- | meta/classes/patch.bbclass | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index 609e1a1415..ba0f19215d 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass | |||
@@ -187,6 +187,24 @@ def patch_init(d): | |||
187 | def Clean(self): | 187 | def Clean(self): |
188 | """""" | 188 | """""" |
189 | 189 | ||
190 | class GitApplyTree(PatchTree): | ||
191 | def __init__(self, dir, d): | ||
192 | PatchTree.__init__(self, dir, d) | ||
193 | |||
194 | def _applypatch(self, patch, force = False, reverse = False, run = True): | ||
195 | shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']] | ||
196 | |||
197 | if reverse: | ||
198 | shellcmd.append('-R') | ||
199 | |||
200 | shellcmd.append(patch['file']) | ||
201 | |||
202 | if not run: | ||
203 | return "sh" + "-c" + " ".join(shellcmd) | ||
204 | |||
205 | return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) | ||
206 | |||
207 | |||
190 | class QuiltTree(PatchSet): | 208 | class QuiltTree(PatchSet): |
191 | def _runcmd(self, args, run = True): | 209 | def _runcmd(self, args, run = True): |
192 | quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) | 210 | quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) |
@@ -425,6 +443,7 @@ def patch_init(d): | |||
425 | g["PatchSet"] = PatchSet | 443 | g["PatchSet"] = PatchSet |
426 | g["PatchTree"] = PatchTree | 444 | g["PatchTree"] = PatchTree |
427 | g["QuiltTree"] = QuiltTree | 445 | g["QuiltTree"] = QuiltTree |
446 | g["GitApplyTree"] = GitApplyTree | ||
428 | g["Resolver"] = Resolver | 447 | g["Resolver"] = Resolver |
429 | g["UserResolver"] = UserResolver | 448 | g["UserResolver"] = UserResolver |
430 | g["NOOPResolver"] = NOOPResolver | 449 | g["NOOPResolver"] = NOOPResolver |
@@ -451,6 +470,7 @@ python patch_do_patch() { | |||
451 | patchsetmap = { | 470 | patchsetmap = { |
452 | "patch": PatchTree, | 471 | "patch": PatchTree, |
453 | "quilt": QuiltTree, | 472 | "quilt": QuiltTree, |
473 | "git": GitApplyTree, | ||
454 | } | 474 | } |
455 | 475 | ||
456 | cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] | 476 | cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] |
@@ -544,12 +564,8 @@ python patch_do_patch() { | |||
544 | bb.note("Applying patch '%s'" % pname) | 564 | bb.note("Applying patch '%s'" % pname) |
545 | try: | 565 | try: |
546 | patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) | 566 | patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) |
547 | except NotFoundError: | ||
548 | import sys | ||
549 | raise bb.build.FuncFailed(str(sys.exc_value)) | ||
550 | try: | ||
551 | resolver.Resolve() | 567 | resolver.Resolve() |
552 | except PatchError: | 568 | except: |
553 | import sys | 569 | import sys |
554 | raise bb.build.FuncFailed(str(sys.exc_value)) | 570 | raise bb.build.FuncFailed(str(sys.exc_value)) |
555 | } | 571 | } |