diff options
Diffstat (limited to 'timeseries')
-rwxr-xr-x | timeseries | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/timeseries b/timeseries new file mode 100755 index 00000000..1316c330 --- /dev/null +++ b/timeseries @@ -0,0 +1,85 @@ +#!/usr/bin/perl +# +# Extract information on the fetchmail project size from the NEWS file +# +# Output other than pass-through % lines is tab-separated fields. +# Field 1: release ID +# Field 2: count of fetchmail-friends subscribers +# Field 3: count of fetchmail-announce subscribers +# Field 4: total subscribers to both lists +# Field 5: date of release (days since first datum) +# Field 6: date of release (RFC822 date format) +# +my($release, $date, $jdate); + +%month_offsets = ( + "Jan", 0, + "Feb", 31, + "Mar", 59, + "Apr", 90, + "May", 120, + "Jun", 151, + "Jul", 181, + "Aug", 212, + "Sep", 243, + "Oct", 273, + "Nov", 304, + "Dec", 334, +); + + +sub day_offset +{ + my($datestring) = @_; + my($wday, $month, $day, $time, $zone, $year) = split(' ', $datestring); + my($jdate); + + # We don't deal with leap years here because the baseline day is after + # the last leap year (1996) and there's a long time before the next + # one (2004). + $jdate = ($year - 1996) * 365; + + $jdate += $month_offsets{$month}; + + $jdate += ($day - 1); + + # Baseline day for the size data was Fri Oct 25 23:02:26 EDT 1996 + $jdate -= 297; + + return($jdate); +} + +open(NEWS, "NEWS"); +$release = "unknown"; +$date = "unknown"; +$jdate = "unknown"; +while ($_ = <NEWS>) +{ + my($sum); + + if (/^%/) { + print $_; + } + elsif (/^fetchmail-([^ ]*) \(([^)]*)\):?/) { + $release = $1; + $date = $2; + $jdate = &day_offset($date); + } + elsif (/There are ([0-9]*) people on fetchmail-friends and ([0-9]*) on fetchmail-announce/) { + $sum = $1 + $2; + print "${release}\t$1\t$2\t${sum}\t${jdate}\t${date}\n"; + $release = "unknown"; + $date = "unknown"; + } + elsif (/There are ([0-9]*) people on the fetchmail-friends list./) { + print "$release\t$1\t0\t$1\t$jdate\t$date\n"; + $release = "unknown"; + $date = "unknown"; + } +} + +# end + + + + |