tags 873612 + patch thanks Hi Lintian devs,
> lintian: please check latest-debian-changelog-entry-without-new-date > for sources as well Patch attached; could I get some review? I tried to add the check within changelog-file.pm by making it "Type: source, binary", but it required too many conditionals wrt. checking $type here and there so this actually looked far cleaner to me. I moved the tag — as opposed to creating a new one — so that we don't have to change dak, my previous related announcement to -devel, as well as any (I guess possible!) overrides. Diffstat is: checks/changelog-file.desc | 2 +- checks/changelog-file.pm | 2 +- checks/source-changelog.desc | 18 ++++++++++++ checks/source-changelog.pm | 52 ++++++++++++++++++++++++++++++++++ debian/changelog | 3 ++ profiles/debian/main.profile | 5 ++-- t/tests/changelog-file-general/desc | 1 + t/tests/changelog-file-general/tags | 3 +- t/tests/changelog-file-unreleased/desc | 4 ++- t/tests/legacy-foo++/desc | 1 + t/tests/legacy-foo++/tags | 3 +- 11 files changed, 87 insertions(+), 7 deletions(-) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
>From b499b7b80b5a3da4fdd31a2f574505e02b45d277 Mon Sep 17 00:00:00 2001 From: Chris Lamb <la...@debian.org> Date: Sun, 3 Sep 2017 20:29:28 +0100 Subject: [PATCH] Move latest-debian-changelog-entry-without-new-date tag into a new check of type "source". (Closes: #873612) --- checks/changelog-file.desc | 2 +- checks/changelog-file.pm | 2 +- checks/source-changelog.desc | 18 ++++++++++++ checks/source-changelog.pm | 52 ++++++++++++++++++++++++++++++++++ debian/changelog | 3 ++ profiles/debian/main.profile | 5 ++-- t/tests/changelog-file-general/desc | 1 + t/tests/changelog-file-general/tags | 3 +- t/tests/changelog-file-unreleased/desc | 4 ++- t/tests/legacy-foo++/desc | 1 + t/tests/legacy-foo++/tags | 3 +- 11 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 checks/source-changelog.desc create mode 100644 checks/source-changelog.pm diff --git a/checks/changelog-file.desc b/checks/changelog-file.desc index df848ac0c..07b4346be 100644 --- a/checks/changelog-file.desc +++ b/checks/changelog-file.desc @@ -195,7 +195,7 @@ Info: The NEWS.Debian file must be valid UTF-8, an encoding of the Unicode $ iconv -f ISO-8859-1 -t UTF-8 NEWS.Debian > NEWS.Debian.new $ mv NEWS.Debian.new NEWS.Debian -Tag: latest-debian-changelog-entry-without-new-date +Tag: latest-changelog-entry-without-new-date Severity: important Certainty: certain Info: The latest Debian changelog entry has either the same or even an diff --git a/checks/changelog-file.pm b/checks/changelog-file.pm index 26b5d7acb..74a03be96 100644 --- a/checks/changelog-file.pm +++ b/checks/changelog-file.pm @@ -299,7 +299,7 @@ sub run { my $second_timestamp = $entries[1]->Timestamp; if ($first_timestamp && $second_timestamp) { - tag 'latest-debian-changelog-entry-without-new-date' + tag 'latest-changelog-entry-without-new-date' unless (($first_timestamp - $second_timestamp) > 0 or lc($entries[0]->Distribution) eq 'unreleased'); } diff --git a/checks/source-changelog.desc b/checks/source-changelog.desc new file mode 100644 index 000000000..32f4615ea --- /dev/null +++ b/checks/source-changelog.desc @@ -0,0 +1,18 @@ +Check-Script: source-changelog +Author: Chris Lamb <la...@debian.org> +Type: source +Needs-Info: changelog-file, unpacked +Info: This script checks if a source package conforms to policy + with regard to changelog files. + . + Each source package should have a debian/changelog file. + +Tag: latest-debian-changelog-entry-without-new-date +Severity: important +Certainty: certain +Info: The latest Debian changelog entry has either the same or even an + older date as the entry before. + . + This can result in subtle bugs due to the <tt>SOURCE_DATE_EPOCH</tt> + environment variable being the same between the older and newer + versions. diff --git a/checks/source-changelog.pm b/checks/source-changelog.pm new file mode 100644 index 000000000..d37c4d5ea --- /dev/null +++ b/checks/source-changelog.pm @@ -0,0 +1,52 @@ +# source-changelog -- lintian check script -*- perl -*- + +# Copyright (C) 2017 Chris Lamb <la...@debian.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, you can find it on the World Wide +# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA. + +package Lintian::source_changelog; +use strict; +use warnings; +use autodie; +use Parse::DebianChangelog; +use Lintian::Tags qw(tag); + +sub run { + my ($pkg, undef, $info, undef, undef) = @_; + + my @entries = $info->changelog->data; + if (@entries > 1) { + my $first_timestamp = $entries[0]->Timestamp; + my $second_timestamp = $entries[1]->Timestamp; + + if ($first_timestamp && $second_timestamp) { + tag 'latest-debian-changelog-entry-without-new-date' + unless (($first_timestamp - $second_timestamp) > 0 + or lc($entries[0]->Distribution) eq 'unreleased'); + } + } + + return; +} + +1; + +# Local Variables: +# indent-tabs-mode: nil +# cperl-indent-level: 4 +# End: +# vim: syntax=perl sw=4 sts=4 sr et diff --git a/debian/changelog b/debian/changelog index 8565bbe08..df168c6b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -95,6 +95,9 @@ lintian (2.5.53) UNRELEASED; urgency=medium + [CL] Warn about scripts using "nodejs" as an interpreter now that nodejs provides /usr/bin/node. (Closes: #873096) + [BR] Add a statistic tag giving interpreter. + * checks/source-changelog.{desc.pm}: + + [CL] Move latest-debian-changelog-entry-without-new-date tag into a new + check of type "source". (Closes: #873612) * checks/testsuite.{desc,pm}: + [CL] Remove recommendations to add a "Testsuite: autopkgtest" field to debian/control as it is added when needed by dpkg-source(1) diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile index 712b5cd01..db7b848d9 100644 --- a/profiles/debian/main.profile +++ b/profiles/debian/main.profile @@ -8,6 +8,7 @@ Enable-Tags-From-Check: apache2, application-not-library, appstream-metadata, au files, gir, group-checks, huge-usr-share, infofiles, init.d, java, lintian, manpages, md5sums, menu-format, menus, nmu, obsolete-sites, ocaml, patch-systems, phppear, po-debconf, python, rules, scripts, shared-libs, - source-copyright, standards-version, symlinks, systemd, testsuite, triggers, - udev, upstream-metadata, usrmerge, version-substvars, watch-file + source-changelog, source-copyright, standards-version, symlinks, systemd, + testsuite, triggers, udev, upstream-metadata, usrmerge, version-substvars, + watch-file diff --git a/t/tests/changelog-file-general/desc b/t/tests/changelog-file-general/desc index 256dd99e3..f8e432d16 100644 --- a/t/tests/changelog-file-general/desc +++ b/t/tests/changelog-file-general/desc @@ -10,6 +10,7 @@ Test-For: debian-changelog-file-contains-obsolete-user-emacs-settings debian-changelog-line-too-long improbable-bug-number-in-closes + latest-changelog-entry-without-new-date latest-debian-changelog-entry-without-new-date latest-debian-changelog-entry-without-new-version misspelled-closes-bug diff --git a/t/tests/changelog-file-general/tags b/t/tests/changelog-file-general/tags index 3b0fb55e6..ed8f06ac2 100644 --- a/t/tests/changelog-file-general/tags +++ b/t/tests/changelog-file-general/tags @@ -1,5 +1,6 @@ +E: changelog-file-general source: latest-debian-changelog-entry-without-new-date E: changelog-file-general: debian-changelog-file-contains-invalid-email-address unknown@unknown -E: changelog-file-general: latest-debian-changelog-entry-without-new-date +E: changelog-file-general: latest-changelog-entry-without-new-date E: changelog-file-general: possible-missing-colon-in-closes Closes #555555 W: changelog-file-general: changelog-not-compressed-with-max-compression changelog.Debian.gz W: changelog-file-general: changelog-references-temp-security-identifier TEMP-1234567-abcdef diff --git a/t/tests/changelog-file-unreleased/desc b/t/tests/changelog-file-unreleased/desc index f71150abb..0b0285429 100644 --- a/t/tests/changelog-file-unreleased/desc +++ b/t/tests/changelog-file-unreleased/desc @@ -1,5 +1,7 @@ Testname: changelog-file-unreleased Version: 2.0 Description: Suppress new date warnings for UNRELEASED -Test-Against: latest-debian-changelog-entry-without-new-date +Test-Against: + latest-changelog-entry-without-new-date + latest-debian-changelog-entry-without-new-date References: Debian Bug#560149 diff --git a/t/tests/legacy-foo++/desc b/t/tests/legacy-foo++/desc index 9b5d4ef71..8d2b80082 100644 --- a/t/tests/legacy-foo++/desc +++ b/t/tests/legacy-foo++/desc @@ -16,6 +16,7 @@ Test-For: dm-upload-allowed-is-obsolete duplicate-short-description empty-binary-package + latest-changelog-entry-without-new-date latest-debian-changelog-entry-without-new-date malformed-dm-upload-allowed no-copyright-file diff --git a/t/tests/legacy-foo++/tags b/t/tests/legacy-foo++/tags index c3cb8079d..fb0832c8f 100644 --- a/t/tests/legacy-foo++/tags +++ b/t/tests/legacy-foo++/tags @@ -1,6 +1,7 @@ E: foo++ changes: changed-by-address-malformed Marc 'HE' Brockschmidt <he@unknown> E: foo++ source: build-info-in-binary-control-file-section Package foo++ E: foo++ source: debian-control-file-uses-obsolete-national-encoding at line 19 +E: foo++ source: latest-debian-changelog-entry-without-new-date E: foo++ source: malformed-dm-upload-allowed no E: foo++ source: uploader-address-is-on-localhost Jeroen van Wolffelaar<jeroen@localhost.localdomain> E: foo++ source: uploader-address-malformed Josip, I am afraid of spam and think this helps <no_spam_please AT debian.org> @@ -11,7 +12,7 @@ E: foo++ source: wrong-debian-qa-address-set-as-maintainer Lintian Maintainer <d E: foo++-helper: wrong-debian-qa-address-set-as-maintainer Lintian Maintainer <debian...@lists.debian.org> E: foo++: debian-changelog-file-contains-invalid-email-address he@unknown E: foo++: debian-changelog-file-uses-obsolete-national-encoding at line 11 -E: foo++: latest-debian-changelog-entry-without-new-date +E: foo++: latest-changelog-entry-without-new-date E: foo++: no-copyright-file E: foo++: wrong-debian-qa-address-set-as-maintainer Lintian Maintainer <debian...@lists.debian.org> I: foo++ source: duplicate-short-description foo++ foo++-helper -- 2.14.1