| 1 |
#!/usr/bin/perl -T
|
| 2 |
|
| 3 |
use strict;
|
| 4 |
use warnings;
|
| 5 |
|
| 6 |
use DBI;
|
| 7 |
use CGI;
|
| 8 |
|
| 9 |
my $dbh = DBI->connect("dbi:Pg:dbname=udd;port=5441;host=localhost", "guest") or die $!;
|
| 10 |
my $sth = $dbh->prepare(<<EOF
|
| 11 |
SELECT DISTINCT ubu.source, insts
|
| 12 |
FROM (SELECT DISTINCT source FROM ubuntu_sources
|
| 13 |
WHERE release = 'precise')
|
| 14 |
AS ubu,
|
| 15 |
ubuntu_popcon_src
|
| 16 |
WHERE NOT EXISTS (SELECT * FROM sources WHERE distribution = 'debian'
|
| 17 |
and source = ubu.source)
|
| 18 |
AND ubuntu_popcon_src.source = ubu.source
|
| 19 |
AND ubu.source !~ '^language-(support|pack)-.*'
|
| 20 |
AND ubu.source !~ '^kde-l10n-.*'
|
| 21 |
AND ubu.source !~ 'ubuntu'
|
| 22 |
AND ubu.source !~ 'launchpad'
|
| 23 |
ORDER BY insts DESC;
|
| 24 |
EOF
|
| 25 |
);
|
| 26 |
|
| 27 |
$sth->execute() or die $!;
|
| 28 |
|
| 29 |
my $q = CGI->new();
|
| 30 |
my $n = 0;
|
| 31 |
print $q->header(-type => 'text/plain');
|
| 32 |
while(my @row = $sth->fetchrow_array) {
|
| 33 |
my ($package, $score) = @row;
|
| 34 |
print "$package\t$score\n";
|
| 35 |
$n++;
|
| 36 |
}
|
| 37 |
print "\n\n# Packages: $n\n";
|
| 38 |
|