]> Pileus Git - ~andy/fetchmail/blob - timeseries
NTLM support integrated.
[~andy/fetchmail] / timeseries
1 #!/usr/bin/perl
2 #
3 # Extract information on the fetchmail project size from the NEWS file
4 #
5 # Output other than pass-through % lines is tab-separated fields.
6 # Field 1: release ID
7 # Field 2: count of fetchmail-friends subscribers
8 # Field 3: count of fetchmail-announce subscribers
9 # Field 4: total subscribers to both lists
10 # Field 5: date of release (days since first datum)
11 # Field 6: date of release (RFC822 date format)
12 #
13 my($release, $date, $jdate);
14
15 %month_offsets = (
16         "Jan",   0,
17         "Feb",   31,
18         "Mar",   59,
19         "Apr",   90,
20         "May",   120,
21         "Jun",   151,
22         "Jul",   181,
23         "Aug",   212,
24         "Sep",   243,
25         "Oct",   273,
26         "Nov",   304,
27         "Dec",   334,
28 );
29
30
31 sub day_offset
32 {
33     my($datestring) = @_;
34     my($wday, $month, $day, $time, $zone, $year) = split(' ', $datestring);
35     my($jdate);
36
37     # We don't deal with leap years here because the baseline day is after
38     # the last leap year (1996) and there's a long time before the next
39     # one (2004).
40     $jdate = ($year - 1996) * 365;
41
42     $jdate += $month_offsets{$month};
43
44     $jdate += ($day - 1);
45
46     # Baseline day for the size data was Fri Oct 25 23:02:26 EDT 1996 
47     $jdate -= 297;
48
49     return($jdate);
50 }
51
52 open(NEWS, "NEWS");
53 $release = "unknown";
54 $date = "unknown";
55 $jdate = "unknown";
56 while ($_ = <NEWS>)
57 {
58     my($sum);
59
60     if (/^%/) {
61         print $_;
62     }
63     elsif (/^fetchmail-([^ ]*) \(([^)]*)\):?/) {
64         $release = $1;
65         $date = $2;
66         $jdate = &day_offset($date);
67     }
68     elsif (/There are ([0-9]*) people on fetchmail-friends and ([0-9]*) on fetchmail-announce/) {
69         $sum = $1 + $2;
70         print "${release}\t$1\t$2\t${sum}\t${jdate}\t${date}\n";
71         $release = "unknown";
72         $date = "unknown";
73     }
74     elsif (/There are ([0-9]*) people on the fetchmail-friends list./) {
75         print "$release\t$1\t0\t$1\t$jdate\t$date\n";
76         $release = "unknown";
77         $date = "unknown";
78     }
79 }
80
81 # end
82
83
84
85