[Popcon-developers] Bug#251435: popularity-contest: stats could include "packages by maintainer"

Emanuele Rocca Emanuele Rocca <ema@debian.org>, 251435@bugs.debian.org
Mon, 16 Aug 2004 23:45:23 +0200


--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: Quoted-Printable

tag 251435 patch
thanks

Hi,
the attached patch makes popcon.pl create a "maintainers" subdirectory
with per-maintainer statistics.

ciao,
	ema
--
Questo =E8 il domani di cui ti preoccupavi ieri. E ora sai perch=E9.

--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="popcon-permaintainer.diff"
Content-Transfer-Encoding: 7Bit

--- /home/ema/debian/packages/popularity-contest-1.24/popcon.pl	2004-06-18 23:09:30.000000000 +0200
+++ popcon.pl	2004-08-16 23:38:56.000000000 +0200
@@ -107,6 +107,8 @@
 {
   my ($sec,$order,$pkg,@list) = @_;
   my %sum;
+  
+  $sec =~ s/(\'|\")/\\$1/g;
   @list = sort {$pkg->{$b}->{$order}<=> $pkg->{$a}->{$order} || $a cmp $b } @list;
   $winner{"$sec/$order"}=$list[0];
   open DAT , "| tee $popcon/$sec/by_$order | gzip -c > $popcon/$sec/by_$order.gz";
@@ -273,6 +275,34 @@
 }
 make_sec "maint";
 make_by ("maint", $_, \%maintpkg, @maints) for (@fields);
+
+{
+  open HTML , "> $popcon/maintainers/index.html";
+  &htmlheader;
+  printf HTML ("<p>Per-maintainer statistics sorted by fields\n <pre>\n");
+  for $maintainer (@maints)
+  { 
+	my @list = grep {$maint{$_} eq $maintainer} @pkgs;
+	$maintainer =~ s/ /_/g;
+	make_sec "maintainers/$maintainer";
+	make_by ("maintainers/$maintainer", $_, \%pkg, @list) for (@fields);
+  }	
+  
+  opendir SEC,"$popcon/maintainers";
+  for $dir (sort readdir SEC)
+  {
+    -d "$popcon/maintainers/$dir" or next;
+    $dir !~ /^\./ or next;
+    printf HTML ("%-36s : ",$dir);
+    print_by ($dir,$_) for (@fields);
+    print HTML ("\n");
+  }
+  closedir SEC;
+
+  print HTML ("\n </pre>\n");
+  &htmlfooter;
+  close HTML;
+}
 for $sec (@dists)
 {
   open HTML , "> $popcon/$sec/index.html";
@@ -383,6 +413,7 @@
 <p>
 EOF
 
+	print HTML "<a href=\"maintainers/index.html\">Per-maintainer statistics</a><br>\n";
 	print HTML "<a href=\"all-popcon-results.txt.gz\">Raw popularity-contest results</a>\n";
 	&htmlfooter;
 	close HTML;

--+HP7ph2BbKc20aGI--