[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: Move latest-debian-changelog-entry-without-new-date tag into a new check of type "source". (Closes: #873612)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch 873612-please-check-latest-debian-changelog-entry-without-new-date-for-sources-as-well
in repository lintian.

commit 7ab09171ee4335556f78e2b4359d64d30a1b3ea2
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Sep 6 08:25:49 2017 +0100

    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(-)

diff --git a/checks/changelog-file.desc b/checks/changelog-file.desc
index df848ac..07b4346 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 &gt; 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 26b5d7a..74a03be 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 0000000..32f4615
--- /dev/null
+++ b/checks/source-changelog.desc
@@ -0,0 +1,18 @@
+Check-Script: source-changelog
+Author: Chris Lamb <lamby@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 0000000..d37c4d5
--- /dev/null
+++ b/checks/source-changelog.pm
@@ -0,0 +1,52 @@
+# source-changelog -- lintian check script -*- perl -*-
+
+# Copyright (C) 2017 Chris Lamb <lamby@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 bb90f6e..b1cc73a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -98,6 +98,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 712b5cd..db7b848 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 256dd99..f8e432d 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 3b0fb55..ed8f06a 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 f71150a..0b02854 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 9b5d4ef..8d2b800 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 c3cb807..fb0832c 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-qa@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-qa@lists.debian.org>
 I: foo++ source: duplicate-short-description foo++ foo++-helper

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: