[Popcon-commits] cvs commit to popularity-contest by ballombe
ballombe at cvs.alioth.debian.org
ballombe at cvs.alioth.debian.org
Thu Sep 18 21:08:48 UTC 2008
Update of /cvsroot/popcon/popularity-contest
In directory alioth:/tmp/cvs-serv7400
Modified Files:
popcon-stat.pl
Log Message:
popcon-stat.pl: sync with popcon.debian.org version: add graphs
restricted to last 3 month.
Index: popcon-stat.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-stat.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- popcon-stat.pl 19 Nov 2005 09:44:32 -0000 1.10
+++ popcon-stat.pl 18 Sep 2008 21:08:46 -0000 1.11
@@ -2,12 +2,14 @@
#
# Require the debian package libchart-perl.
-BEGIN {
- at INC=("./usr/share/perl5/", @INC);
-}
+#BEGIN {
+#@INC=("./usr/share/perl5/", @INC);
+#}
$ENV{PATH}="/usr/bin:/bin";
$dirpng="../www/stat";
+$oneyearago = `date +"%Y-%m-%d" -d "1 year ago"`;
+
while (<>)
{
my ($file);
@@ -30,8 +32,14 @@
}
elsif ($line[0] eq "Release:")
{
- if (defined($line[2])) {
- $rel{$f}->{$line[1]}=$line[2];
+ if (defined($line[2]))
+ {
+ if ($line[1] =~ m/^([0-9]+(?:\.[0-9]+)*)/)
+ {
+ $rel{$f}->{"$1"}+=$line[2];
+ } else {
+ $rel{$f}->{"unknown"}+=$line[2];
+ }
} else {
$rel{$f}->{"unknown"}+=$line[1];
}
@@ -44,23 +52,6 @@
close FILE;
}
- at days = sort grep { defined($sub{$_}->{'i386'}) } @date;
- at data = (\@days);
- at arch = sort keys %arch;
-$maxv = -10;
-for $arch (@arch)
-{
- my @res=();
- for (@days)
- {
- my $data=defined($sub{$_}->{$arch})?log($sub{$_}->{$arch})/log(2)+1:0;
- push @res,$data;
- $maxv=$data if ($data > $maxv);
- }
- push @data,\@res;
-}
-
- at labels=(@arch);
sub ytick
{
my ($x)=$_[0]-.5;
@@ -70,19 +61,53 @@
use Chart::LinesPoints;
-$obj=Chart::LinesPoints->new (600,400);
-$obj->set ('title' => 'Number of submissions per architectures');
-$obj->set ('legend_labels' => [@arch]);
-$obj->set ('f_y_tick' => \&ytick);
-$obj->set ('brush_size' => 3);
-$obj->set ('pt_size' => 7);
-$obj->set ('max_val' => $maxv+1);
-$obj->set ('y_ticks' => int $maxv +1);
-$obj->set ('x_ticks' => 'vertical');
-$obj->set ('skip_x_ticks' => 28);
-$obj->png ("$dirpng/submission.png", \@data);
+sub getsub
+{
+ my ($day,$r)=@_;
+ return defined($sub{$day}->{$r})?$sub{$day}->{$r}:0;
+}
+
+sub submission_chart
+{
+ my ($pngname,$startdate,$ticks,$title)=@_;
+ my (@days) = sort grep { defined($sub{$_}->{'i386'}) } @date;
+ @days = sort grep { $_ ge $startdate } @days;
+ my (@data) = (\@days);
+ my ($today)=$days[-1];
+ my (@arch)= sort {getsub($today,$b) <=> getsub($today,$a)} (keys %arch);
+ $maxv = -10;
+ for $arch (@arch)
+ {
+ my @res=();
+ for (@days)
+ {
+ my $data=defined($sub{$_}->{$arch})?log($sub{$_}->{$arch})/log(2)+1:0;
+ push @res,$data;
+ $maxv=$data if ($data > $maxv);
+ }
+ push @data,\@res;
+ }
+
+ $obj=Chart::LinesPoints->new (600,400);
+ $obj->set ('title' => "Number of submissions per architectures $title");
+ $obj->set ('legend_labels' => [@arch]);
+ $obj->set ('f_y_tick' => \&ytick);
+ $obj->set ('brush_size' => 3);
+ $obj->set ('pt_size' => 7);
+ $obj->set ('max_val' => $maxv+1);
+ $obj->set ('max_y_ticks' => 30);
+ $obj->set ('y_ticks' => int $maxv +1);
+ $obj->set ('x_ticks' => 'vertical');
+ $obj->set ('skip_x_ticks' => $ticks);
+ $obj->png ("$dirpng/submission$pngname.png", \@data);
+}
+
+submission_chart ("","0000-00-00",42,"");
+submission_chart ("-1year",$oneyearago,14,"(last 12 months)");
use Chart::Composite;
+my (@days) = sort grep { defined($sub{$_}->{'i386'}) } @date;
+my (@arch)= sort (keys %arch);
for $arch (@arch)
{
my @data;
@@ -95,36 +120,49 @@
}
@data=(\@days,\@res,\@tot);
@labels=($arch, 'all submissions');
- $obj=Chart::Composite->new (600,400);
+ $obj=Chart::Composite->new (700,400);
$obj->set ('title' => "Number of submissions for $arch");
$obj->set ('legend_labels' => \@labels);
$obj->set ('brush_size' => 3);
$obj->set ('pt_size' => 7);
$obj->set ('x_ticks' => 'vertical');
- $obj->set ('skip_x_ticks' => 28);
+ $obj->set ('skip_x_ticks' => 42);
$obj->set ('composite_info' => [ ['LinesPoints', [1]], ['LinesPoints', [2] ] ]);
$obj->png ("$dirpng/sub-$arch.png", \@data);
}
- at days = sort grep { $_ ge "2004-05-14" } @date;
-%release= map { map { $_ => 1 } keys %{$rel{$_}} } @days;
- at data = (\@days);
- at release= sort keys %release;
-for $release (@release)
+sub getrel
{
- my @res=();
- for (@days)
+ my ($day,$r)=@_;
+ return defined($rel{$day}->{$r})?$rel{$day}->{$r}:0;
+}
+
+sub release_chart
+{
+ my ($pngname,$startdate,$ticks,$title)=@_;
+ my (@days) = sort grep { $_ ge $startdate } @date;
+ my (%release) = map { map { $_ => 1 } keys %{$rel{$_}} } @days;
+ my (@data) = (\@days);
+ my ($today)=$days[-1];
+ my (@release)= sort {getrel($today,$b) <=> getrel($today,$a)} (keys %release);
+ for $release (@release)
{
- my $data=defined($rel{$_}->{$release})?$rel{$_}->{$release}:0;
- push @res,$data;
+ my @res=();
+ for (@days)
+ {
+ my $data=getrel($_,$release);
+ push @res,$data;
+ }
+ push @data,\@res;
}
- push @data,\@res;
+ $obj=Chart::LinesPoints->new (600,400);
+ $obj->set ('title' => "popularity-contest versions in use $title");
+ $obj->set ('legend_labels' => [@release]);
+ $obj->set ('brush_size' => 3);
+ $obj->set ('pt_size' => 7);
+ $obj->set ('x_ticks' => 'vertical');
+ $obj->set ('skip_x_ticks' => $ticks);
+ $obj->png ("$dirpng/release$pngname.png", \@data);
}
-$obj=Chart::LinesPoints->new (600,400);
-$obj->set ('title' => 'popularity-contest versions in use');
-$obj->set ('legend_labels' => [@release]);
-$obj->set ('brush_size' => 3);
-$obj->set ('pt_size' => 7);
-$obj->set ('x_ticks' => 'vertical');
-$obj->set ('skip_x_ticks' => 28);
-$obj->png ("$dirpng/release.png", \@data);
+release_chart ("","2004-05-14",42,"");
+release_chart ("-1year",$oneyearago,14,"(last 12 months)");
More information about the Popcon-commits
mailing list