Gentoo Archives: gentoo-dev

From: Thomas de Grenier de Latour <degrenier@×××××××××××.fr>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] patch: emergemail feature in functions.sh
Date: Tue, 19 Aug 2003 13:04:51
Message-Id: 20030819150551.3a22855a.degrenier@easyconnect.fr
In Reply to: [gentoo-dev] patch: emergemail feature in functions.sh by Owen Gunden
1 On Tue, 19 Aug 2003 01:37:23 -0400
2 Owen Gunden <ogunden@××××××××××××.edu> wrote:
3
4 > This is useful if you upgrade or install multiple packages at once,
5 > and you don't want to miss any important messages that go whizzing by.
6
7 Just in case it can be useful to someone, I've written a small script to
8 retrieve einfos in emerge log files (the ones in PORT_LOGDIR):
9
10 >>> "portlog-info" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
11 #!/bin/bash
12 # Usage: "portlog-info [pkg-name]"
13
14 PORT_LOGDIR="`sed -n s:^PORT_LOGDIR=::p /etc/make.conf`"
15 if [ -d "${PORT_LOGDIR}" ]
16 then
17 cd ${PORT_LOGDIR}
18 else
19 echo "PORT_LOGDIR not found."
20 exit 1
21 fi
22
23 for logfile in $( ls *$1* 2> /dev/null )
24 do
25 if [ 0 -ne "`cat -v ${logfile} | grep -c "^\ \^\[\[..;01m\*"`" ]
26 then
27 echo -n "########## "
28 echo -n ${logfile} | sed -e s:"^[0-9]*-":: -e s:".log$"::
29 echo " ##########"
30 sed -n -e "
31 /^\ \o033\[..;01m\*/{
32 i
33 p
34 n
35 :block
36 /^\ \o033\[..;01m\*/{
37 p
38 n
39 b block
40 }
41 }" ${logfile}
42 echo
43 fi
44 done
45 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
46
47 Note that:
48 - I've assumed that the logs have colors (NOCOLOR=false)
49 - I'm not a sed guru and have written this with a sed manual in the
50 hands but I would be interrested by a shorter syntax for the "retrieve
51 blocks of consecutive matching lines and separate them by a blank line"
52
53 --
54 TGL.
55
56 --
57 gentoo-dev@g.o mailing list