Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Logging emerge output
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sebest
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 163
Location: Paris - France

PostPosted: Tue Aug 06, 2002 4:40 pm    Post subject: Logging emerge output Reply with quote

I think it would be really usefull to have a log of the output of "merge".
Because when i emerge --update world, i can't read the einfo because of output of the compilation of the next package.

something like /var/log/emerge/PACKAGE_NAME/{info,compil,error}
info contains einfo output
compil contains compilations output
error contains the standard input errors
Back to top
View user's profile Send private message
ZagiFlyer
Tux's lil' helper
Tux's lil' helper


Joined: 19 Apr 2002
Posts: 93
Location: San Jose, CA

PostPosted: Tue Aug 06, 2002 9:06 pm    Post subject: Reply with quote

I would expect you can either 'emerge foo > foo.out' if you don't need to read the output in real-time. Or you can write to stdout and a file at the same time. I forget what the symbol is for that, it's in the bash man page. I'd look it up and tell you, but I'm at work on my Windows machine.
_________________
"Beer is proof that God loves us and wants us to be happy"

--Ben Franklin
Back to top
View user's profile Send private message
n0n
Guru
Guru


Joined: 13 Jun 2002
Posts: 355

PostPosted: Tue Aug 06, 2002 9:14 pm    Post subject: Reply with quote

(Most of the following assumes you're using bash, BTW)
Send output to a logfile:
Code:
emerge foo > foo.log

Send output to a logfile but still see it:
Code:
emerge foo | tee foo.log

Send all output (including any errors) to a logfile:
Code:
emerge foo >& foo.log

Send all output (including any errors) to a logfile but still see it:
Code:
emerge foo 2>&1 | tee foo.log

Send all output to one logfile and errors to another:
Code:
emerge foo >foo.log 2>foo-errors.log

Send all output to a logfile and then watch the logfile as it grows (hit Ctrl-C to exit out of the "tail" command):
Code:
emerge foo >& foo.log &
tail -f foo.log

Send all output to a logfile and then watch the logfile using a decent pager (when inside "less," hit capital "F" to "follow" the file as it grows, Ctrl-C to stop it from doing so):
Code:
emerge foo >& foo.log &
less foo.log
Back to top
View user's profile Send private message
ZagiFlyer
Tux's lil' helper
Tux's lil' helper


Joined: 19 Apr 2002
Posts: 93
Location: San Jose, CA

PostPosted: Tue Aug 06, 2002 9:16 pm    Post subject: Reply with quote

Wow. Ask and Ye Shall Receive!
_________________
"Beer is proof that God loves us and wants us to be happy"

--Ben Franklin
Back to top
View user's profile Send private message
sebest
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 163
Location: Paris - France

PostPosted: Tue Aug 06, 2002 10:06 pm    Post subject: Reply with quote

Thank you!

But i already know about all of this...

But it doesn't solve the problem of "einfo"

The usefull informations printed at the end of the emerge of a package.

example:
Code:

postfix/postfix-1.1.11.20020613.ebuild: einfo "***************************************************************"
postfix/postfix-1.1.11.20020613.ebuild: einfo "* NOTE: If config file protection is enabled and you upgraded *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "*       from an earlier version of postfix you must update    *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "*       /etc/postfix/master.cf to the latest version          *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "*       (/etc/postfix/._cfg????_master.cf). Otherwise postfix *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "*       will not work correctly.                              *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "***************************************************************"
postfix/postfix-1.1.11.20020613.ebuild: einfo "********************************************************"
postfix/postfix-1.1.11.20020613.ebuild: einfo "* First time installers: You must edit                 *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "* /etc/mail/aliases to suit your needs and then run    *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "* /usr/bin/newaliases. Postfix will not work correctly *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "* without it                                           *"
postfix/postfix-1.1.11.20020613.ebuild: einfo "********************************************************"


Should i
emerge --update world >& emerge.log
and then parse all the file to find the 5-10 lines that are usefull[/code]
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Tue Aug 06, 2002 10:18 pm    Post subject: Reply with quote

grep -i einfo emerge.log?
Back to top
View user's profile Send private message
puddpunk
l33t
l33t


Joined: 20 Jul 2002
Posts: 681
Location: New Zealand

PostPosted: Wed Aug 07, 2002 6:14 am    Post subject: . Reply with quote

Most einfos are preceded by a certain colour star.

You could try something like this (I think, my bash is a little rusty :|)
Code:
emerge --update world | grep "(insert colourcode here)*" > emerge.log


remeber to use "" or the asterix will be taken by grep as a wildcard.

The only problem you'll have is with ebuilders that only use one einfo command for many lines of text, such as the old winex ebuild:

From /usr/portage/app-emulation/winex/winex-20020511
Code:

einfo "If you are installing winex for the first time,
copy /etc/winex/config (global configuration) to ~/.wine/config
and edit that for per-user configuration. Otherwise, winex will
not run.
Also, run \"/usr/winex/bin/regapi setValue < /etc/winex/winedefault.reg\"
to setup
per-user registry for using winex. More info in
/usr/share/doc/winex-${PV}."


but you could always crack open the ebuild and check it out.
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Wed Aug 07, 2002 6:37 am    Post subject: Re: . Reply with quote

puddpunk wrote:
Code:
emerge --update world | grep "(insert colourcode here)*" > emerge.log


Or better yet:

Code:
emerge [command] 2>&1 | tee emerge.log | egrep "(insert escape sequence) *" | less


That logs everything in emerge.log and outputs the instructions -- one page at a time -- to the screen. (As well as, of course, saving them to the log so you can find them later.)
_________________
I don't believe in witty sigs.
Back to top
View user's profile Send private message
sebest
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 163
Location: Paris - France

PostPosted: Wed Aug 07, 2002 10:49 am    Post subject: Reply with quote

Thank you all :)

In fact i didn't want to know how to keep the output of emerge.

I wanted to know if it would be usefull that emerge has an options (--output) to separate compile, from info, from errors.

i know that you can do everything with grep, sed, tee, awk, cut, tr and so on.

Code:

emerge --update world | grep "(insert colourcode here)*" > emerge.log

This is ok, but how many people know this coulourcode???

Wouldn't be easier to do
Code:

emerge --update world --log-info


And then do
Code:

$less /var/log/emerge/info
############################
##### postfix informations ##########
***************************************************************"
* NOTE: If config file protection is enabled and you upgraded *"
*       from an earlier version of postfix you must update    *"
*       /etc/postfix/master.cf to the latest version          *"
*       (/etc/postfix/._cfg????_master.cf). Otherwise postfix *"
*       will not work correctly.                              *"
***************************************************************"
********************************************************"
* First time installers: You must edit                 *"
* /etc/mail/aliases to suit your needs and then run    *"
* /usr/bin/newaliases. Postfix will not work correctly *"
* without it                                           *"
********************************************************"
.
.
.


And if we have theses logs
emerge could go on emerging --update world even if a package fails to compile.

We just have to check in the log which package failed to compile and look what is wrong with that one
Back to top
View user's profile Send private message
blunted
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jun 2002
Posts: 89
Location: Winnipeg, MB

PostPosted: Wed Aug 21, 2002 10:10 pm    Post subject: color code Reply with quote

what would that color code be, or where could i find a list of the color codes? man grep? man bash?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Aug 21, 2002 10:16 pm    Post subject: Re: color code Reply with quote

blunted wrote:
where could i find a list of the color codes? man grep? man bash?

Probably something more like "man xterm" - it's a VT100 terminal emulator thing. Here's one list; I'm sure there are others (some that may be more complete).
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
EPrime
Tux's lil' helper
Tux's lil' helper


Joined: 10 Aug 2002
Posts: 80
Location: Denmark

PostPosted: Sun Aug 25, 2002 3:57 am    Post subject: Reply with quote

I'm in the need of a script to do the same as requested by sebest, and cooked up the following:
Code:
qpkg -I -nc -v | \
sed 's/\(.*\)\/\(.*\)\(-[0-9].*\)/\/usr\/portage\/\1\/\2\/\2\3.ebuild/p' | \
uniq | sort | \
xargs -i cat -n '{}' | \
grep 'ebuild '


It basically lists all packages and figures out the corresponding ebuild filename, then greps in those for the text in quotes. If you put it all on one line be sure to remove the trailing backslashes.

Since grep can't write both the filename and the matching text it's still somewhat useless, but if someone could give me hint on how to fix it I'll be happy to improve it's usefulness a bit :wink:
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Sun Aug 25, 2002 4:05 am    Post subject: Reply with quote

grep -H will do it. You can probably modify your script to do:
Code:

#!/bin/bash
qpkg -I -nc -v | \
sed 's/\(.*\)\/\(.*\)\(-[0-9].*\)/\/usr\/portage\/\1\/\2\/\2\3.ebuild/p' | \
sort -u | \
xargs grep -H 'ebuild'
Back to top
View user's profile Send private message
EPrime
Tux's lil' helper
Tux's lil' helper


Joined: 10 Aug 2002
Posts: 80
Location: Denmark

PostPosted: Sun Aug 25, 2002 4:24 am    Post subject: Reply with quote

Thanks, that was fast! Next step is to figure out how to determine what is relevant for output, but that's for some other day - I think I can manage with this one for now but will post any improvements I get around to.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum