[Popcon-commits] cvs commit to popularity-contest by ballombe

popcon-commits@lists.alioth.debian.org popcon-commits@lists.alioth.debian.org
Fri, 19 Nov 2004 07:51:29 -0700


Update of /cvsroot/popcon/popularity-contest
In directory haydn:/tmp/cvs-serv28022

Modified Files:
	popcon-stat.pl popcon.pl 
Log Message:
popcon.pl: Add popcon release stats.
popcon-stat.pl: Generate the popcon release graph.


Index: popcon-stat.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-stat.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- popcon-stat.pl	8 Nov 2004 22:49:24 -0000	1.6
+++ popcon-stat.pl	19 Nov 2004 14:51:24 -0000	1.7
@@ -2,11 +2,14 @@
 BEGIN {
 @INC=(@INC, map { "./$_" } @INC);
 }
-$dirpng="../www/stat";
 
-for $f (sort @ARGV)
+$dirpng="../www/stat";
+for (sort @ARGV)
 {
-   open FILE,"zcat $f|";
+   open FILE,"zcat $_|";
+   m/popcon-([0-9-]+)\.gz$/ or next;
+   $f=$1;
+   push @date,$f;
    while(<FILE>)
    {
      my @line=split(/ +/);
@@ -19,6 +22,14 @@
        $sub{$f}->{$line[1]}=$line[2];
        $arch{$line[1]}++;
      }
+     elsif ($line[0] eq "Release:")
+     {
+       if (defined($line[2])) {
+         $rel{$f}->{$line[1]}=$line[2];
+       } else {
+         $rel{$f}->{"unknown"}+=$line[1];
+       }
+     }
      elsif ($line[0] eq "Package:")
      {
        last;
@@ -27,9 +38,8 @@
    close FILE;
 }
 
-@days = sort grep { defined($sub{$_}->{'i386'}) } @ARGV;
-@dates = map {m/popcon-([0-9-]+)\.gz/ and $1} @days;
-@data = (\@dates);
+@days = sort grep { defined($sub{$_}->{'i386'}) } @date;
+@data = (\@days);
 @arch = sort keys %arch;
 $maxv = -10;
 for $arch (@arch)
@@ -56,7 +66,7 @@
 
 $obj=Chart::LinesPoints->new (600,400);
 $obj->set ('title' => 'Number of submissions per architectures');
-$obj->set ('legend_labels' => \@labels);
+$obj->set ('legend_labels' => [@arch]);
 $obj->set ('f_y_tick' => \&ytick);
 $obj->set ('brush_size' => 3);
 $obj->set ('pt_size' => 7);
@@ -77,7 +87,7 @@
     push @res,defined($sub{$_}->{$arch})?$sub{$_}->{$arch}:0;
     push @tot,defined($subt{$_})?$subt{$_}:0;
   }
-  @data=(\@dates,\@res,\@tot);
+  @data=(\@days,\@res,\@tot);
   @labels=($arch, 'all submissions');
   $obj=Chart::Composite->new (600,400);
   $obj->set ('title' => "Number of submissions for $arch");
@@ -90,3 +100,25 @@
   $obj->png ("$dirpng/sub-$arch.png", \@data);
 }
 
+@days = sort grep { $_ ge "2004-05-14" } @date;
+%release= map { map { $_ => 1 } keys %{$rel{$_}}  } @days;
+@data = (\@days);
+@release= sort keys %release;
+for $release (@release)
+{
+  my @res=();
+  for (@days)
+  {
+    my $data=defined($rel{$_}->{$release})?$rel{$_}->{$release}:0;
+    push @res,$data;
+  }
+  push @data,\@res;
+}
+$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' => 14);
+$obj->png ("$dirpng/release.png", \@data);

Index: popcon.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- popcon.pl	7 Nov 2004 10:36:59 -0000	1.12
+++ popcon.pl	19 Nov 2004 14:51:24 -0000	1.13
@@ -248,6 +248,11 @@
   {
     ($numsub)=@values;
   }
+  elsif ($type eq "Release:")
+  {
+    my ($a,$nb)=@values;
+    $release{$a}=$nb;
+  }
 }
 
 @pkgs=sort keys %pkg;
@@ -362,7 +367,7 @@
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
 <tr>
 <td>
-Statistics for architectures
+Statistics per Debian architectures:
 <pre>
 EOF
         for $f (grep { $_ ne 'unknown' } sort keys %arch)
@@ -370,14 +375,29 @@
 		my ($port)=split('-',$f);
 		$port="$port/";
 		$port="kfreebsd-gnu/" if ($port eq "kfreebsd/");
-                printf HTML "<a href=\"http://www.debian.org/ports/$port\">%-16s</a> : %-10s <a href=\"/stat/sub-$f.png\">graph</a>\n",$f,$arch{$f};
+                printf HTML "<a href=\"http://www.debian.org/ports/$port\">%-16s</a> : %-10s <a href=\"stat/sub-$f.png\">graph</a>\n",$f,$arch{$f};
         }
-        printf HTML "%-16s : %-10s <a href=\"/stat/sub-unknown.png\">graph</a>\n","unknown",$arch{"unknown"};
+        printf HTML "%-16s : %-10s <a href=\"stat/sub-unknown.png\">graph</a>\n","unknown",$arch{"unknown"};
 	print HTML  <<'EOF';
 </pre></td>
 <td>
  <img alt="Graph of number of submissions per architectures"
- src="/stat/submission.png">
+ src="stat/submission.png">
+</td></tr>
+<td>
+Statistics per popularity-contest releases:
+<pre>
+EOF
+        for $f (grep { $_ ne 'unknown' } sort keys %release)
+        {
+                printf HTML "%-16s : %-10s \n",$f,$release{$f};
+        }
+        printf HTML "%-16s : %-10s \n","unknown",$release{"unknown"};
+	print HTML  <<'EOF';
+</pre></td>
+<td>
+ <img alt="Graph of popularity-contest versions in use"
+ src="stat/release.png">
 </td></tr>
 </table>
 <p>