update-ftpstats 947 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use IO::Uncompress::AnyUncompress ":all";
  5. my %data;
  6. my %data2;
  7. my @archs = ("source", "all", "amd64", "arm64", "i386", "alpha", "arm", "armel", "armhf", "hppa",
  8. "hurd-i386", "ia64", "kfreebsd-amd64", "kfreebsd-i386", "mips", "mipsel", "powerpc",
  9. "ppc64el", "s390", "s390x", "sparc");
  10. for my $file (@ARGV) {
  11. my $FH = new IO::Uncompress::AnyUncompress $file, Transparent => 1
  12. or warn "Cannot open $file: $AnyUncompressError\n";
  13. while (<$FH>) {
  14. if (/^(\d{8})\d{6}\|(?:k(?:atie|elly)|process-(?:accepted|upload))(?:\|dak)?\|installed\|[^|]+\|[^|]+\|(\d+)\|([-\w]+)$/) {
  15. if (not defined $data{$1}) {
  16. foreach $a (@archs) {
  17. $data{$1}{$a} = 0;
  18. }
  19. }
  20. $data{$1}{$3} += $2;
  21. $data2{$1}{$3}++;
  22. }
  23. }
  24. }
  25. foreach my $p (sort keys %data) {
  26. print "$p";
  27. foreach $a (@archs) {
  28. print ", $data{$p}{$a}";
  29. }
  30. print "\n";
  31. }