From 52d097d99176412041811ec3c8c663e4a912d2c7 Mon Sep 17 00:00:00 2001 From: Smylers Date: Fri, 6 Sep 2013 11:56:07 +0100 Subject: [PATCH] Added release manager test for copyright year --- Porting/release_managers_guide.pod | 10 ++++++++++ t/porting/copyright.t | 22 +++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Porting/release_managers_guide.pod b/Porting/release_managers_guide.pod index e900f9c..4c7297f 100644 --- a/Porting/release_managers_guide.pod +++ b/Porting/release_managers_guide.pod @@ -446,6 +446,16 @@ release, this would be 5.13.11). For BLEAD-POINT releases, it needs to refer to the previous BLEAD-POINT release (so for 5.15.3 this would be 5.15.2). +=head3 Check copyright years + +Check that the copyright years are up to date by running: + + $ ./perl t/porting/copyright.t --now + +Remedy any test failures by editing README or perl.c accordingly (search for +the "Copyright"). If updating perl.c, check if the file's own copyright date in +the C comment at the top needs updating, as well as the one printed by C<-v>. + =head3 Check more build configurations Try running the full test suite against multiple Perl configurations. Here are diff --git a/t/porting/copyright.t b/t/porting/copyright.t index e1b7faa..c95286d 100644 --- a/t/porting/copyright.t +++ b/t/porting/copyright.t @@ -12,6 +12,10 @@ C output match each other. If the test fails, update at least one of README and perl.c so that they match reality. +Optionally you can pass the C<--now> option to check they are at the current +year. This isn't checked by default, so that it doesn't fail for people +working on older releases. It should be run before making a new release. + =cut @@ -20,9 +24,25 @@ use strict; BEGIN { require 'test.pl' } +my ($opt) = @ARGV; + my $readme_year = readme_year(); my $v_year = v_year(); -is $readme_year, $v_year, 'README and perl -v copyright dates match'; + +# Check that both copyright dates are up-to-date, but only if requested, so +# that tests still pass for people intentionally working on older versions: +if ($opt eq '--now') +{ + my $current_year = (gmtime)[5] + 1900; + is $v_year, $current_year, 'perl -v copyright includes current year'; + is $readme_year, $current_year, 'README copyright includes current year'; +} + +# Otherwise simply check that the two copyright dates match each other: +else +{ + is $readme_year, $v_year, 'README and perl -v copyright dates match'; +} done_testing; -- 2.7.4