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

pere at cvs.alioth.debian.org pere at cvs.alioth.debian.org
Sun Jul 17 07:40:04 UTC 2005


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

Modified Files:
	clean-filter 
Log Message:
Clean timestamps as well.

Index: clean-filter
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/clean-filter,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- clean-filter	15 Jul 2005 10:33:03 -0000	1.1
+++ clean-filter	17 Jul 2005 07:40:01 -0000	1.2
@@ -21,19 +21,31 @@
 }
 close PACKAGES;
 
+# Truncate timestamps to the start of the day, to avoid giving out
+# timezone information.
+sub fuzzy_timestamp {
+    my $timestamp = shift;
+    return 86400 * int($timestamp / 86400);
+}
+
 while (my $line = <STDIN>) {
     
     if ($line =~ m/^POPULARITY-CONTEST-0/i) {
 	$foundentry = 1;
 	$ignorecount = 0;
-    }
-    if ($line =~ m/^END-POPULARITY-CONTEST-0/i) {
+	$line =~ s/\b(TIME:)(\d+)\b/sprintf("%s%s", $1,fuzzy_timestamp($2))/e;
+    } elsif ($line =~ m/^END-POPULARITY-CONTEST-0/i) {
 	$foundentry = 0;
 	print "# Ignored $ignorecount entries\n";
-    } if ($line =~ m/^\d* \d* (\S*).*/i && !exists $table{$1}) {
+	$line =~ s/\b(TIME:)(\d+)\b/sprintf("%s%s", $1,fuzzy_timestamp($2))/e;
+    } elsif ($line =~ m/^\d+ \d+ (\S*).*/i && !exists $table{$1}) {
 	print STDERR "Ignoring package $1\n" if $debug;
 	$ignorecount++;
 	next;
+    } elsif ($line =~ m/^(\d+) (\d+) (\S+) (.+)$/i && exists $table{$3}) {
+	# Package entry
+	$line = sprintf("%d %d %s %s\n", fuzzy_timestamp($1),
+			fuzzy_timestamp($2), $3, $4);
     }
     print $line;
 }




More information about the Popcon-commits mailing list