Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[splat] - simple portage log analyzer tool
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Wed Jun 11, 2003 11:37 pm    Post subject: [splat] - simple portage log analyzer tool Reply with quote

Some great bugsplatting from SpanKY lets me bring you splat-0.06 available for download!

Splat is a cool little tool to show you when you've emerged a package, or just to see how long it took to build said package.

Here's a page with an example usage and download links:

http://www.l8nite.net/projects/splat/

Here's some output from the latest version (notice how it skips old/invalid data (0 lines in this case))

Code:
l8nite@thrall splat-0.06 $ ./splat.pl -vs world
*** No log file specified.
*** Found PORT_LOGDIR='/var/log'
*** Using '/var/log/emerge.log' as log file.
*** Skipped 0 line(s) due to invalid format.
= Summary
                                                                               
        Total Builds:  1613
        Time Elapsed:  3 days, 19 hours, 6 minutes, and 35 seconds
        Average Time:  3 minutes, and 23 seconds
                                                                               
        First Build:   sys-apps/baselayout-1.8.5.3
                       (Wed Nov 20 20:43:02 2002)
                                                                               
        Last Build:    dev-python/pygame-1.5.6
                       (Sun Jun 15 00:56:16 2003)


And here is the new ebuild, thanks to SpanKY/port001.

/usr/local/portage/app-admin/splat/splat-0.06.ebuild
Code:
DESCRIPTION="Simple Portage Log Analyzer Tool"
SRC_URI="http://www.l8nite.net/projects/splat/${P}.tar.bz2"
HOMEPAGE="http://www.l8nite.net/projects/splat/"
                                                                                               
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
DEPEND=">=dev-perl/Getopt-Long-2.31"
                                                                                               
src_unpack() {
        unpack ${P}.tar.bz2
}
                                                                                               
src_install() {
        mv splat.pl splat
        exeinto /usr/bin
        doexe splat
        fperms +x /usr/bin/splat
        dodoc COPYING
        dodoc ChangeLog
}


You can also get the ebuilds premade from http://portage.l8nite.net/app-admin/

All this content was placed in the first post to help cut down on the lengthy posts that people would have to read just to get to the goods! This post will contain the latest release from now on :-)


Last edited by l8nite on Tue Jul 15, 2003 12:20 am; edited 2 times in total
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Wed Jun 11, 2003 11:48 pm    Post subject: A cool tip for splat Reply with quote

You can get a summary for every package on your system like this:

Code:
l8nite@thrall splat-0.01 $ ./splat.pl -s world
 = Summary
        Total Builds:  1516
        Time Elapsed:  3 days, 6 hours, 40 minutes, and 24 seconds
 
        First Build:   sys-apps/baselayout-1.8.5.3
                       (Wed Nov 20 20:43:02 2002)
 
        Last Build:    dev-perl/TermReadKey-2.21
                       (Tue Jun 10 15:54:42 2003)


My poor machine has spent nearly 80 hours emerging things since Nov!

(Edited to reflect the new 'world' option suggested by Giorgio)


Last edited by l8nite on Sat Jun 14, 2003 5:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Thu Jun 12, 2003 12:18 am    Post subject: Reply with quote

Sup l8nite! (Do you remember me? :D)

Cool tool! lil shocked to see that I merged mozilla in 1 hour 23 minutes, I coud have sworn it took longer 8O :D

Hmmm, is it worth me writing a ebuild for this?
_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Thu Jun 12, 2003 12:55 am    Post subject: Reply with quote

Quote:
Sup l8nite! (Do you remember me? )

Cool tool! lil shocked to see that I merged mozilla in 1 hour 23 minutes, I coud have sworn it took longer

Hmmm, is it worth me writing a ebuild for this?


Of course I remember you, sub_pop_culture and I talk about you every so often when he comes over for pizza ;-). I think an ebuild would be worthwhile, but I'll wait for a little more feedback/feature requests/etc before I write one :)
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Thu Jun 12, 2003 12:59 am    Post subject: Reply with quote

/usr/local/portage/app-admin/splat/splat-0.01.ebuild
Code:
DESCRIPTION="Simple Portage Log Analyzer Tool"
SRC_URI="http://www.l8nite.net/projects/splat/${P}.tar.bz2"
HOMEPAGE="http://www.l8nite.net/projects/splat/"
                                                                                               
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
                                                                                               
src_unpack() {
        unpack ${P}.tar.bz2
}
                                                                                               
src_install() {
        mv splat.pl splat
        exeinto /usr/bin
        doexe splat
        fperms +x /usr/bin/splat
        dodoc COPYING
}

_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Thu Jun 12, 2003 1:03 am    Post subject: Reply with quote

Too late, lol

Code:
splat > splat splat
 * app-admin/splat-0.01
 
        Emerged at: Thu Jun 12 04:02:18 2003
        Build time: 8 seconds

:mrgreen:
_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
Giorgio
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2003
Posts: 77
Location: Milano, Italy

PostPosted: Thu Jun 12, 2003 9:38 pm    Post subject: Reply with quote

Nice. :)
I'll give it a try.

ps. I am the genlop dev :wink:
Back to top
View user's profile Send private message
Giorgio
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2003
Posts: 77
Location: Milano, Italy

PostPosted: Thu Jun 12, 2003 9:43 pm    Post subject: Reply with quote

Code:
giorgio@pollycoke splat-0.01 $ ./splat.pl mplayer | grep skin
 * x11-themes/mplayer-skins-0.1
 * x11-themes/mplayer-skins-0.1-r1
giorgio@pollycoke splat-0.01 $


Should it happen? :)
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9530
Location: beyond the rim

PostPosted: Fri Jun 13, 2003 3:16 pm    Post subject: Reply with quote

A little suggestion: Could you replace the -s "" with -s world, that seems more logical to me. Other than that a nice tool, hard to decide whether splat or genlop is better 8) as they seem very similar to me.
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Sat Jun 14, 2003 5:26 am    Post subject: Good suggestions :) Reply with quote

Quote:
A little suggestion: Could you replace the -s "" with -s world, that seems more logical to me.


Absolutely a good idea :) I'll add that this evening.

Quote:
Code:
giorgio@pollycoke splat-0.01 $ ./splat.pl mplayer | grep skin
* x11-themes/mplayer-skins-0.1
* x11-themes/mplayer-skins-0.1-r1
giorgio@pollycoke splat-0.01 $


Should it happen?


Yea, as a matter of fact it should. Splat takes a string that it uses as part of a regular expression that matches against the beginning of the package name. If you wanted to search for just the media player 'mplayer', you should use:

Code:
l8nite@thrall splat-0.01 $ ./splat.pl media-video/mplayer


Quote:
Other than that a nice tool, hard to decide whether splat or genlop is better as they seem very similar to me.


I wrote splat because genlop had a few troubles parsing my logfile correctly (I had a few instances where I would start/stop emerges suddenly and where I would have two emerges logging at the same time). I was going to originally just patch genlop and send the update; however, once I looked at the code, I realized that a complete rewrite would be necessary to do what I wanted :)
Back to top
View user's profile Send private message
haceye
Apprentice
Apprentice


Joined: 22 May 2003
Posts: 187
Location: Stuttgart, Germany

PostPosted: Sat Jun 14, 2003 10:26 am    Post subject: Reply with quote

Hi,

I've just emerged splat and it's really nice (tough i loved the colored output of genlop ;-))

But I think i've encountered a little error:

Code:

shark@gentoo shark $ splat -s alsa-driver
 = Summary
        Total Builds:  4
        Time Elapsed:  0 seconds

        First Build:   media-sound/alsa-driver-0.9.2
                       (Son Mai 18 15:18:00 2003)

        Last Build:    media-sound/alsa-driver-0.9.2
                       (Sam Jun 14 12:10:43 2003)


I've emerged alsa-driver 4 times... that's right, but "Time Elapsed: 0 seconds"?

Code:

shark@gentoo shark $ splat alsa-driver
 * media-sound/alsa-driver-0.9.2

        Emerged at: Son Mai 18 15:18:00 2003
        Build time: 0 seconds

        Emerged at: Mon Mai 19 23:38:27 2003
        Build time: 5 minutes, and 51 seconds

        Emerged at: Die Mai 20 14:26:17 2003
        Build time: 3 minutes, and 19 seconds

        Emerged at: Sam Jun 14 12:08:40 2003
        Build time: 2 minutes, and 3 seconds

... should be about 11 minutes, if it were right that on Son Mai, 18 it was emerged in 0 seconds, but that's not right (unfortunately ;-))

You can take a look at my emerge.log here: http://phpwelt.com/emerge.log
_________________
faster 'emerge -s'? emerge esearch
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Sat Jun 14, 2003 5:29 pm    Post subject: Thanks for the help! :-) Reply with quote

Quote:
I've just emerged splat and it's really nice (tough i loved the colored output of genlop )


Thanks for the feedback! The next version will have colored output support (was planned since the beginning, just functionality came first) - look for it really soon ;)

Quote:
I've emerged alsa-driver 4 times... that's right, but "Time Elapsed: 0 seconds"?


What's happening here is that your first alsa-driver build has a problem with the timestamps (according to the log it finished emerging _before_ it even started!). I'll fix the next release to handle this bug properly as well. Thanks for the helpful message and log post, they were invaluable in tracking it down! :-)
Back to top
View user's profile Send private message
haceye
Apprentice
Apprentice


Joined: 22 May 2003
Posts: 187
Location: Stuttgart, Germany

PostPosted: Sat Jun 14, 2003 10:58 pm    Post subject: Reply with quote

Wow, works great now...

I also noticed, that it shows me another 'emerge world time' now... nearly 4 hours difference.

So.. just if you search another feature you could implement (also seen in genlop): splat could show a "average merge time" value at the end of a report. would be pretty nice.

PS: The colored output is nice ;-)
_________________
faster 'emerge -s'? emerge esearch
Back to top
View user's profile Send private message
dev-null-devil
Tux's lil' helper
Tux's lil' helper


Joined: 12 May 2003
Posts: 93

PostPosted: Sat Jun 14, 2003 11:07 pm    Post subject: Reply with quote

Will this be in the public portage? I dont have it, even though i did a sync 5min ago. I added it to my portage (edited it manually) but when i did a sync, it disappeared. Is it like, the gentoo-crew must approve it first? Or can you upload the portage file manually to their database? How does the crew manage the portage? I'm kinda confused..
_________________
All change, motion, and time is an illusion.
-- Plato, year 310
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Sat Jun 14, 2003 11:12 pm    Post subject: Reply with quote

dev-null-devil wrote:
Will this be in the public portage? I dont have it, even though i did a sync 5min ago. I added it to my portage (edited it manually) but when i did a sync, it disappeared. Is it like, the gentoo-crew must approve it first? Or can you upload the portage file manually to their database? How does the crew manage the portage? I'm kinda confused..


Its possible it will go in the official tree is the ebuild is submited to bugs.gentoo.org, but thats upto l8nite.

Putting the ebuild in /usr/portage isn't the correct way to handle an unofficial ebuild. edit /etc/make.cong and uncomment the PORTDIR_OVERLAG bit and mkdir /usr/local/portage, app-admin, splat and name the ebuild splat-0.03.ebuild.
_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
hype
Tux's lil' helper
Tux's lil' helper


Joined: 23 Nov 2002
Posts: 84
Location: Finland

PostPosted: Sat Jun 14, 2003 11:23 pm    Post subject: Reply with quote

Hello,
I have a little question.

genlop -l prints a list of all the merged packages.
so I did:
Code:

#!/usr/bin/perl
use strict;
use warnings;

my @lines = `/home/hype/genlop -l`;

my $counter;

for (@lines) {
    $counter++;
}
print "$counter\n";


and it gave me 480 which means I should have succesfully built 480 packages.

I also went through portage.log with this regexp:
Code:
 m{\d+:  ::: completed emerge \(\d+ of \d+\)}

Which should match all the succesfully built packages. It also gave 480.

but with ./splat -s world I get: Total Builds: 464

What am I missing here?
Back to top
View user's profile Send private message
Giorgio
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2003
Posts: 77
Location: Milano, Italy

PostPosted: Sun Jun 15, 2003 12:30 am    Post subject: Reply with quote

8)
Working...
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Sun Jun 15, 2003 12:48 am    Post subject: Reply with quote

haceye wrote...
Quote:
So.. just if you search another feature you could implement (also seen in genlop): splat could show a "average merge time" value at the end of a report. would be pretty nice.


Nice suggestion, I'll put it in for 0.04 :)

dev-null-devil wrote...
Quote:
Will this be in the public portage? I dont have it, even though i did a sync 5min ago. I added it to my portage (edited it manually) but when i did a sync, it disappeared. Is it like, the gentoo-crew must approve it first? Or can you upload the portage file manually to their database? How does the crew manage the portage? I'm kinda confused..


port001 answered this (with a few typos). Essentially you are creating a 'local' portage repository by modifying the PORTDIR_OVERLAY variable in /etc/make.conf. I make this "/usr/local/portage". Then you need to create an 'app-admin' directory in there, then a 'splat' directory within the 'app-admin' directory, and finally create the ebuild named 'splat-0.03.ebuild' (thanks port001 :P)

port001 wrote...
Quote:
Its possible it will go in the official tree is the ebuild is submited to bugs.gentoo.org, but thats upto l8nite.


Will be submitted after the weekend, I just wanted to wrinkle out whatever bugs I could through the forums first :)

hype wrote...
Quote:
... should match all the succesfully built packages. It also gave 480.
but with ./splat -s world I get: Total Builds: 464
What am I missing here?


This looks like a definite bug, I'm looking into it for 0.04, thanks for the catch!
Back to top
View user's profile Send private message
hype
Tux's lil' helper
Tux's lil' helper


Joined: 23 Nov 2002
Posts: 84
Location: Finland

PostPosted: Sun Jun 15, 2003 10:13 am    Post subject: Reply with quote

Great work :)

I have one idea:

You default to /var/log/portage.log if one doesn't specify an alternative logfile with the --logfile / -l flag. But it would be very easy to check from make.conf what log file one is using. With something like
Code:

        my $logfile = shift;

        # no logfile defined? Let's check make.conf
        if( !defined($logfile) || $logfile eq "" )
        {

                open MAKECONF, "/etc/make.conf"
                  or die "Unable to open make.conf: $!\n";

                while (<MAKECONF>) {
                        $logfile = $1 if (/^(?:PORT_LOGDIR=([-\/\w\.]+))$/);
                }
                close MAKECONF;
        }

        # Still no logfile?
        if( !defined($logfile) ) {
                if( $OPT->{'verbose'} )
                {
                        warn "*** No log file specified.\n".
                             "*** Using /var/log/emerge.log as log file.\n";
                }

                $logfile = '/var/log/emerge.log';
        }

One doesn't have to go through the -l something everytime if he happens to be using another logdir.


Last edited by hype on Sun Jun 15, 2003 11:03 am; edited 1 time in total
Back to top
View user's profile Send private message
ollie
n00b
n00b


Joined: 24 Nov 2002
Posts: 35

PostPosted: Sun Jun 15, 2003 10:28 am    Post subject: Reply with quote

this is in fact a cool little tool :)

edit: ffs cato` *poke*
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Sun Jun 15, 2003 4:42 pm    Post subject: Reply with quote

I have a small little suggestion aswell :D
Say I did splat -c chat, it gives me a lot of results as I have merged xchat many times. The titles are in dark blue, it would be nice for the installed version's title to be displayed in cyan or a lighter colour, or perhaps a [Installed] tag or something.

BTW l8nite, I'm finding splat very handy indeed :) I use it often.

EDIT: /usr/lib/portage/bin/pkglist is a good place to grep.
_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Sun Jun 15, 2003 6:51 pm    Post subject: Excellent Suggestions! Reply with quote

hype wrote...
Quote:
I have one idea: You default to /var/log/portage.log if one doesn't specify an alternative logfile with the --logfile / -l flag. But it would be very easy to check from make.conf what log file one is using.


Great idea - your code was just a tiny bit off since PORT_LOGDIR is just the directory that portage logs into. All that was needed is to append emerge.log to the end.

port001 wrote...
Quote:
Say I did splat -c chat, it gives me a lot of results as I have merged xchat many times. The titles are in dark blue, it would be nice for the installed version's title to be displayed in cyan or a lighter colour, or perhaps a [Installed] tag or something.


Great idea, I would find this very useful too, thanks for the heads up on pkglist as well, will make adding this a piece of cake. Look for 0.05 sometime today/tonight (got a barbeque and whatnot today for Father's day).
Back to top
View user's profile Send private message
hype
Tux's lil' helper
Tux's lil' helper


Joined: 23 Nov 2002
Posts: 84
Location: Finland

PostPosted: Sun Jun 15, 2003 7:56 pm    Post subject: Reply with quote

Quote:

Great idea - your code was just a tiny bit off since PORT_LOGDIR is just the directory that portage logs into. All that was needed is to append emerge.log to the end.

Ah so true! Good that you noticed it - I did not pay enough attention I see. It ofcourse should be:
Code:
$logfile = "${1}/emerge.log" if (/^(?:PORT_LOGDIR=([-\/\w\.]+))$/);
Back to top
View user's profile Send private message
l8nite
n00b
n00b


Joined: 16 Jun 2002
Posts: 58
Location: Sunnyvale, Ca

PostPosted: Mon Jun 16, 2003 3:21 am    Post subject: Latest post info Reply with quote

In order to cut down on the amount of posts in the thread (and to keep the latest version info at the top), I'll just be editing the first post of this thread to show the latest release info.
Back to top
View user's profile Send private message
dberkholz
Retired Dev
Retired Dev


Joined: 18 Mar 2003
Posts: 1008
Location: Minneapolis, MN, USA

PostPosted: Thu Jul 31, 2003 7:21 pm    Post subject: Reply with quote

A couple of suggestions:

1) Do color by default, and have a --nocolor option instead

2) Write a manpage for it; the logical thing to do first is 'man splat'

Nice work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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