diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-03 22:00:55 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-04 17:05:32 +0000 |
| commit | 9d1f10ed012de6976141a29ba483e0b96781fe28 (patch) | |
| tree | 9f49f1c01bb2d97aa000aaa50019ad471207450d /meta | |
| parent | 3b856e1cdf38705f1ae79df09e7e6f388673a683 (diff) | |
| download | poky-9d1f10ed012de6976141a29ba483e0b96781fe28.tar.gz | |
patch: Convert to use oe_terminal
Unfortunately we can't access oe_terminal directly from patch.py
so we have to pass in the correct terminal function pointer.
[YOCTO #1587]
(From OE-Core rev: 9e0a21dda24f285a1c4878488e887485a749f3f2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes/patch.bbclass | 4 | ||||
| -rw-r--r-- | meta/lib/oe/patch.py | 17 |
2 files changed, 9 insertions, 12 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index 762216345a..86046e1ff8 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass | |||
| @@ -5,6 +5,8 @@ QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc" | |||
| 5 | 5 | ||
| 6 | PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot" | 6 | PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot" |
| 7 | 7 | ||
| 8 | inherit terminal | ||
| 9 | |||
| 8 | python patch_do_patch() { | 10 | python patch_do_patch() { |
| 9 | import oe.patch | 11 | import oe.patch |
| 10 | 12 | ||
| @@ -124,7 +126,7 @@ python patch_do_patch() { | |||
| 124 | 126 | ||
| 125 | if not patchdir in classes: | 127 | if not patchdir in classes: |
| 126 | patchset = cls(patchdir, d) | 128 | patchset = cls(patchdir, d) |
| 127 | resolver = rcls(patchset) | 129 | resolver = rcls(patchset, oe_terminal) |
| 128 | classes[patchdir] = (patchset, resolver) | 130 | classes[patchdir] = (patchset, resolver) |
| 129 | patchset.Clean() | 131 | patchset.Clean() |
| 130 | else: | 132 | else: |
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 9768be077f..75fb91e0fb 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
| @@ -311,7 +311,7 @@ class QuiltTree(PatchSet): | |||
| 311 | self._runcmd(args) | 311 | self._runcmd(args) |
| 312 | 312 | ||
| 313 | class Resolver(object): | 313 | class Resolver(object): |
| 314 | def __init__(self, patchset): | 314 | def __init__(self, patchset, terminal): |
| 315 | raise NotImplementedError() | 315 | raise NotImplementedError() |
| 316 | 316 | ||
| 317 | def Resolve(self): | 317 | def Resolve(self): |
| @@ -324,8 +324,9 @@ class Resolver(object): | |||
| 324 | raise NotImplementedError() | 324 | raise NotImplementedError() |
| 325 | 325 | ||
| 326 | class NOOPResolver(Resolver): | 326 | class NOOPResolver(Resolver): |
| 327 | def __init__(self, patchset): | 327 | def __init__(self, patchset, terminal): |
| 328 | self.patchset = patchset | 328 | self.patchset = patchset |
| 329 | self.terminal = terminal | ||
| 329 | 330 | ||
| 330 | def Resolve(self): | 331 | def Resolve(self): |
| 331 | olddir = os.path.abspath(os.curdir) | 332 | olddir = os.path.abspath(os.curdir) |
| @@ -341,13 +342,13 @@ class NOOPResolver(Resolver): | |||
| 341 | # resolution, with the exception of refreshing the remote copy of the patch | 342 | # resolution, with the exception of refreshing the remote copy of the patch |
| 342 | # files (the urls). | 343 | # files (the urls). |
| 343 | class UserResolver(Resolver): | 344 | class UserResolver(Resolver): |
| 344 | def __init__(self, patchset): | 345 | def __init__(self, patchset, terminal): |
| 345 | self.patchset = patchset | 346 | self.patchset = patchset |
| 347 | self.terminal = terminal | ||
| 346 | 348 | ||
| 347 | # Force a push in the patchset, then drop to a shell for the user to | 349 | # Force a push in the patchset, then drop to a shell for the user to |
| 348 | # resolve any rejected hunks | 350 | # resolve any rejected hunks |
| 349 | def Resolve(self): | 351 | def Resolve(self): |
| 350 | |||
| 351 | olddir = os.path.abspath(os.curdir) | 352 | olddir = os.path.abspath(os.curdir) |
| 352 | os.chdir(self.patchset.dir) | 353 | os.chdir(self.patchset.dir) |
| 353 | try: | 354 | try: |
| @@ -368,16 +369,10 @@ class UserResolver(Resolver): | |||
| 368 | f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n") | 369 | f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n") |
| 369 | f.write("echo ''\n") | 370 | f.write("echo ''\n") |
| 370 | f.write(" ".join(patchcmd) + "\n") | 371 | f.write(" ".join(patchcmd) + "\n") |
| 371 | f.write("#" + bb.data.getVar('TERMCMDRUN', self.patchset.d, 1)) | ||
| 372 | f.close() | 372 | f.close() |
| 373 | os.chmod(rcfile, 0775) | 373 | os.chmod(rcfile, 0775) |
| 374 | 374 | ||
| 375 | os.environ['TERMWINDOWTITLE'] = "Bitbake: Please fix patch rejects manually" | 375 | self.terminal("bash --rcfile " + rcfile, 'Patch Rejects: Please fix patch rejects manually', self.patchset.d) |
| 376 | os.environ['SHELLCMDS'] = "bash --rcfile " + rcfile | ||
| 377 | rc = os.system(bb.data.getVar('TERMCMDRUN', self.patchset.d, 1)) | ||
| 378 | if os.WIFEXITED(rc) and os.WEXITSTATUS(rc) != 0: | ||
| 379 | bb.msg.fatal("Build", ("Cannot proceed with manual patch resolution - '%s' not found. " \ | ||
| 380 | + "Check TERMCMDRUN variable.") % bb.data.getVar('TERMCMDRUN', self.patchset.d, 1)) | ||
| 381 | 376 | ||
| 382 | # Construct a new PatchSet after the user's changes, compare the | 377 | # Construct a new PatchSet after the user's changes, compare the |
| 383 | # sets, checking patches for modifications, and doing a remote | 378 | # sets, checking patches for modifications, and doing a remote |
