public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment
@ 2013-12-29  2:55 W. Trevor King
  2013-12-31 10:09 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: W. Trevor King @ 2013-12-29  2:55 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

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/
---
 modules/generic_target.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/generic_target.py b/modules/generic_target.py
index fe96bd7..30dadc8 100644
--- a/modules/generic_target.py
+++ b/modules/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'),
+			}
-- 
1.8.3.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment
  2013-12-29  2:55 [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment W. Trevor King
@ 2013-12-31 10:09 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2013-12-31 10:09 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 1845 bytes --]

On Sat, 2013-12-28 at 18:55 -0800, W. Trevor King wrote:
> From: "W. Trevor King" <wking@tremily.us>
> 
> 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/
> ---
>  modules/generic_target.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/generic_target.py b/modules/generic_target.py
> index fe96bd7..30dadc8 100644
> --- a/modules/generic_target.py
> +++ b/modules/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'),
> +			}

Hand applied to the 3.0 branch.  Works like a charm :)

Also will be pushed in the morning after a bit more testing which is in
progress.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-31 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29  2:55 [gentoo-catalyst] [PATCH] modules/generic_target.py: Pass TERM through to the chroot environment W. Trevor King
2013-12-31 10:09 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox