Skip to contentSkip to conversation

terminal.py: add tmux new window option

PATCH In review Dan McGregor 4 participants 6 messages Feb 4, 2015 – Feb 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 terminal.py: add tmux new window option

From: Dan McGregor <[email protected]>

Add a new terminal type that makes a new window in the running tmux session instead of splitting the window. 80x25 is not enough to run menuconfig inside a split window, so add the option to create a new window instead.

Use the new window option by default when the split window would be less than 19 lines high.

---
 meta/lib/oe/terminal.py | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
meta/lib/oe/terminal.py +35 -0
index 17d0904..54e3ffc 100644
@@ -116,6 +116,24 @@ class TmuxRunning(Terminal):
         if not os.getenv('TMUX'):
             raise UnsupportedTerminal('tmux is not running')
 
+        if not check_tmux_pane_size('tmux'):
+            raise UnsupportedTerminal('tmux pane too small')
+
+        Terminal.__init__(self, sh_cmd, title, env, d)
+
+class TmuxNewWindow(Terminal):
+    """Open a new window in the current running tmux session"""
+    name = 'tmux-new-window'
+    command = 'tmux new-window -n "{title}" "{command}"'
+    priority = 2.70
+
+    def __init__(self, sh_cmd, title=None, env=None, d=None):
+        if not bb.utils.which(os.getenv('PATH'), 'tmux'):
+            raise UnsupportedTerminal('tmux is not installed')
+
+        if not os.getenv('TMUX'):
+            raise UnsupportedTerminal('tmux is not running')
+
         Terminal.__init__(self, sh_cmd, title, env, d)
 
 class Tmux(Terminal):
@@ -184,6 +202,23 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
     if pipe.returncode != 0:
         raise ExecutionError(sh_cmd, pipe.returncode, output)
 
+def check_tmux_pane_size(tmux):
+    import subprocess as sub
+    try:
+        p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux,
+                shell=True,stdout=sub.PIPE,stderr=sub.PIPE)
+        out, err = p.communicate()
+        size = int(out.strip())
+    except OSError as exc:
+        import errno
+        if exc.errno == errno.ENOENT:
+            return None
+        else:
+            raise
+    if size/2 >= 19:
+        return True
+    return False
+
 def check_konsole_version(konsole):
     import subprocess as sub
     try:
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 openssh: Fix non-deterministic build behaviour

From: Dan McGregor <[email protected]>

If maillock.h is found, a dependency on liblockfile will be created. liblockfile is in meta-oe, so we don't want that in an oe-core recipe.

---
 meta/recipes-connectivity/openssh/openssh_6.7p1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-connectivity/openssh/openssh_6.7p1.bb +3 -0
index dcbc181..a272629 100644
@@ -62,6 +62,9 @@ CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no
 # passwd path is hardcoded in sshd
 CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
 
+# We don't want to depend on libblockfile
+CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
+
 # This is a workaround for uclibc because including stdio.h
 # pulls in pthreads.h and causes conflicts in function prototypes.
 # This results in compilation failure, so unless this is fixed,
Signature · 1 line
2.1.0
#2 lore raw

Re: [PATCH 2/2] openssh: Fix non-deterministic build behaviour

Quoted 21 lines · Dan McGregor

From: Dan McGregor <[email protected]>

If maillock.h is found, a dependency on liblockfile will be created. liblockfile is in meta-oe, so we don't want that in an oe-core recipe.

---
meta/recipes-connectivity/openssh/openssh_6.7p1.bb | 3 +++

1 file changed, 3 insertions(+)
meta/recipes-connectivity/openssh/openssh_6.7p1.bb +0 -0
index dcbc181..a272629 100644
@@ -62,6 +62,9 @@ CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no
 # passwd path is hardcoded in sshd

CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"

meta/recipes-connectivity/openssh/openssh_6.7p1.bb

Quoted 2 lines
meta/recipes-connectivity/openssh/openssh_6.7p1.bb +2 -0
+# We don't want to depend on libblockfile
+CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no”

while this is improvement. It would be nice if it was turning into a PACKAGECONFIG.

Quoted 13 lines

+

# This is a workaround for uclibc because including stdio.h

# pulls in pthreads.h and causes conflicts in function prototypes.
# This results in compilation failure, so unless this is fixed,
Signature · 7 lines
2.1.0

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#3 lore raw

Re: [PATCH 2/2] openssh: Fix non-deterministic build behaviour

In reply to Dan McGregor
Quoted 21 lines · Dan McGregor

From: Dan McGregor <[email protected]>

If maillock.h is found, a dependency on liblockfile will be created. liblockfile is in meta-oe, so we don't want that in an oe-core recipe.

---
 meta/recipes-connectivity/openssh/openssh_6.7p1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-connectivity/openssh/openssh_6.7p1.bb +0 -0
index dcbc181..a272629 100644
@@ -62,6 +62,9 @@ CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no

ac_cv_header_libutil_h=no

 # passwd path is hardcoded in sshd
 CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"

meta/recipes-connectivity/openssh/openssh_6.7p1.bb CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no · line 67

Quoted 3 lines
meta/recipes-connectivity/openssh/openssh_6.7p1.bb +3 -0
+# We don't want to depend on libblockfile
+CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
+

I wonder if this should be a PACKAGECONFIG. Most optional dependencies tend to be.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#4 lore raw
In reply to Dan McGregor
Quoted 5 lines · Dan McGregor

Add a new terminal type that makes a new window in the running tmux session instead of splitting the window. 80x25 is not enough to run menuconfig inside a split window, so add the option to create a new window instead.

Is there an argument for just using a new window always, splitting seems a bit weird to me. My terminals are the size I like them to be, and having have a terminal just for devshell seems lame.

(occasional tmux user but never beyond simply leaving jobs running)

Ross

#5 lore raw
Quoted 9 lines · Ross
Quoted 5 lines · Dan McGregor

Add a new terminal type that makes a new window in the running tmux session instead of splitting the window. 80x25 is not enough to run menuconfig inside a split window, so add the option to create a new window instead.

Quoted 6 lines

Is there an argument for just using a new window always, splitting seems a bit weird to me. My terminals are the size I like them to be, and having have a terminal just for devshell seems lame.

(occasional tmux user but never beyond simply leaving jobs running)

With this change setting OE_TERMINAL = "tmux-new-window" in your configuration will always launch a new terminal. I just left splitting as the default because it's the current behaviour; I've been using only new windows for over a year personally.

I don't really see a reason for keeping the splitting behaviour, but I imagine that others might not like it magically changing on them.

Quoted 1 line

Ross