[Popcon-commits] cvs commit to popularity-contest by ballombe
popcon-commits@lists.alioth.debian.org
popcon-commits@lists.alioth.debian.org
Sun, 25 Jan 2004 18:48:41 +0100
Update of /cvsroot/popcon/popularity-contest
In directory quantz:/tmp/cvs-serv31975
Modified Files:
popanal.py popcon-process.sh popcon.pl
Log Message:
Update server-side scripts to popcon.debian.org version.
Index: popanal.py
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popanal.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- popanal.py 14 Sep 2003 12:24:59 -0000 1.2
+++ popanal.py 25 Jan 2004 17:48:39 -0000 1.3
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python
#
# Read Debian popularity-contest submission data on stdin and produce
# some statistics about it.
@@ -35,7 +35,7 @@
provlist = {}
complained = {}
host_arch_list = {}
-host_gnu_type_list = {}
+subcount = 0
def parse_depends(depline):
@@ -108,8 +108,7 @@
start_date = 0
- host_arch = None
- host_gnu_type = None
+ host_arch = "unknown"
# initialize a new entry with known data
def __init__(self, version, owner_id, date):
@@ -160,11 +159,6 @@
else:
host_arch_list[self.host_arch] = host_arch_list[self.host_arch] + 1
- if not host_gnu_type_list.has_key(self.host_gnu_type):
- host_gnu_type_list[self.host_gnu_type] = 1
- else:
- host_gnu_type_list[self.host_gnu_type] = host_gnu_type_list[self.host_gnu_type] + 1
-
def headersplit(pairs):
header = {}
for d in pairs:
@@ -178,7 +172,7 @@
def read_submissions(stream):
- subcount = 0
+ global subcount
e = None
while 1:
line = stream.readline()
@@ -198,12 +192,12 @@
ewrite('#%s' % subcount)
e = Submission(0, header['ID'], header['TIME'])
- if header.has_key('DEB_HOST_ARCH'):
- e.host_arch = header['DEB_HOST_ARCH']
+ if header.has_key('ARCH'):
+ if header['ARCH']=='x86_64':
+ e.host_arch = 'amd64'
+ else:
+ e.host_arch = header['ARCH']
- if header.has_key('DEB_HOST_GNU_TYPE'):
- e.host_gnu_type = header['DEB_HOST_GNU_TYPE']
-
elif split[0]=='END-POPULARITY-CONTEST-0' and e != None:
header = headersplit(split[1:])
if header.has_key('TIME'):
@@ -236,21 +230,16 @@
return new_s
# dump the results
+out = open('results', 'w')
+out.write("Submissions: %8d\n" % subcount)
+
+for host_arch in host_arch_list.keys():
+ out.write("Arch: %-30s %5d\n"
+ % (host_arch, host_arch_list[host_arch]))
for section in sectlist.keys():
- ewrite('Dumping section %s' % nicename(section))
- out = open('results.%s' % nicename(section), 'w')
for package in sectlist[section]:
fv = votelist[package]
- out.write("%-30s %5d %5d %5d %5d\n"
+ out.write("Package: %-30s %5d %5d %5d %5d\n"
% (package, fv.yes, fv.old_unused,
fv.too_recent, fv.empty_package))
- out = open('results.host_arch', 'w')
- for host_arch in host_arch_list.keys():
- out.write("%-30s %5d\n"
- % (host_arch, host_arch_list[host_arch]))
-
- out = open('results.host_gnu_type', 'w')
- for host_gnu_type in host_gnu_type_list.keys():
- out.write("%-30s %5d\n"
- % (host_gnu_type, host_gnu_type_list[host_gnu_type]))
Index: popcon-process.sh
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-process.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- popcon-process.sh 7 Sep 2003 17:27:27 -0000 1.1.1.1
+++ popcon-process.sh 25 Jan 2004 17:48:39 -0000 1.2
@@ -1,32 +1,22 @@
#!/bin/bash
set -e
-PATH=$HOME/bin:$PATH
-cd $HOME
-
+cd /org/popcon.debian.org/popcon-mail
+umask 0002
# rotate files
-rm -rf popcon-entries.old
-mkdir popcon-entries 2>/dev/null || true
-cp -a popcon-entries popcon-entries.old
-mv new-popcon-entries new-popcon-entries.old
-touch new-popcon-entries
-chmod og-rwx new-popcon-entries
+mv ../Mail/survey new-popcon-entries
+touch ../Mail/survey
+chmod go-rwx ../Mail/survey
# process entries
-prepop.py <new-popcon-entries.old >$HOME/prepop.out
+./prepop.py <new-popcon-entries >prepop.out
# delete outdated entries
-find $HOME/popcon-entries -type f -mtime +10 | xargs rm -f
-
-# analyze results
-cd public_html/popcon/results
-rm -f results.*
-find $HOME/popcon-entries -type f | wc -l >../num-submissions
-find $HOME/popcon-entries -type f | xargs cat \
- | nice -15 popanal.py >$HOME/popanal.out 2>&1
-cd ..
-make clean >/dev/null
-make >/dev/null
-
-# upload web page to www.debian.org
-cd $HOME
-rsync -aze ssh public_html people.debian.org: </dev/null
+rm -f results
+find popcon-entries -type f -mtime +10 -print0 | xargs -0 rm -f --
+find popcon-entries -type f | xargs cat \
+ | nice -15 ./popanal.py >popanal.out 2>&1
+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-web
+./popcon.pl
Index: popcon.pl
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- popcon.pl 22 Jan 2004 13:57:33 -0000 1.1
+++ popcon.pl 25 Jan 2004 17:48:39 -0000 1.2
@@ -1,5 +1,8 @@
#! /usr/bin/perl -wT
+
+$results="../popcon-mail/results";
$popcon="../www";
+
sub htmlheader
{
print HTML <<"EOH";
@@ -46,7 +49,7 @@
sub htmlfooter
{
- my $date=`LANG=C date -u`;
+ my $date=gmtime();
print HTML ("\n </pre>\n</p> \n");
print HTML <<EOF;
<pre>
@@ -67,7 +70,7 @@
<p><small>
</small></p>
<HR>
-Made by <a href="mailto:ballombe\@debian.org"> Bill Allombert </a>. Last generated on $date. <br>
+Made by <a href="mailto:ballombe\@debian.org"> Bill Allombert </a>. Last generated on $date UTC. <br>
<a href="http://alioth.debian.org/projects/popcon/" > 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>;
@@ -80,7 +83,6 @@
sub make_sec
{
my $sec="$popcon/$_[0]";
- print "$sec\n";
-d $sec || system("mkdir","-p","$sec");
}
@@ -168,7 +170,6 @@
close AVAIL;
}
$ENV{PATH}="/bin:/usr/bin";
-$numsub=`/bin/cat ../popcon-mail/num-submissions`;
#Format
#<name> <vote> <old> <recent> <no-files>
@@ -181,18 +182,32 @@
#<no-files> is the number of people whose entry didn't contain enough
# information (atime and ctime were 0).
-open PKG, "zcat ../www/all-popcon-results.txt.gz|";
+open PKG, "$results";
while(<PKG>)
{
- my ($name,@votes)=split(" ");
- unshift @votes,$votes[0]+$votes[1]+$votes[2]+$votes[3];
- $section{$name}='unknown' unless (defined($section{$name}));
- $maint{$name}='Not in sid' unless (defined($maint{$name}));
- for(my $i=0;$i<=$#fields;$i++)
+ my ($type,@values)=split(" ");
+ if ($type eq "Package:")
{
- my ($f,$v)=($fields[$i],$votes[$i]);
- $pkg{$name}->{$f}=$v;
- $maintpkg{$maint{$name}}->{$f}+=$v;
+ my @votes=@values;
+ $name = shift @votes;
+ unshift @votes,$votes[0]+$votes[1]+$votes[2]+$votes[3];
+ $section{$name}='unknown' unless (defined($section{$name}));
+ $maint{$name}='Not in sid' unless (defined($maint{$name}));
+ for(my $i=0;$i<=$#fields;$i++)
+ {
+ my ($f,$v)=($fields[$i],$votes[$i]);
+ $pkg{$name}->{$f}=$v;
+ $maintpkg{$maint{$name}}->{$f}+=$v;
+ }
+ }
+ elsif ($type eq "Arch:")
+ {
+ my ($a,$nb)=@values;
+ $arch{$a}=$nb;
+ }
+ elsif ($type eq "Submissions:")
+ {
+ ($numsub)=@values;
}
}
@@ -217,7 +232,6 @@
for $sec (".",@dists)
{
- print "/$sec\n";
my @list = grep {$section{$_} =~ /^$sec/ } @pkgs;
for $order (@fields)
{
@@ -225,7 +239,6 @@
}
}
{
- print "/maint\n";
make_sec "maint";
for $order (@fields)
{
@@ -234,7 +247,6 @@
}
for $sec (@dists)
{
- print "html/$sec\n";
open HTML , "> $popcon/$sec/index.html";
opendir SEC,"$popcon/$sec";
&htmlheader;
@@ -263,7 +275,6 @@
}
for $sec (@dists)
{
- print "html/$sec\n";
open HTML , "> $popcon/$sec/first.html";
opendir SEC,"$popcon/$sec";
&htmlheader;
@@ -297,7 +308,6 @@
close HTML;
}
{
- print "html/\n";
open HTML , "> $popcon/index.html";
&htmlheader;
printf HTML ("<p>Statistics for the whole archive sorted by fields: <pre>",$sec);
@@ -331,7 +341,14 @@
}
print HTML ("\n");
}
- print HTML "<p><a href=\"all-popcon-results.txt.gz\">Raw popularity-contest results</a>\n";
+ print HTML "</pre><p>Statistics for architectures\n<pre>";
+ for $f (grep { $_ ne 'unknown' } sort keys %arch)
+ {
+ printf HTML "<a href=\"http://www.debian.org/ports/$f/\">%-16s</a> : %-10s\n",$f,$arch{$f};
+ }
+ printf HTML "%-16s : %-10s\n","unknown",$arch{"unknown"};
+
+ print HTML "</pre>\n<p><a href=\"all-popcon-results.txt.gz\">Raw popularity-contest results</a>\n";
&htmlfooter;
close HTML;
}