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

popcon-commits@lists.alioth.debian.org popcon-commits@lists.alioth.debian.org
Wed, 18 Feb 2004 12:51:42 +0100


Update of /cvsroot/popcon/popularity-contest
In directory quantz:/tmp/cvs-serv14727

Modified Files:
	popanal.py popcon-process.sh popcon-stat.pl popcon.pl 
Log Message:
Update server-side scripts


Index: popanal.py
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popanal.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- popanal.py	8 Feb 2004 11:19:13 -0000	1.7
+++ popanal.py	18 Feb 2004 11:51:39 -0000	1.8
@@ -207,6 +207,8 @@
                     e.arch = 'amd64'
 	    	elif header['ARCH']=='i386-gnu':
                     e.arch = 'hurd-i386'
+		elif header['ARCH']=='':
+                    e.arch = 'unknown'
 		else:
                     e.arch = header['ARCH']
 

Index: popcon-process.sh
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-process.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- popcon-process.sh	10 Feb 2004 11:30:31 -0000	1.3
+++ popcon-process.sh	18 Feb 2004 11:51:39 -0000	1.4
@@ -18,5 +18,9 @@
 cp results ../www/all-popcon-results.txt
 gzip -f ../www/all-popcon-results.txt
 cp ../www/all-popcon-results.txt.gz all-popcon-results/popcon-`date +"%Y-%m-%d"`.gz
+cd ../popcon-stat
+
+find ../popcon-mail/all-popcon-results -type f -print0 | xargs -0 ./popcon-stat.pl
+
 cd ../popcon-web
 ./popcon.pl

Index: popcon-stat.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-stat.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- popcon-stat.pl	14 Feb 2004 16:02:19 -0000	1.2
+++ popcon-stat.pl	18 Feb 2004 11:51:39 -0000	1.3
@@ -1,7 +1,10 @@
 #! /usr/bin/perl -w
-$png="submission.png";
+BEGIN {
+@INC=(@INC, map { "./$_" } @INC);
+}
+$dirpng="../www/stat";
 
-for $f (@ARGV)
+for $f (sort @ARGV)
 {
    open FILE,"zcat $f|";
    while(<FILE>)
@@ -9,14 +12,14 @@
      my @line=split(/ +/);
      if ($line[0] eq "Submissions:")
      {
-       $sub{$f}=$line[1];
+       $subt{$f}=$line[1];
      }
      elsif ($line[0] eq "Architecture:")
      {
        $sub{$f}->{$line[1]}=$line[2];
        $arch{$line[1]}++;
      }
-     elsif ($line[0] ne "Release:")
+     elsif ($line[0] eq "Package:")
      {
        last;
      }
@@ -24,15 +27,15 @@
    close FILE;
 }
 
-@date=map {m/popcon-([0-9-]+)\.gz/ and $1} @ARGV;
-
-@data=(\@date);
-@arch=sort keys %arch;
-$maxv=-10;
+@days = sort grep { defined($sub{$_}->{'i386'}) } @ARGV;
+@date = map {m/popcon-([0-9-]+)\.gz/ and $1} @days;
+@data = (\@date);
+@arch = sort keys %arch;
+$maxv = -10;
 for $arch (@arch)
 {
   my @res=();
-  for (@ARGV)
+  for (@days)
   {
     my $data=defined($sub{$_}->{$arch})?log($sub{$_}->{$arch})/log(2)+1:0;
     push @res,$data;
@@ -40,6 +43,7 @@
   }
   push @data,\@res;
 }
+
 @labels=(@arch);
 sub ytick
 {
@@ -49,11 +53,38 @@
 }
 
 use Chart::LinesPoints;
+
 $obj=Chart::LinesPoints->new (600,400);
 $obj->set ('title' => 'Number of submissions per architectures');
 $obj->set ('legend_labels' => \@labels);
 $obj->set ('f_y_tick' => \&ytick);
 $obj->set ('brush_size' => 2);
+$obj->set ('pt_size' => 9);
 $obj->set ('max_val' => $maxv+1);
 $obj->set ('y_ticks' => int $maxv +1);
-$obj->png ($png, \@data);
+$obj->set ('x_ticks' => 'vertical');
+$obj->png ("$dirpng/submission.png", \@data);
+
+use Chart::Composite;
+for $arch (@arch)
+{
+  my @data;
+  my @res=();
+  my @tot=();
+  for (@days)
+  {
+    push @res,defined($sub{$_}->{$arch})?$sub{$_}->{$arch}:0;
+    push @tot,defined($subt{$_})?$subt{$_}:0;
+  }
+  @data=(\@date,\@res,\@tot);
+  @labels=($arch, 'all submisions');
+  $obj=Chart::Composite->new (600,400);
+  $obj->set ('title' => "Number of submissions for $arch");
+  $obj->set ('legend_labels' => \@labels);
+  $obj->set ('brush_size' => 2);
+  $obj->set ('pt_size' => 9);
+  $obj->set ('x_ticks' => 'vertical');
+  $obj->set ('composite_info' => [ ['LinesPoints', [1]], ['LinesPoints', [2] ] ]); 
+  $obj->png ("$dirpng/sub-$arch.png", \@data);
+}
+

Index: popcon.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- popcon.pl	14 Feb 2004 20:54:42 -0000	1.7
+++ popcon.pl	18 Feb 2004 11:51:39 -0000	1.8
@@ -50,7 +50,6 @@
 sub htmlfooter
 {
   my $date=gmtime();
-  print HTML ("\n </pre>\n</p> \n");
   print HTML <<EOF;
 <pre>
 inst     : number of people who installed this package;
@@ -67,14 +66,15 @@
 </p>
 EOF
   print HTML <<EOH
-<p><small>
-</small></p>
+<p>
 <HR>
+<small>
 Made by <a href="mailto:ballombe\@debian.org"> Bill Allombert </a>. Last generated on $date UTC. <br>
 <a href="http://popcon.alioth.debian.org" > Popularity-contest project <a> by Avery Pennarun, Bill Allombert and Petter Reinholdtsen.
 <BR>
 Copyright (C) 2004 <A HREF="http://www.spi-inc.org/">SPI</A>;
 See <A HREF="http://www.debian.org/license">license terms</A>.
+</small>
 </body>
 </html>
 EOH
@@ -258,6 +258,7 @@
     print_by ($dir,$_) for (@fields);
     print HTML ("\n");
   }
+  print HTML ("\n </pre>\n");
   &htmlfooter;
   closedir SEC;
   close HTML;
@@ -292,6 +293,7 @@
 	  }
 	  print HTML ("\n");
   }
+  print HTML ("\n </pre>\n");
   &htmlfooter;
   closedir SEC;
   close HTML;
@@ -321,15 +323,31 @@
 		print_by ($dir,$_) for (@fields);
 		print HTML ("\n");
 	}
-	print HTML "</pre><p>Statistics for architectures\n<pre>";
+	print HTML  <<'EOF';
+</pre>
+<table border="0" cellpadding="5" cellspacing="0" width="100%">
+<tr>
+<td>
+Statistics for architectures
+<pre>
+EOF
         for $f (grep { $_ ne 'unknown' } sort keys %arch)
         {
 		my ($port)=split('-',$f);
-                printf HTML "<a href=\"http://www.debian.org/ports/$port/\">%-16s</a> : %-10s\n",$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\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">
+</td></tr>
+</table>
+<p>
+EOF
 
-	print HTML "</pre>\n<p><a href=\"all-popcon-results.txt.gz\">Raw popularity-contest results</a>\n";
+	print HTML "<a href=\"all-popcon-results.txt.gz\">Raw popularity-contest results</a>\n";
 	&htmlfooter;
 	close HTML;
 }