All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] patch: Convert to use oe_terminal
Date: Thu, 03 Nov 2011 22:00:55 +0000	[thread overview]
Message-ID: <1320357655.20107.82.camel@ted> (raw)

Unfortunately we can't access oe_terminal directly from patch.py
so we have to pass in the correct terminal function pointer.

[YOCTO #1587]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 7622163..86046e1 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -5,6 +5,8 @@ QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc"
 
 PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
 
+inherit terminal
+
 python patch_do_patch() {
 	import oe.patch
 
@@ -124,7 +126,7 @@ python patch_do_patch() {
 
 		if not patchdir in classes:
 			patchset = cls(patchdir, d)
-			resolver = rcls(patchset)
+			resolver = rcls(patchset, oe_terminal)
 			classes[patchdir] = (patchset, resolver)
 			patchset.Clean()
 		else:
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 9768be0..75fb91e 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -311,7 +311,7 @@ class QuiltTree(PatchSet):
             self._runcmd(args)
 
 class Resolver(object):
-    def __init__(self, patchset):
+    def __init__(self, patchset, terminal):
         raise NotImplementedError()
 
     def Resolve(self):
@@ -324,8 +324,9 @@ class Resolver(object):
         raise NotImplementedError()
 
 class NOOPResolver(Resolver):
-    def __init__(self, patchset):
+    def __init__(self, patchset, terminal):
         self.patchset = patchset
+        self.terminal = terminal
 
     def Resolve(self):
         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
 # files (the urls).
 class UserResolver(Resolver):
-    def __init__(self, patchset):
+    def __init__(self, patchset, terminal):
         self.patchset = patchset
+        self.terminal = terminal
 
     # Force a push in the patchset, then drop to a shell for the user to
     # resolve any rejected hunks
     def Resolve(self):
-
         olddir = os.path.abspath(os.curdir)
         os.chdir(self.patchset.dir)
         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 ''\n")
             f.write(" ".join(patchcmd) + "\n")
-            f.write("#" + bb.data.getVar('TERMCMDRUN', self.patchset.d, 1))
             f.close()
             os.chmod(rcfile, 0775)
 
-            os.environ['TERMWINDOWTITLE'] = "Bitbake: Please fix patch rejects manually"
-            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))
+            self.terminal("bash --rcfile " + rcfile, 'Patch Rejects: Please fix patch rejects manually', self.patchset.d)
 
             # Construct a new PatchSet after the user's changes, compare the
             # sets, checking patches for modifications, and doing a remote





                 reply	other threads:[~2011-11-03 22:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320357655.20107.82.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.