commit:     c6fe2266fd2355d6a15f95b1b6c4f8f40a309214
Author:     W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 22 18:01:29 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=c6fe2266

catalyst/targets/generic_target.py: Pass TERM through to the chroot

Avoid:

  Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
  tput: No value for $TERM and no -T specified

by passing the caller's TERM environment variable [1] through to the
chroot.  If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable.  On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2].  You can list supported terminals with toe, which is also
distributed with ncurses [2]:

  $ toe
  ansi            ansi/pc-term compatible with color
  dumb            80-column dumb tty
  linux           linux console
  ...

[1]: 
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/

---
 catalyst/targets/generic_target.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/catalyst/targets/generic_target.py 
b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
 from catalyst.support import *
 
 class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
        def __init__(self,myspec,addlargs):
                
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
                self.settings=myspec
-               self.env={}
-               self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+               self.env = {
+                       'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+                       'TERM': os.getenv('TERM', 'dumb'),
+                       }

Reply via email to