[Popcon-commits] cvs commit to popularity-contest by pere
popcon-commits at lists.alioth.debian.org
popcon-commits@lists.alioth.debian.org
Fri Jul 15 10:33:05 UTC 2005
Update of /cvsroot/popcon/popularity-contest
In directory haydn:/tmp/cvs-serv9262
Added Files:
clean-genpkglist clean-filter
Log Message:
Add scripts to clean out non-debian packages from the entries, to
make it possible to publish anonymous raw data. Based on code from
Alain Schroeder.
--- NEW FILE: clean-genpkglist ---
#!/bin/sh
#
# Author: Alain Schroeder
# Date: 2005-07-09
# Modified by Petter Reinholdtsen 2005-07-15
tempname=`tempfile`
temp2=`tempfile`
resultfile=packages
archs="alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc"
mirror="http://ftp.fi.debian.org/debian"
for i in $archs; do
wget "$mirror/dists/Debian3.1r0/main/binary-${i}/Packages.gz" -O "$tempname"
zcat $tempname | grep "^Package: " | sed -e 's/^Package: //' >> $temp2
done
sort -u $temp2 > $resultfile
rm $tempname $temp2;
--- NEW FILE: clean-filter ---
#!/usr/bin/perl
#
# Author: Alain Schroeder
# Date: 2005-07-09
# Modified by Petter Reinholdtsen 2005-07-15
use strict;
my %table;
my $foundentry = 0;
my $ignorecount = 0;
my $debug = 0;
open (PACKAGES, '< packages') or
die ("packages not found. please run get-packages.sh first\n");
while (<PACKAGES>) {
chomp;
$table{$_} = "1";
}
close PACKAGES;
while (my $line = <STDIN>) {
if ($line =~ m/^POPULARITY-CONTEST-0/i) {
$foundentry = 1;
$ignorecount = 0;
}
if ($line =~ m/^END-POPULARITY-CONTEST-0/i) {
$foundentry = 0;
print "# Ignored $ignorecount entries\n";
} if ($line =~ m/^\d* \d* (\S*).*/i && !exists $table{$1}) {
print STDERR "Ignoring package $1\n" if $debug;
$ignorecount++;
next;
}
print $line;
}
More information about the Popcon-commits
mailing list