Number of submissions considered: $numsub
To participate in this survey, install the popularity-contest package.
EOF print HTML <#! /usr/bin/perl -wT
use strict;
$ENV{PATH}="/bin:/usr/bin";
my %results=('all' => "../popcon-mail/results", 'stable' => "../popcon-mail/results.stable");
my $popbase = "../www";
my %popcon= ('all' => "", 'stable' => "/stable");
my %popfile=('all' => "all-popcon-results.gz", 'stable' => "stable-popcon-results.gz");
my %poptext=('all' => "All reports", 'stable' => "Stable reports");
my $mirrorbase = "/srv/mirrors/debian";
my $docurlbase = "/";
my %popconver=("1.28" => "sarge", "1.41" => "etch", "1.46" => "lenny",
"1.49" => "squeeze", "1.56" => "wheezy");
my %popver=();
my @dists=("main","contrib","non-free","non-US");
my @fields=("inst","vote","old","recent","no-files");
my %maint=();
my %list_header=(
"maint" => <<"EOF",
# The popularity contest project is an attempt to map the usage of
Debian packages. This site publishes the statistics gathered from report
sent by users of the popularity-contest
package. This package sends every week the list of packages installed and the
access time of relevant files to the server via email. Every day the server
anonymizes the result and publishes this survey.
For more information, read the README and the
FAQ.
Number of submissions considered: $numsub
To participate in this survey, install the popularity-contest package.
Statistics for the section %-16s sorted by fields: ",$sec);
print_by (".",$_) for (@fields);
print HTML ("\n First packages in subsections for each fields \n");
printf HTML (" Statistics for subsections sorted by fields\n First package in section %-16s for fields: ",$sec);
for $f (@fields)
{
print_pkg $winner{"$sec/$f"};
}
print HTML ("\n Statistics by subsections sorted by fields \n");
printf HTML (" First package in subsections for fields\n Statistics for the whole archive sorted by fields:
EOH
}
sub popconintro
{
my ($name,$page) = @_;
&htmlheader;
print HTML <<"EOF";
Debian Popularity Contest
EOF
for (keys %poptext)
{
if ($_ eq $name) {
print HTML "
Popularity-contest project by Avery Pennarun, Bill Allombert and Petter Reinholdtsen.
Copyright (C) 2004-2005 SPI;
See license terms.
EOH
}
# Report generators
sub make_sec
{
my $sec="$_[0]/$_[1]";
-d $sec || system("mkdir","-p","$sec");
}
sub print_by
{
my ($dir,$f)=@_;
print HTML ("$f [gz] ");
}
sub make_by
{
my ($popcon,$sec,$order,$pkg,$winner,$listp) = @_;
my (%sum, $me);
my @list = sort {$pkg->{$b}->{$order}<=> $pkg->{$a}->{$order} || $a cmp $b } @{$listp};
$winner->{"$sec/$order"}=$list[0];
open DAT , "|-:utf8", "tee $popcon/$sec/by_$order | gzip -c > $popcon/$sec/by_$order.gz";
if (defined($list_header{$sec}))
{
print DAT $list_header{$sec};
$me="";
}
else
{
print DAT <<"EOF";
#Format
#
#\n");
for $dir (sort readdir SEC)
{
-d "$popcon/$sec/$dir" or next;
$dir !~ /^\./ or next;
printf HTML ("%-16s : ",$dir);
print_by ($dir,$_) for (@fields);
print HTML ("\n");
}
print HTML ("\n
\n");
htmlfooter $numsub;
closedir SEC;
close HTML;
}
for $sec (@dists)
{
open HTML , ">:utf8", "$popcon/$sec/first.html";
opendir SEC,"$popcon/$sec";
popconintro($name,"$sec/first.html");
printf HTML ("\n");
printf HTML ("%-16s : ","subsection");
for $f (@fields)
{
printf HTML ("%-20s ",$f);
}
print HTML ("\n","_"x120,"\n");
for $dir (sort readdir SEC)
{
-d "$popcon/$sec/$dir" or next;
$dir !~ /^\./ or next;
printf HTML ("%-16s : ",$dir);
for $f (@fields)
{
print_pkg $winner{"$sec/$dir/$f"};
}
print HTML ("\n");
}
print HTML ("\n
\n");
htmlfooter $numsub;
closedir SEC;
close HTML;
}
open HTML , ">:utf8", "$popcon/index.html";
popconintro($name,"index.html");
printf HTML ("");
print_by (".",$_) for (@fields);
print HTML ("
\n
Statistics by maintainers sorted by fields:
"); print_by ("maint",$_) for (@fields); print HTML ("\n \n"); printf HTML ("
Statistics by source packages (sum) sorted by fields:
"); print_by ("source",$_) for (@fields); print HTML ("\n \n"); printf HTML ("
Statistics by source packages (max) sorted by fields:
"); print_by ("sourcemax",$_) for (@fields); print HTML ("\n \n"); printf HTML ("
Statistics for sections sorted by fields\n
\n"); for $dir ("main","contrib","non-free","non-US","unknown") { -d "$popcon/$dir" or next; $dir !~ /^\./ or next; if ($dir eq "unknown") { printf HTML ("%-16s : ",$dir); } else { printf HTML ("%-16s : ",$dir); } print_by ($dir,$_) for (@fields); print HTML ("\n"); } print HTML <<'EOF';
Statistics per Debian architectures:
EOF for $f (grep { $_ ne 'unknown' } sort keys %arch) { my ($port)=split('-',$f); $port="$port/"; $port="kfreebsd-gnu/" if ($port eq "kfreebsd/"); printf HTML "%-16s : %-10s graph\n",$f,$arch{$f}; } if (defined $arch{"unknown"}) { printf HTML "%-16s : %-10s graph\n","unknown",$arch{"unknown"} } print HTML " | \n";
print HTML <<'EOF';
|
EOF
print HTML <<'EOF';
||
Statistics per popularity-contest releases:
EOF for $f (grep { $_ ne 'unknown' } sort keys %release) { my($name) = $f; $name = "$f ($popconver{$f})" if (defined($popconver{$f})); printf HTML "%-25s : %-10s \n",$name,$release{$f}; } if (defined $release{"unknown"}) { printf HTML "%-25s : %-10s \n","unknown",$release{"unknown"}; } print HTML " | \n";
print HTML <<'EOF';
|
EOF
print HTML "
\n";
print HTML "Raw popularity-contest results\n";
htmlfooter $numsub;
close HTML;
}
sub read_packages
{
my ($file,$dist);
for $file ("slink","slink-nonUS","potato","potato-nonUS",
"woody","woody-nonUS", values %popconver)
{
open AVAIL, "<:utf8", "$file.sections" or die "Cannot open $file.sections";
while(