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

popcon-commits@lists.alioth.debian.org popcon-commits@lists.alioth.debian.org
Tue, 03 May 2005 18:17:11 +0000


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

Modified Files:
	popanal.py popcon-process.sh popcon.pl 
Log Message:
Update example server-side scripts to popcon.d.o version:
- popcon.pl: Fix typos in index.html header text.
           + Output timings to stdout.
- popanal.py: Catch broken date field in reports.
- popcon-process.sh: redirect popcon.pl output to popcon.log


Index: popanal.py
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popanal.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- popanal.py	18 Jun 2004 23:08:02 -0000	1.11
+++ popanal.py	3 May 2005 18:17:08 -0000	1.12
@@ -137,7 +137,7 @@
     # we found the last line of the survey: finish it
     def done(self, date):
 	ewrite('\t STOP: after %d seconds, %d packages'
-	       % (long(date) - self.start_date, len(self.entries)))
+	       % (date - self.start_date, len(self.entries)))
 	for package in self.entries.keys():
 	    e = self.entries[package]
 	    if deplist.has_key(package):
@@ -202,7 +202,9 @@
             if header.has_key('POPCONVER'):
 		if header['POPCONVER']=='':
 	            e.release = 'unknown'
-                else:
+                elif header['POPCONVER']=='1.27.bill.1':
+                    e.release = '1.27'
+		else:
 	            e.release = header['POPCONVER']
 	
             if header.has_key('ARCH'):
@@ -218,7 +220,12 @@
 	elif split[0]=='END-POPULARITY-CONTEST-0' and e != None:
 	    header = headersplit(split[1:])
 	    if header.has_key('TIME'):
-		e.done(header['TIME'])
+		try:
+		  date = long(header['TIME'])
+		except: 
+		  ewrite('Invalid date: ' + header['TIME'])
+		  continue
+		e.done(date)
 	    e = None
 
 	elif e != None:

Index: popcon-process.sh
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-process.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- popcon-process.sh	15 Feb 2005 18:50:28 -0000	1.7
+++ popcon-process.sh	3 May 2005 18:17:08 -0000	1.8
@@ -23,4 +23,4 @@
 find ../popcon-mail/all-popcon-results -type f -print | sort |./popcon-stat.pl
 
 cd ../popcon-web
-./popcon.pl
+./popcon.pl >popcon.log

Index: popcon.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- popcon.pl	7 Mar 2005 10:39:30 -0000	1.15
+++ popcon.pl	3 May 2005 18:17:08 -0000	1.16
@@ -51,7 +51,12 @@
 {
   print HTML <<"EOH";
   <p> <em> The popularity contest project is an attempt to map the usage of
-  Debian packages.  This site publishes the statistics gathered from report send by users of the <a href="http://packages.debian.org/popularity-contest">popularity-contest</a> 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.
+  Debian packages.  This site publishes the statistics gathered from report
+  sent by users of the <a
+  href="http://packages.debian.org/popularity-contest">popularity-contest</a>
+  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 <a href="README">README</a> and the 
   <a href="FAQ">FAQ</a>.
   </em> <p>
@@ -171,7 +176,10 @@
   print HTML "<a href=\"http://packages.debian.org/$pkg\">$pkgt</a> ",
   ' 'x(20-$size);
 }
-
+sub mark
+{
+  print join(" ",$_[0],times),"\n";
+}
 
 %pkg=();
 %section=();
@@ -197,7 +205,7 @@
   }
   close AVAIL;
 }
-
+mark "Reading legacy packages...";
 
 for $file (glob("/org/ftp.root/debian/dists/testing/*/binary-*/Packages"),glob("/org/ftp.root/debian/dists/sid/*/binary-*/Packages"))
 {
@@ -214,6 +222,8 @@
   }
   close AVAIL;
 }
+mark "Reading current packages...";
+
 $ENV{PATH}="/bin:/usr/bin";
 
 #Format
@@ -261,6 +271,7 @@
     $release{$a}=$nb;
   }
 }
+mark "Reading stats...";
 
 @pkgs=sort keys %pkg;
 %sections = map {$section{$_} => 1} keys %section;
@@ -275,6 +286,8 @@
   make_by ($sec, $_, \%pkg, @list) for (@fields);
 }
 
+mark "Building by sections pages";
+
 @dists=("main","contrib","non-free","non-US");
 #There is a hack: '.' is both the current directory and
 #the catchall regexp.
@@ -311,6 +324,7 @@
   closedir SEC;
   close HTML;
 }
+mark "Building by sub-sections pages";
 for $sec (@dists)
 {
   open HTML , "> $popcon/$sec/first.html";
@@ -346,6 +360,9 @@
   closedir SEC;
   close HTML;
 }
+
+mark "Building winner pages";
+
 {
 	open HTML , "> $popcon/index.html";
 	&htmlheader;
@@ -420,4 +437,4 @@
 	&htmlfooter;
 	close HTML;
 }
-
+mark "Building index.html";