This is an automated email from the git hooks/post-receive script. lamby pushed a commit to branch master in repository lintian.
commit 9689d3c64c75162381539826953facc36f263d64 Author: Chris Lamb <[email protected]> Date: Wed Jul 19 23:07:48 2017 +0100 Check for copyright years that are later than the last entry added to debian/changelog. (Closes: #807461) --- checks/copyright-file.desc | 6 ++++ checks/copyright-file.pm | 26 ++++++++++++----- debian/changelog | 2 ++ .../debian/debian/copyright | 34 ++++++++++++++++++++++ t/tests/copyright-file-year-in-future/desc | 5 ++++ t/tests/copyright-file-year-in-future/tags | 1 + 6 files changed, 67 insertions(+), 7 deletions(-) diff --git a/checks/copyright-file.desc b/checks/copyright-file.desc index fb4bbaa..f2ed0a8 100644 --- a/checks/copyright-file.desc +++ b/checks/copyright-file.desc @@ -400,3 +400,9 @@ Info: The copyright file has lines ending in CRLF instead of just LF. <tt>CR</tt> character in the file: . <tt>sed -i 's/\r//g' path/to/file</tt> + +Tag: copyright-year-in-future +Severity: normal +Certainty: certain +Info: The copyright file refers to a year that is greater than the last entry + in <tt>debian/changelog</tt>. Usually this is a typo. diff --git a/checks/copyright-file.pm b/checks/copyright-file.pm index ac371eb..6c4650b 100644 --- a/checks/copyright-file.pm +++ b/checks/copyright-file.pm @@ -61,6 +61,13 @@ sub run { $found = 1; } + my $latest_year = 0; + my $changes = $info->changelog; + if (defined $changes) { + my ($entry) = $info->changelog->data; + $latest_year = (gmtime($entry->{Timestamp}))[5] + 1900; + } + if (my $index_info = $info->index("$path/copyright")) { $found = 1; if ($index_info->is_symlink) { @@ -328,13 +335,18 @@ qr/GNU (?:Lesser|Library) General Public License|(?-i:\bLGPL\b)/i } # Other flaws in the copyright phrasing or contents. - if ( - $found - && !$linked - && !/(?:Copyright|Copr\.|\302\251)(?:.*|[\(C\):\s]+)\b\d{4}\b - |\bpublic(?:\s+|-)domain\b/xi - ) { - tag 'copyright-without-copyright-notice'; + if ($found && !$linked) { + my $seen_copyright = 0; + while ( + /(?:Copyright|Copr\.|\302\251)(?:.*|[\(C\):\s]+)\b(\d{4})\b + |\bpublic(?:\s+|-)domain\b/xig + ) { + $seen_copyright = 1; + if ($latest_year && $1 > $latest_year) { + tag 'copyright-year-in-future', "($1 > $latest_year)"; + } + } + tag 'copyright-without-copyright-notice' unless $seen_copyright; } check_spelling($_, $group->info->spelling_exceptions, diff --git a/debian/changelog b/debian/changelog index 4f8a470..d707d5b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,8 @@ lintian (2.5.52) UNRELEASED; urgency=medium copyright-contains-automatically-extracted-boilerplate as it can be generated by other tools such as dh-make-elpa. Thanks to Sean Whitton for the report. (Closes: #841832) + + [CL] Check for years that are later than the last entry added to + debian/changelog. (Closes: #807461) * checks/cruft.{desc,pm}: + [CL] Clarify language of source-contains-prebuilt-ms-help-file description; there exists free software to generate .chm files. diff --git a/t/tests/copyright-file-year-in-future/debian/debian/copyright b/t/tests/copyright-file-year-in-future/debian/debian/copyright new file mode 100644 index 0000000..fa6dcdf --- /dev/null +++ b/t/tests/copyright-file-year-in-future/debian/debian/copyright @@ -0,0 +1,34 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: lintian +Upstream-Contact: Lintian Maintainers <[email protected]> +Source: http://git.debian.org/?p=lintian/lintian.git + +Files: * +Copyright: 2199 Always in the Future, Inc. <[email protected]> +License: MIT + Copyright (C) 1900 Always in the Past, Inc. <[email protected]> + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/t/tests/copyright-file-year-in-future/desc b/t/tests/copyright-file-year-in-future/desc new file mode 100644 index 0000000..8ac3d20 --- /dev/null +++ b/t/tests/copyright-file-year-in-future/desc @@ -0,0 +1,5 @@ +Testname: copyright-file-year-in-future +Version: 1.0 +Description: Test for "future" years in debian/copyright +Test-For: + copyright-year-in-future diff --git a/t/tests/copyright-file-year-in-future/tags b/t/tests/copyright-file-year-in-future/tags new file mode 100644 index 0000000..c1e11c8 --- /dev/null +++ b/t/tests/copyright-file-year-in-future/tags @@ -0,0 +1 @@ +W: copyright-file-year-in-future: copyright-year-in-future (2199 > 2017) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git

