2022-02-16 03:49:29 +02:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use POSIX qw(strftime);
|
|
|
|
use Encode qw(decode);
|
|
|
|
use Data::Dumper;
|
2023-11-06 20:41:54 +02:00
|
|
|
use Getopt::Long;
|
2023-11-14 20:49:27 +02:00
|
|
|
use Digest::SHA;
|
|
|
|
use utf8;
|
2023-11-06 20:41:54 +02:00
|
|
|
|
2023-11-14 20:49:27 +02:00
|
|
|
use DateTime;
|
|
|
|
use DateTime::Format::ISO8601;
|
2022-02-16 03:49:29 +02:00
|
|
|
|
2023-11-22 21:33:02 +02:00
|
|
|
my @extra_members = (
|
|
|
|
# entries should be of the format
|
|
|
|
# [ <name>, <email>, <date elected> ],
|
|
|
|
# ['Foo Bar', 'foo@bar', DateTime->new(year => 8613, month => 5, day => 22)],
|
2023-11-28 10:07:23 +02:00
|
|
|
['Ronald Bultje', 'rsbultje@gmail.com', DateTime->new(year => 2023, month => 11, day => 28)],
|
|
|
|
['Hendrik Leppkes', 'h.leppkes@gmail.com', DateTime->new(year => 2023, month => 11, day => 28)],
|
|
|
|
['Reimar Döffinger', 'Reimar.Doeffinger@gmx.de', DateTime->new(year => 2023, month => 11, day => 28)],
|
|
|
|
['Alexander Strasser', 'eclipse7@gmx.net', DateTime->new(year => 2023, month => 11, day => 28)],
|
|
|
|
['Baptiste Coudurier', 'baptiste.coudurier@gmail.com', DateTime->new(year => 2023, month => 11, day => 28)],
|
|
|
|
['Shiyou Yin', 'yinshiyou-hf@loongson.cn', DateTime->new(year => 2023, month => 11, day => 28)],
|
2023-11-22 21:33:02 +02:00
|
|
|
);
|
|
|
|
|
2022-02-16 03:49:29 +02:00
|
|
|
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
|
|
|
|
|
2023-11-06 20:41:54 +02:00
|
|
|
sub print_help {
|
|
|
|
print "Usage: $0 [options]\n";
|
|
|
|
print "Options:\n";
|
|
|
|
print " --names Print only the names\n";
|
|
|
|
print " --emails Print only the email addresses\n";
|
|
|
|
print " --full Print both names and email addresses (default)\n";
|
2023-11-14 20:49:27 +02:00
|
|
|
print " --date YY-MM-DD Generate the GA for a given date, defaults to current system time\n";
|
2023-11-06 20:41:54 +02:00
|
|
|
print " -h, --help Show this help message\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $print_full = 1;
|
|
|
|
my $print_names = 0;
|
|
|
|
my $print_emails = 0;
|
2023-11-22 21:33:02 +02:00
|
|
|
my $date_str = DateTime->now()->iso8601;
|
2023-11-06 20:41:54 +02:00
|
|
|
my $help = 0;
|
|
|
|
|
|
|
|
GetOptions(
|
|
|
|
"full" => \$print_full,
|
|
|
|
"names" => \$print_names,
|
|
|
|
"emails" => \$print_emails,
|
|
|
|
"help" => \$help,
|
2023-11-22 21:33:02 +02:00
|
|
|
"date=s" => \$date_str,
|
2023-11-06 20:41:54 +02:00
|
|
|
"h" => \$help,
|
|
|
|
);
|
|
|
|
|
|
|
|
print_help() if $help;
|
|
|
|
|
|
|
|
if ($print_names || $print_emails) {
|
|
|
|
$print_full = 0;
|
|
|
|
}
|
|
|
|
|
2023-11-14 20:49:27 +02:00
|
|
|
sub get_date_range {
|
|
|
|
my ($now) = @_;
|
|
|
|
|
|
|
|
# date on which the GA update rule was established, and the voter list
|
|
|
|
# was extraordinarily updated; cf.:
|
|
|
|
# * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-October/316054.html
|
|
|
|
# Message-Id <169818211998.11195.16532637803201641594@lain.khirnov.net>
|
|
|
|
# * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/316618.html
|
|
|
|
# Message-Id <5efcab06-8510-4226-bf18-68820c7c69ba@betaapp.fastmail.com>
|
|
|
|
my $date_ga_rule = DateTime->new(year => 2023, month => 11, day => 06);
|
|
|
|
# date when the regular update rule is first applied
|
|
|
|
my $date_first_regular = DateTime->new(year => 2024);
|
|
|
|
|
2023-12-07 18:47:47 +02:00
|
|
|
if ($now > $date_ga_rule && $now < $date_first_regular) {
|
2023-11-14 20:49:27 +02:00
|
|
|
return ($date_ga_rule->clone()->set_year($date_ga_rule->year - 3), $date_ga_rule);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($now < $date_ga_rule) {
|
|
|
|
print STDERR "GA before $date_ga_rule is not well-defined, be very careful with the output\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $cur_year_jan = $now->clone()->truncate(to => "year");
|
|
|
|
my $cur_year_jul = $cur_year_jan->clone()->set_month(7);
|
|
|
|
my $date_until = $now > $cur_year_jul ? $cur_year_jul : $cur_year_jan;
|
|
|
|
my $date_since = $date_until->clone()->set_year($date_until->year - 3);
|
|
|
|
|
|
|
|
return ($date_since, $date_until);
|
|
|
|
}
|
|
|
|
|
2023-11-22 21:33:02 +02:00
|
|
|
my $date = DateTime::Format::ISO8601->parse_datetime($date_str);
|
|
|
|
my ($since, $until) = get_date_range($date);
|
2023-11-14 20:49:27 +02:00
|
|
|
|
|
|
|
my @shortlog = split /\n/, decode('UTF-8',
|
|
|
|
`git log --pretty=format:"%aN <%aE>" --since="$since" --until="$until" | sort | uniq -c | sort -r`,
|
|
|
|
Encode::FB_CROAK);
|
2022-02-16 03:49:29 +02:00
|
|
|
my %assembly = ();
|
|
|
|
|
|
|
|
foreach my $line (@shortlog) {
|
|
|
|
my ($count, $name, $email) = $line =~ m/^ *(\d+) *(.*?) <(.*?)>/;
|
|
|
|
if ($count < 20) {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
$name = trim $name;
|
|
|
|
if ($count < 50) {
|
|
|
|
my $true = 0;
|
2023-11-14 20:49:27 +02:00
|
|
|
my @commits = split /(^|\n)commit [a-z0-9]{40}(\n|$)/,
|
|
|
|
decode('UTF-8',
|
|
|
|
`git log --name-only --use-mailmap --author="$email" --since="$since" --until="$until"`,
|
|
|
|
Encode::FB_CROAK);
|
2022-02-16 03:49:29 +02:00
|
|
|
foreach my $commit (@commits) {
|
|
|
|
$true++; # if ($commit =~ /\n[\w\/]+\.(c|h|S|asm|texi)/);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($true < 20) {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$assembly{$name} = $email;
|
|
|
|
}
|
|
|
|
|
2023-11-22 21:33:02 +02:00
|
|
|
foreach my $entry (@extra_members) {
|
|
|
|
my $elected = $entry->[2];
|
2023-12-07 18:47:47 +02:00
|
|
|
if ($date > $elected && $date < $elected->clone()->set_year($elected->year + 2)) {
|
2023-11-22 21:33:02 +02:00
|
|
|
$assembly{$entry->[0]} = $entry->[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-14 20:49:27 +02:00
|
|
|
# generate the output string
|
|
|
|
my @out_lines;
|
2023-11-06 20:41:54 +02:00
|
|
|
foreach my $name (sort keys %assembly) {
|
|
|
|
my $email = $assembly{$name};
|
2023-11-14 20:49:27 +02:00
|
|
|
my $val;
|
2023-11-06 20:41:54 +02:00
|
|
|
if ($print_full) {
|
2023-11-14 20:49:27 +02:00
|
|
|
$val = sprintf("%s <%s>", $name, $email);
|
2023-11-06 20:41:54 +02:00
|
|
|
} elsif ($print_names) {
|
2023-11-14 20:49:27 +02:00
|
|
|
$val = $name;
|
2023-11-06 20:41:54 +02:00
|
|
|
} elsif ($print_emails) {
|
2023-11-14 20:49:27 +02:00
|
|
|
$val = $email;
|
2023-11-06 20:41:54 +02:00
|
|
|
}
|
2023-11-14 20:49:27 +02:00
|
|
|
push(@out_lines, ($val));
|
2022-02-16 03:49:29 +02:00
|
|
|
}
|
2023-11-14 20:49:27 +02:00
|
|
|
my $out_str = join("\n", @out_lines) . "\n";
|
|
|
|
utf8::encode($out_str);
|
|
|
|
|
2023-11-23 11:10:16 +02:00
|
|
|
printf("# GA for $since/$until; %d people; SHA256:%s; HEAD:%s%s",
|
|
|
|
scalar @out_lines, Digest::SHA::sha256_hex($out_str),
|
|
|
|
decode('UTF-8', `git rev-parse HEAD`, Encode::FB_CROAK),
|
|
|
|
$out_str);
|