From 6c1782e4deb23a76a1ca18d4d29ff37577752250 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 10 Jun 2019 20:29:58 -0400 Subject: [PATCH] Add contributors and test. --- Makefile.in | 1 + docs/CONTRIBUTORS | 11 ++++ test_regress/t/t_dist_contributors.pl | 82 +++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 docs/CONTRIBUTORS create mode 100755 test_regress/t/t_dist_contributors.pl diff --git a/Makefile.in b/Makefile.in index bdaf00d6d..9dcdbb760 100644 --- a/Makefile.in +++ b/Makefile.in @@ -124,6 +124,7 @@ DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING COPYING.LESSER \ bin/verilator_gantt \ bin/verilator_includer \ bin/verilator_profcfunc \ + docs/CONTRIBUTORS \ doxygen-mainpage doxygen.config verilator_logo.png \ install-sh configure *.pod \ include/*.[chv]* \ diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS new file mode 100644 index 000000000..d606f5995 --- /dev/null +++ b/docs/CONTRIBUTORS @@ -0,0 +1,11 @@ +The contributors listed below have certified their Verilator contributions +under the Developer Certificate of Origin +(https://developercertificate.org/). + +Please see the Verilator manual for additional contributors. + +Jeremy Bennett +John Coiner +Kanad Kanhere +Stefan Wallentowitz +Wilson Snyder diff --git a/test_regress/t/t_dist_contributors.pl b/test_regress/t/t_dist_contributors.pl new file mode 100755 index 000000000..80f87cdf8 --- /dev/null +++ b/test_regress/t/t_dist_contributors.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +use IO::File; +use strict; +use vars qw($Self); + +scenarios(dist => 1); + +my $root = ".."; +my $Debug; +my %Contributors; +my %Authors; + +if (!-r "$root/.git") { + skip("Not in a git repository"); +} else { + check(); +} + +ok(1); +1; + +sub check { + read_contributors("$root/docs/CONTRIBUTORS"); + read_user(); + read_authors(); + for my $author (sort keys %Authors) { + print "Check: $author\n" if $Self->{verbose}; + if ($author =~ /(<[^>]+>)/) { + my $email = $1; + if (!$Contributors{$email}) { + error("Certify your contribution by appending '$author' to CONTRIBUTORS"); + } + } + } +} + +sub read_contributors { + my $filename = shift; + my $fh = IO::File->new("<$filename") + or error("$! $filename"); + # Assumes git .mailmap format + while (my $line = ($fh && $fh->getline)) { + while ($line =~ /(<[^>]+>)/g) { + $line =~ s/ *<[^>]+>//; + $Contributors{$1} = 1; + } + } +} + +sub read_user { + my $changes = `cd $root ; git diff-index --quiet HEAD --`; + chomp $changes; + if (!$changes) { + print "No git changes\n" if $Self->{verbose}; + } else { + # Uncommitted changes, so check the user's git name + my $user = `git config user.name`; + chomp $user; + my $email = `git config user.email`; + chomp $email; + if ($user && $email) { + $Authors{"$user <$email>"} = 1; + } + } +} + +sub read_authors { + # Check recent commits in case did commit + my $git_auths = `git log '--pretty=format:%aN <%aE>' | head -20`; + foreach my $line (split /\n/, $git_auths) { + $line =~ s/ *<[^>]+>//; + $Authors{$line} = 1; + } +}