-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] e7c16d9 Update README copyright to 2013, and add test #13233
Comments
From @SmylersThis is a bug report for perl from smylers@stripey.com, From e7c16d9cd2ac4cb537a3e050a876d6ccf05e01c9 Mon Sep 17 00:00:00 2001 This is a multi-part message in MIME format. MANIFEST | 1 + --------------1.8.1.2 Inline Patchdiff --git a/MANIFEST b/MANIFEST
index ed47bd3..caf6504 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5373,6 +5373,7 @@ t/porting/bincompat.t Check that {non_,}bincompat_options are ordered
t/porting/checkcase.t Check whether we are case-insensitive-fs-friendly
t/porting/checkcfgvar.t Check that all config.sh-like files are good
t/porting/cmp_version.t Test whether all changed module files have their VERSION bumped
+t/porting/copyright.t Check that copyright year is up to date
t/porting/customized.dat Data file for porting/customized.t
t/porting/customized.t Check all CUSTOMIZED files are as they should be
t/porting/diag.t Test completeness of perldiag.pod
diff --git a/README b/README
index 2967921..5cf3a9e 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-by Larry Wall and others. All rights reserved.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 by Larry Wall and others. All rights reserved.
diff --git a/t/porting/copyright.t b/t/porting/copyright.t
new file mode 100644
index 0000000..48ea7b4
--- /dev/null
+++ b/t/porting/copyright.t
@@ -0,0 +1,24 @@
+#!perl
+
+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file includes the
+current year.
+
+=cut
+
+
+BEGIN { chdir 't'; require './test.pl' }
+
+
+open my $readme, '<', '../README' or die "Opening README failed: $!";
+local $/ = '';
+my $copyright_msg = <$readme>;
+my $year = (gmtime)[5] + 1900;
+like $copyright_msg, qr/\b$year\b/, 'current year in README copyright message';
+
+done_testing;
--------------1.8.1.2--
---
Site configuration information for perl 5.19.4: Configured by smylers at Thu Sep 5 14:42:23 BST 2013. Summary of my perl5 (revision 5 version 19 subversion 4) configuration: Locally applied patches: @INC for perl 5.19.4: Environment for perl 5.19.4: |
From @cpansproutOn Thu Sep 05 07:00:10 2013, smylers@stripey.com wrote:
Hmm. If I’m reading this correctly, then when I try to install last I would prefer a note in the release manager’s guide. While you could see whether the tests are being run under a git -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @SmylersFather Chrysostomos via RT writes:
Ooops, yes. Sorry for not thinking that through properly. Attached is a patch which just puts 2013 in README, since that's well
Yeah, finding the year of the most recent commit is straightforward: find_git_or_skip 'all';
Ah, yes. Only running the test if the current branch is blead would Unless anybody can think of a way of detecting this situation, I'll drop
Indeed. Thanks for your wisdom. Smylers |
From @Smylers0001-Update-README-copyright-to-2013.patchFrom 55e8258e2a1f692e4657494a506bac6a805f1977 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 06:02:41 +0100
Subject: [PATCH] Update README copyright to 2013
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"
This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
For RT #119625.
---
README | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--------------1.8.1.2
Content-Type: text/x-patch; name="0001-Update-README-copyright-to-2013.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Update-README-copyright-to-2013.patch"
diff --git a/README b/README
index 2967921..5cf3a9e 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-by Larry Wall and others. All rights reserved.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 by Larry Wall and others. All rights reserved.
--------------1.8.1.2--
|
From @cpansproutOn Thu Sep 05 22:25:57 2013, smylers@stripey.com wrote:
Thank you. Applied as a271a37.
Or paranoia. :-) -- Father Chrysostomos |
From @SmylersOn Friday I wrote:
The attached includes a commit with a test which simply checks that the That at least ensures that if somebody remembers to update one place,
Another attached commit does that, with a switch on the above test to Cheers Smylers |
From @Smylerscopyright_year.patchFrom a47e2167e8f994ed7f1af70532d0b8475933d6af Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 10:37:29 +0100
Subject: [PATCH 1/3] Enhance runperl doc to mention its return value
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"
This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
t/test.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--------------1.8.1.2
Content-Type: text/x-patch; name="0001-Enhance-runperl-doc-to-mention-its-return-value.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Enhance-runperl-doc-to-mention-its-return-value.patch"
diff --git a/t/test.pl b/t/test.pl
index cdd72ea..5b1ee18 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -548,7 +548,7 @@ USE_OK
}
}
-# runperl - Runs a separate perl interpreter.
+# runperl - Runs a separate perl interpreter and returns its output.
# Arguments :
# switches => [ command-line switches ]
# nolib => 1 # don't use -I../lib (included by default)
--------------1.8.1.2--
From 401755d56fea1e3e498f16bcd1dd9c1778b56288 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 11:07:27 +0100
Subject: [PATCH 2/3] Test that README and perl -v copyright years match
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"
This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
MANIFEST | 1 +
t/porting/copyright.t | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
create mode 100644 t/porting/copyright.t
--------------1.8.1.2
Content-Type: text/x-patch; name="0002-Test-that-README-and-perl-v-copyright-years-match.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-Test-that-README-and-perl-v-copyright-years-match.patch"
diff --git a/MANIFEST b/MANIFEST
index 4679c95..6541f67 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5371,6 +5371,7 @@ t/porting/bincompat.t Check that {non_,}bincompat_options are ordered
t/porting/checkcase.t Check whether we are case-insensitive-fs-friendly
t/porting/checkcfgvar.t Check that all config.sh-like files are good
t/porting/cmp_version.t Test whether all changed module files have their VERSION bumped
+t/porting/copyright.t Check that copyright years match
t/porting/customized.dat Data file for porting/customized.t
t/porting/customized.t Check all CUSTOMIZED files are as they should be
t/porting/diag.t Test completeness of perldiag.pod
diff --git a/t/porting/copyright.t b/t/porting/copyright.t
new file mode 100644
index 0000000..e1b7faa
--- /dev/null
+++ b/t/porting/copyright.t
@@ -0,0 +1,56 @@
+#!perl
+
+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the latest copyright years in the top-level README file and the
+C<perl -v> output match each other.
+
+If the test fails, update at least one of README and perl.c so that they match
+reality.
+
+=cut
+
+
+use TestInit;
+use strict;
+BEGIN { require 'test.pl' }
+
+
+my $readme_year = readme_year();
+my $v_year = v_year();
+is $readme_year, $v_year, 'README and perl -v copyright dates match';
+
+done_testing;
+
+
+sub readme_year
+# returns the latest copyright year from the top-level README file
+{
+
+ open my $readme, '<', '../README' or die "Opening README failed: $!";
+
+ # The copyright message is the first paragraph:
+ local $/ = '';
+ my $copyright_msg = <$readme>;
+
+ my ($year) = $copyright_msg =~ /.*\b(\d{4,})/s
+ or die "Year not found in README copyright message '$copyright_msg'";
+
+ $year;
+}
+
+
+sub v_year
+# returns the latest copyright year shown in perl -v
+{
+
+ my $output = runperl switches => ['-v'];
+ my ($year) = $output =~ /copyright 1987.*\b(\d{4,})/i
+ or die "Copyright statement not found in perl -v output '$output'";
+
+ $year;
+}
--------------1.8.1.2--
From 783864de35fbefed26340c6666a57cfab27e62d4 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 11:56:07 +0100
Subject: [PATCH 3/3] Added release manager test for copyright year
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"
This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
Porting/release_managers_guide.pod | 10 ++++++++++
t/porting/copyright.t | 22 +++++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
--------------1.8.1.2
Content-Type: text/x-patch; name="0003-Added-release-manager-test-for-copyright-year.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0003-Added-release-manager-test-for-copyright-year.patch"
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<perl -v> 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;
--------------1.8.1.2--
|
From @cpansproutOn Tue Sep 10 03:15:55 2013, smylers@stripey.com wrote:
Thank you. Applied: $ git log --reverse -3 --oneline -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#119625 (status was 'resolved')
Searchable as RT119625$
The text was updated successfully, but these errors were encountered: