public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Globally disabling colour
@ 2019-10-01 11:28 Dr Rainer Woitok
  2019-10-01 11:32 ` Arve Barsnes
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dr Rainer Woitok @ 2019-10-01 11:28 UTC (permalink / raw
  To: gentoo-user

Greetings,

having freshly erm ... converted from Ubuntu to Gentoo and thus being an
absolute Gentoo newbie  I'm desparately looking  for a way to get rid of
all the colour in the output  produced by "emerge"  but also by "qlist",
"eix", "e-file" and so on.

Is there a way to globally configure this for all these commands?   I've
already added  'NOCLOR="false"'  to my "make.conf" file but this doesn't
seem to do the trick.  Do I really have to remember for each call to one
of these commands to disable colour individually and in addition have to
remember what's the correct "nocolor" option for the command at hand?

Any pointers welcome ... :-)

Sincerely,
  Rainer


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

* Re: [gentoo-user] Globally disabling colour
  2019-10-01 11:28 [gentoo-user] Globally disabling colour Dr Rainer Woitok
@ 2019-10-01 11:32 ` Arve Barsnes
  2019-10-01 11:42 ` Mick
  2019-10-01 14:07 ` Håkon Alstadheim
  2 siblings, 0 replies; 10+ messages in thread
From: Arve Barsnes @ 2019-10-01 11:32 UTC (permalink / raw
  To: Gentoo

On Tue, 1 Oct 2019 at 13:28, Dr Rainer Woitok <rainer.woitok@gmail.com> wrote:
> having freshly erm ... converted from Ubuntu to Gentoo and thus being an
> absolute Gentoo newbie  I'm desparately looking  for a way to get rid of
> all the colour in the output  produced by "emerge"  but also by "qlist",
> "eix", "e-file" and so on.
>
> Is there a way to globally configure this for all these commands?   I've
> already added  'NOCLOR="false"'  to my "make.conf" file but this doesn't
> seem to do the trick.  Do I really have to remember for each call to one
> of these commands to disable colour individually and in addition have to
> remember what's the correct "nocolor" option for the command at hand?

There was a similar question from someone else this summer, maybe this
will help you.

https://archives.gentoo.org/gentoo-user/message/e0528fd2b468b350aac9ff440f132683

Regards,
Arve


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

* Re: [gentoo-user] Globally disabling colour
  2019-10-01 11:28 [gentoo-user] Globally disabling colour Dr Rainer Woitok
  2019-10-01 11:32 ` Arve Barsnes
@ 2019-10-01 11:42 ` Mick
  2019-10-01 14:07 ` Håkon Alstadheim
  2 siblings, 0 replies; 10+ messages in thread
From: Mick @ 2019-10-01 11:42 UTC (permalink / raw
  To: gentoo-user

On Tue, 1 Oct 2019 at 12:29, Dr Rainer Woitok <rainer.woitok@gmail.com> wrote:
>
> Greetings,
>
> having freshly erm ... converted from Ubuntu to Gentoo and thus being an
> absolute Gentoo newbie  I'm desparately looking  for a way to get rid of
> all the colour in the output  produced by "emerge"  but also by "qlist",
> "eix", "e-file" and so on.
>
> Is there a way to globally configure this for all these commands?   I've
> already added  'NOCLOR="false"'  to my "make.conf" file but this doesn't
> seem to do the trick.

I don't know if you have misspelled the above parameter.  Try setting:

NOCOLOR="true"

However, terminal colors are set differently - see thread mentioned by Arve.
-- 
Regards,
Mick


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

* Re: [gentoo-user] Globally disabling colour
  2019-10-01 11:28 [gentoo-user] Globally disabling colour Dr Rainer Woitok
  2019-10-01 11:32 ` Arve Barsnes
  2019-10-01 11:42 ` Mick
@ 2019-10-01 14:07 ` Håkon Alstadheim
  2019-10-02  9:01   ` Dr Rainer Woitok
  2020-01-05 12:06   ` Dr Rainer Woitok
  2 siblings, 2 replies; 10+ messages in thread
From: Håkon Alstadheim @ 2019-10-01 14:07 UTC (permalink / raw
  To: gentoo-user


Den 01.10.2019 13:28, skrev Dr Rainer Woitok:
> Greetings,
>
> having freshly erm ... converted from Ubuntu to Gentoo and thus being an
> absolute Gentoo newbie  I'm desparately looking  for a way to get rid of
> all the colour in the output  produced by "emerge"  but also by "qlist",
> "eix", "e-file" and so on.
>
> Is there a way to globally configure this for all these commands?   I've
> already added  'NOCLOR="false"'  to my "make.conf" file but this doesn't
> seem to do the trick.  Do I really have to remember for each call to one
> of these commands to disable colour individually and in addition have to
> remember what's the correct "nocolor" option for the command at hand?
>
> Any pointers welcome ... :-)

I've got this in make.conf, which gets me part-way there:

CMAKE_COLOR_MAKEFILE=OFF
NOCOLOR="true"
GCC_COLORS=""

I've also got this in /usr/local/bin/rustc and symlinked to 
/usr/local/bin/cargo:

----/usr/local/bin/rustc:----#!/usr/bin/perlmy @newargs=();my $skipnext=0;my $me=$0;$me =~ 
s(.*\/)();push @newargs, "--color";push @newargs, "never";foreach $arg 
(@ARGV) {    if($arg eq "--color"){    $skipnext =1;    } 
elsif($skipnext == 1){    $skipnext = 0;    } else { # any arg EXCEPT 
color gets passed along verbatim     push @newargs, $arg    
}}exec("/usr/bin/${me}",@newargs);
---

This last trick could probably be used for other commands as well 
(modulo specific argument)




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

* Re: [gentoo-user] Globally disabling colour
  2019-10-01 14:07 ` Håkon Alstadheim
@ 2019-10-02  9:01   ` Dr Rainer Woitok
  2019-10-02 14:50     ` Håkon Alstadheim
  2020-01-05 12:06   ` Dr Rainer Woitok
  1 sibling, 1 reply; 10+ messages in thread
From: Dr Rainer Woitok @ 2019-10-02  9:01 UTC (permalink / raw
  To: gentoo-user; +Cc: hakon

Hakon,

On Tuesday, 2019-10-01 16:07:55 +0200, you wrote:

> ...
> I've got this in make.conf, which gets me part-way there:
> 
> CMAKE_COLOR_MAKEFILE=OFF
> NOCOLOR="true"
> GCC_COLORS=""

I already had the  "NOCOLOR" environment variable set  (there was a typo
in my mail, not in my "make.conf" file :-),  but the Cmake and Gcc spec-
ific environment variables were not yet there.  Thankyou for this tip.

> I've also got this in /usr/local/bin/rustc and symlinked to 
> /usr/local/bin/cargo:

This assumes "/usr/local/bin" to precede "/usr/bin" in environment vari-
able "PATH".  Can I set this for Portage only in "make.conf"?

> ----/usr/local/bin/rustc:----#!/usr/bin/perlmy @newargs=();my $skipnext=0;my $me=$0;$me =~ 
> s(.*\/)();push @newargs, "--color";push @newargs, "never";foreach $arg 
> (@ARGV) {    if($arg eq "--color"){    $skipnext =1;    } 
> elsif($skipnext == 1){    $skipnext = 0;    } else { # any arg EXCEPT 
> color gets passed along verbatim     push @newargs, $arg    
> }}exec("/usr/bin/${me}",@newargs);
> ---

Alas,  this code snippet did not survive  mail transmission :-(.   Could
you please run

   perl -MMIME::Base64 -ne 'print encode_base64($_)' < /usr/local/bin/rustc

and post (or send me privately) the base64 encoded output?  Thankyou.

Sincerely,
  Rainer


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

* Re: [gentoo-user] Globally disabling colour
  2019-10-02  9:01   ` Dr Rainer Woitok
@ 2019-10-02 14:50     ` Håkon Alstadheim
  0 siblings, 0 replies; 10+ messages in thread
From: Håkon Alstadheim @ 2019-10-02 14:50 UTC (permalink / raw
  To: Dr Rainer Woitok, gentoo-user

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


Den 02.10.2019 11:01, skrev Dr Rainer Woitok:
> Hakon,
>
> On Tuesday, 2019-10-01 16:07:55 +0200, you wrote:
>
>> ...
>> I've got this in make.conf, which gets me part-way there:
>>
>> CMAKE_COLOR_MAKEFILE=OFF
>> NOCOLOR="true"
>> GCC_COLORS=""
> I already had the  "NOCOLOR" environment variable set  (there was a typo
> in my mail, not in my "make.conf" file :-),  but the Cmake and Gcc spec-
> ific environment variables were not yet there.  Thankyou for this tip.
>
>> I've also got this in /usr/local/bin/rustc and symlinked to
>> /usr/local/bin/cargo:
> This assumes "/usr/local/bin" to precede "/usr/bin" in environment vari-
> able "PATH".  Can I set this for Portage only in "make.conf"?
Correct.
>> ----/usr/local/bin/rustc:----#!/usr/bin/perlmy @newargs=();my $skipnext=0;my $me=$0;$me =~
>> s(.*\/)();push @newargs, "--color";push @newargs, "never";foreach $arg
>> (@ARGV) {    if($arg eq "--color"){    $skipnext =1;    }
>> elsif($skipnext == 1){    $skipnext = 0;    } else { # any arg EXCEPT
>> color gets passed along verbatim     push @newargs, $arg  Â
>> }}exec("/usr/bin/${me}",@newargs);
>> ---
> Alas,  this code snippet did not survive  mail transmission :-(.   Could
> you please run
>
>     perl -MMIME::Base64 -ne 'print encode_base64($_)' < /usr/local/bin/rustc
>
> and post (or send me privately) the base64 encoded output?  Thankyou.
>
> Sincerely,
>    Rainer

Just doing an attachment, so you'll get the charset as well. Don't know 
if that gets through to the list.



[-- Attachment #2: rustc --]
[-- Type: text/plain, Size: 456 bytes --]

#!/usr/bin/perl
my @newargs=();
my $skipnext=0;
my $me=$0;
$me =~ s(.*\/)();
#print STDERR "$me\n";
push @newargs, "--color";
push @newargs, "never";
foreach $arg (@ARGV) {
    if($arg eq "--color"){
	$skipnext =1;
    } elsif($skipnext == 1){
	$skipnext = 0;
    } else {
	push @newargs, $arg
    }
#    print STDERR "$arg\n";
}
exec("/usr/bin/${me}",@newargs);
#foreach $arg (@newargs) {
#    print STDERR "$arg\n";
#}
#exit 0;
#exec /usr/bin/rustc "$@"

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

* Re: [gentoo-user] Globally disabling colour
  2019-10-01 14:07 ` Håkon Alstadheim
  2019-10-02  9:01   ` Dr Rainer Woitok
@ 2020-01-05 12:06   ` Dr Rainer Woitok
  2020-01-05 12:17     ` Robert Bridge
  1 sibling, 1 reply; 10+ messages in thread
From: Dr Rainer Woitok @ 2020-01-05 12:06 UTC (permalink / raw
  To: gentoo-user

Greetings and a Happy New Year to all of you :-)

Way back on Tuesday, 2019-10-01 16:07:55 +0200, Håkon Alstadheim wrote:

> Den 01.10.2019 13:28, skrev Dr Rainer Woitok:
> > ...
> >                         I'm desparately looking  for a way to get rid of
> > all the colour in the output  produced by "emerge"  but also by "qlist",
> > "eix", "e-file" and so on.
> > ...
> ...
> I've also got this in /usr/local/bin/rustc and symlinked to 
> /usr/local/bin/cargo:
> 
> ----/usr/local/bin/rustc:----
> #!/usr/bin/perl
> my @newargs=();
> my $skipnext=0;
> my $me=$0;
> $me =~ s(.*\/)();
> push @newargs, "--color";
> push @newargs, "never";
> foreach $arg (@ARGV) {
>     if($arg eq "--color"){
> 	$skipnext =1;
>     } elsif($skipnext == 1){
> 	$skipnext = 0;
>     } else {
> 	push @newargs, $arg
>     }
> }
> exec("/usr/bin/${me}",@newargs);

I've used this script ever since  (even though  I had to slightly modify
it when I learned that  "--color=yes"  is also a valid option  which was
not detected  by the original version).   However, yesterday I found the
following:

   error: cannot specify the `--color` option with `--json`

Regardless of whether this  was a change to "rustc"  or of whether up to
now none of my builds used "rustc" with "--json": the effort to keep the
script compatible  with the current versions  of "rustc" and "cargo" now
by far outweighs the nuisance of colour in build logs for me.  Of course
anybody else's milage  might vary,  but I think  anybody else using this
script should at least know.

It was a nice workaround, though.  Thankyou Hakon :-)

Sincerely,
  Rainer


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

* Re: [gentoo-user] Globally disabling colour
  2020-01-05 12:06   ` Dr Rainer Woitok
@ 2020-01-05 12:17     ` Robert Bridge
  2020-01-05 12:44       ` Dr Rainer Woitok
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Bridge @ 2020-01-05 12:17 UTC (permalink / raw
  To: gentoo-user

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

I had this issue many moons ago, which lead to my discovery of the
ansifilter package:

> # emerge -pv ansifilter | ansifilter
>
> These are the packages that would be merged, in order:
>
> Calculating dependencies  . ... done!
> [ebuild   R    ] app-text/ansifilter-2.15::gentoo  USE="qt5" 0 KiB
>
> Total: 1 package (1 reinstall), Size of downloads: 0 KiB

It strips all the terminal escape chars which are how applications do the
color in their terminal output. Very handy when combined with pastebin
utilities.

Cheers,
Robert.

>
>

[-- Attachment #2: Type: text/html, Size: 982 bytes --]

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

* Re: [gentoo-user] Globally disabling colour
  2020-01-05 12:17     ` Robert Bridge
@ 2020-01-05 12:44       ` Dr Rainer Woitok
  2020-01-05 13:02         ` Robert Bridge
  0 siblings, 1 reply; 10+ messages in thread
From: Dr Rainer Woitok @ 2020-01-05 12:44 UTC (permalink / raw
  To: gentoo-user

Robert,

On Sunday, 2020-01-05 12:17:23 +0000, you wrote:

> I had this issue many moons ago, which lead to my discovery of the
> ansifilter package:
> 
> > # emerge -pv ansifilter | ansifilter

Nice find.  However, this only produces a clean terminal window but does
not prevent all the garbage in "/var/log/portage/" :-\

Sincerely,
  Rainer


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

* Re: [gentoo-user] Globally disabling colour
  2020-01-05 12:44       ` Dr Rainer Woitok
@ 2020-01-05 13:02         ` Robert Bridge
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Bridge @ 2020-01-05 13:02 UTC (permalink / raw
  To: gentoo-user

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

But it can easily strip the garbage from that file when you need to use the
contents...

> # ansifilter /var/log/portage/elog/summary.log-20200105 | less

On Sun, 5 Jan 2020 at 12:45, Dr Rainer Woitok <rainer.woitok@gmail.com>
wrote:

> Robert,
>
> On Sunday, 2020-01-05 12:17:23 +0000, you wrote:
>
> > I had this issue many moons ago, which lead to my discovery of the
> > ansifilter package:
> >
> > > # emerge -pv ansifilter | ansifilter
>
> Nice find.  However, this only produces a clean terminal window but does
> not prevent all the garbage in "/var/log/portage/" :-\
>
> Sincerely,
>   Rainer
>
>

[-- Attachment #2: Type: text/html, Size: 1003 bytes --]

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

end of thread, other threads:[~2020-01-05 13:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01 11:28 [gentoo-user] Globally disabling colour Dr Rainer Woitok
2019-10-01 11:32 ` Arve Barsnes
2019-10-01 11:42 ` Mick
2019-10-01 14:07 ` Håkon Alstadheim
2019-10-02  9:01   ` Dr Rainer Woitok
2019-10-02 14:50     ` Håkon Alstadheim
2020-01-05 12:06   ` Dr Rainer Woitok
2020-01-05 12:17     ` Robert Bridge
2020-01-05 12:44       ` Dr Rainer Woitok
2020-01-05 13:02         ` Robert Bridge

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