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