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>
This commit is contained in:
parent
3b856e1cdf
commit
9d1f10ed01
|
@ -5,6 +5,8 @@ QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc"
|
||||||
|
|
||||||
PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
|
PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
|
||||||
|
|
||||||
|
inherit terminal
|
||||||
|
|
||||||
python patch_do_patch() {
|
python patch_do_patch() {
|
||||||
import oe.patch
|
import oe.patch
|
||||||
|
|
||||||
|
@ -124,7 +126,7 @@ python patch_do_patch() {
|
||||||
|
|
||||||
if not patchdir in classes:
|
if not patchdir in classes:
|
||||||
patchset = cls(patchdir, d)
|
patchset = cls(patchdir, d)
|
||||||
resolver = rcls(patchset)
|
resolver = rcls(patchset, oe_terminal)
|
||||||
classes[patchdir] = (patchset, resolver)
|
classes[patchdir] = (patchset, resolver)
|
||||||
patchset.Clean()
|
patchset.Clean()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -311,7 +311,7 @@ class QuiltTree(PatchSet):
|
||||||
self._runcmd(args)
|
self._runcmd(args)
|
||||||
|
|
||||||
class Resolver(object):
|
class Resolver(object):
|
||||||
def __init__(self, patchset):
|
def __init__(self, patchset, terminal):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def Resolve(self):
|
def Resolve(self):
|
||||||
|
@ -324,8 +324,9 @@ class Resolver(object):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
class NOOPResolver(Resolver):
|
class NOOPResolver(Resolver):
|
||||||
def __init__(self, patchset):
|
def __init__(self, patchset, terminal):
|
||||||
self.patchset = patchset
|
self.patchset = patchset
|
||||||
|
self.terminal = terminal
|
||||||
|
|
||||||
def Resolve(self):
|
def Resolve(self):
|
||||||
olddir = os.path.abspath(os.curdir)
|
olddir = os.path.abspath(os.curdir)
|
||||||
|
@ -341,13 +342,13 @@ class NOOPResolver(Resolver):
|
||||||
# resolution, with the exception of refreshing the remote copy of the patch
|
# resolution, with the exception of refreshing the remote copy of the patch
|
||||||
# files (the urls).
|
# files (the urls).
|
||||||
class UserResolver(Resolver):
|
class UserResolver(Resolver):
|
||||||
def __init__(self, patchset):
|
def __init__(self, patchset, terminal):
|
||||||
self.patchset = patchset
|
self.patchset = patchset
|
||||||
|
self.terminal = terminal
|
||||||
|
|
||||||
# Force a push in the patchset, then drop to a shell for the user to
|
# Force a push in the patchset, then drop to a shell for the user to
|
||||||
# resolve any rejected hunks
|
# resolve any rejected hunks
|
||||||
def Resolve(self):
|
def Resolve(self):
|
||||||
|
|
||||||
olddir = os.path.abspath(os.curdir)
|
olddir = os.path.abspath(os.curdir)
|
||||||
os.chdir(self.patchset.dir)
|
os.chdir(self.patchset.dir)
|
||||||
try:
|
try:
|
||||||
|
@ -368,16 +369,10 @@ class UserResolver(Resolver):
|
||||||
f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n")
|
f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n")
|
||||||
f.write("echo ''\n")
|
f.write("echo ''\n")
|
||||||
f.write(" ".join(patchcmd) + "\n")
|
f.write(" ".join(patchcmd) + "\n")
|
||||||
f.write("#" + bb.data.getVar('TERMCMDRUN', self.patchset.d, 1))
|
|
||||||
f.close()
|
f.close()
|
||||||
os.chmod(rcfile, 0775)
|
os.chmod(rcfile, 0775)
|
||||||
|
|
||||||
os.environ['TERMWINDOWTITLE'] = "Bitbake: Please fix patch rejects manually"
|
self.terminal("bash --rcfile " + rcfile, 'Patch Rejects: Please fix patch rejects manually', self.patchset.d)
|
||||||
os.environ['SHELLCMDS'] = "bash --rcfile " + rcfile
|
|
||||||
rc = os.system(bb.data.getVar('TERMCMDRUN', self.patchset.d, 1))
|
|
||||||
if os.WIFEXITED(rc) and os.WEXITSTATUS(rc) != 0:
|
|
||||||
bb.msg.fatal("Build", ("Cannot proceed with manual patch resolution - '%s' not found. " \
|
|
||||||
+ "Check TERMCMDRUN variable.") % bb.data.getVar('TERMCMDRUN', self.patchset.d, 1))
|
|
||||||
|
|
||||||
# Construct a new PatchSet after the user's changes, compare the
|
# Construct a new PatchSet after the user's changes, compare the
|
||||||
# sets, checking patches for modifications, and doing a remote
|
# sets, checking patches for modifications, and doing a remote
|
||||||
|
|
Loading…
Reference in New Issue