~inspirated/arsenal/send-attachments-lpltk

« back to all changes in this revision

Viewing changes to scripts/upstream-rankings

  • Committer: Bryce Harrington
  • Date: 2009-04-14 07:20:37 UTC
  • Revision ID: bryce@canonical.com-20090414072037-8tyqpo3elyy0xl7i
Adding new hook scripts (migrating a few from contrib...) and moving
dependencies into scripts dir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use Pod::Usage;
 
5
use Getopt::Long qw(:config no_ignore_case bundling);
 
6
 
 
7
my %upstream;
 
8
my %dates;
 
9
 
 
10
our $opt_help         = 0;
 
11
our $opt_data         = 0;
 
12
our $opt_version      = 0;
 
13
Getopt::Long::Configure ("bundling", "no_ignore_case");
 
14
GetOptions(
 
15
           "version|v",
 
16
           "help|h",
 
17
           "data|d",
 
18
           ) or pod2usage(-verbose => 0, -exitstatus => 0);
 
19
 
 
20
version_and_exit() if $opt_version;
 
21
 
 
22
sub version_and_exit
 
23
{
 
24
    print "Copyright (C) 2009 Bryce W. Harrington <bryce\@bryceharrington.org>\n";
 
25
    print "This program is free software; you can redistribute it and/or\n";
 
26
    print "modify it under the same terms as Perl itself.\n";
 
27
    exit(0);
 
28
}
 
29
 
 
30
my $date;
 
31
foreach my $file (<*.txt>) {
 
32
    open(FILE, "<$file");
 
33
    $date = $file;
 
34
    $date =~ s/^upstream-20//;
 
35
    $date =~ s/\.txt$//;
 
36
    $dates{$date} = 1;
 
37
    my $lineno = 100;
 
38
    foreach my $line (<FILE>) {
 
39
        chomp $line;
 
40
        my ($name, $score) = split(/\s+/, $line);
 
41
        $upstream{$name}->{$date} = $lineno;
 
42
        $lineno--;
 
43
    }
 
44
    close(FILE);
 
45
}
 
46
my @dates = sort keys %dates;
 
47
 
 
48
my $firstdate = $dates[0];
 
49
 
 
50
printf("%-8s ", "Date");
 
51
 
 
52
#my @packages = keys %upstream;
 
53
my @packages = ();
 
54
for my $pkg ( qw(fglrx-installer xkeyboard-config xserver-xorg-video-nv xserver-xorg-video-intel
 
55
                 xserver-xorg-video-ati linux-restricted-modules-2.6.22 linux-restricted-modules-2.6.24
 
56
                 xorg xorg-server mesa inkscape xserver-xorg-input-evdev) ) {
 
57
    if (exists $upstream{$pkg}) {
 
58
        push @packages, $pkg;
 
59
    }
 
60
}
 
61
my @names = reverse sort { $upstream{$a}->{$firstdate} <=> $upstream{$b}->{$firstdate} } @packages;
 
62
 
 
63
# Print out names
 
64
foreach my $name (@names) {
 
65
    my $display_name = $name;
 
66
    $display_name =~ s/ +/_/g;
 
67
    $display_name =~ s/linux-restricted-modules/lrm/;
 
68
    $display_name =~ s/xserver-xorg-(video|input)//;
 
69
 
 
70
    printf("%20s", $display_name);
 
71
}
 
72
 
 
73
# foreach date, print data for each name
 
74
foreach my $date (@dates) {
 
75
    printf("\n%-8s ", $date);
 
76
    foreach my $name (@names) {
 
77
        printf("%20.0f", $upstream{$name}->{$date});
 
78
    }
 
79
}
 
80
print "\n";
 
81