summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-16 12:12:01 +0000
committerSadie Powell <sadie@witchery.services>2025-03-16 12:16:02 +0000
commit4700d48b35d56b56fd245d114fcfea905b992bb5 (patch)
treea7246a0f2bb9ff9e3290d1b27a8d036235d4e3b6 /src
parent019b2aafef59565b130758887f91d021021bf4d7 (diff)
Import a slightly modified version of mkauthors from InspIRCd.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/mkauthors57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tools/mkauthors b/src/tools/mkauthors
new file mode 100755
index 000000000..1a864374d
--- /dev/null
+++ b/src/tools/mkauthors
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl
+#
+# (C) 2003-2025 Anope Team
+# Contact us at team@anope.org
+#
+# Please read COPYING and README for further details.
+#
+# Based on the original code of Epona by Lara.
+# Based on the original code of Services by Andy Church.
+
+use v5.26.0;
+use strict;
+use warnings FATAL => qw(all);
+
+use File::Basename qw(dirname);
+use File::Spec::Functions qw(catfile);
+use FindBin qw($RealDir);
+
+my %committers;
+for my $committer (split /\n+/, `git log --pretty='%an <%ae>%n%(trailers:key=Co-Authored-By,valueonly)' HEAD`) {
+ $committers{$committer} ||= 0;
+ $committers{$committer} += 1;
+}
+
+my %authors;
+for my $committer (keys %committers) {
+ open(my $fh, '-|', 'git', 'check-mailmap', $committer);
+ chomp(my $author = <$fh>);
+ close $fh;
+
+ $author = $1 if $author =~ /^(.+) <(?:\S+\@localhost|\S+\@users.noreply.github.com)>$/;
+ next if $author =~ /\[bot\]$/;
+ next if $author =~ /^\(svnadmin\)$/;
+
+ $authors{$author} ||= 0;
+ $authors{$author} += $committers{$committer};
+}
+
+
+my $author_file = catfile dirname(dirname($RealDir)), 'docs', 'AUTHORS.txt';
+open(my $fh, '>', $author_file) or die "Unable to write $author_file: $!";
+say $fh <<"EOH";
+Since the first commit in March 2004 ${\scalar %authors} people have submitted patches, commits,
+and other useful contributions to Anope. These people, ordered by the number of
+contributions they have made, are:
+EOH
+
+for my $author (sort { $authors{$b} <=> $authors{$a} or lc($a) cmp lc($b) } keys %authors) {
+ say $fh " * $author";
+}
+close $fh;
+
+if ($ENV{MKAUTHORS_COMMIT} // 1) {
+ system 'git', 'commit',
+ '--message', 'Update author list.',
+ '--', $author_file;
+}