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

Bug#542747: [frontend] check mismatch between Distribution and Changes in *.changes



On Thu, 27 May 2010 at 13:22:31 +0100, Simon McVittie wrote:
> Having managed to upload an experimental package to unstable *again*, I've
> written a Lintian check for this.

... which I then failed to attach.
From e6d3e117882c97af2dd5748c95d78eec98e574bd Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Thu, 27 May 2010 13:14:23 +0100
Subject: [PATCH] Bug #540294: add a check for mismatched .changes and Changes: distribution

---
 checks/changes-file      |   15 +++++++++++++++
 checks/changes-file.desc |   14 ++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/checks/changes-file b/checks/changes-file
index 887d19e..34c25d6 100644
--- a/checks/changes-file
+++ b/checks/changes-file
@@ -25,6 +25,8 @@ use Util;
 use Lintian::Tags qw(tag);
 use Lintian::Check qw(check_maintainer);
 
+use Parse::DebianChangelog;
+
 my $check_checksums = $main::check_checksums;
 
 sub run {
@@ -73,6 +75,19 @@ if (defined $info->field('distribution')) {
 	    # bad distribution entry
 	    tag("bad-distribution-in-changes-file", $distribution);
 	}
+
+	my $changes = $info->field('changes');
+	# first line
+	$changes =~ s/^\s+//;
+	$changes =~ s/\n.*//s;
+
+	if ($distribution eq 'unstable' && $changes =~ m/\)\s*experimental\s*;/) {
+	    tag("unstable-in-changes-experimental-in-changelog");
+	}
+	elsif ($changes !~ m/^[^\n]+\)\s*\Q$distribution\E\s*;/) {
+	    tag("distribution-in-changes-does-not-match-changelog",
+		"$distribution / $changes");
+	}
     }
 
     if ($#distributions > 0) {
diff --git a/checks/changes-file.desc b/checks/changes-file.desc
index 5356ae2..346f59d 100644
--- a/checks/changes-file.desc
+++ b/checks/changes-file.desc
@@ -128,3 +128,17 @@ Certainty: certain
 Info: The Changed-By address includes localhost(.localdomain), which is
  an invalid e-mail address.
 Ref: policy 5.6.2
+
+Tag: unstable-in-changes-experimental-in-changelog
+Severity: important
+Certainty: certain
+Info: The <tt>.changes</tt> file is for an upload to unstable, but the
+ <tt>Changes</tt> field copied from <tt>debian/changelog</tt> indicates that
+ experimental was intended.
+
+Tag: distribution-in-changes-does-not-match-changelog
+Severity: normal
+Certainty: possible
+Info: The distribution in the <tt>.changes</tt> file, and the distribution
+ in the <tt>Changes</tt> field copied from <tt>debian/changelog</tt>, do not
+ match.
-- 
1.7.1

Attachment: signature.asc
Description: Digital signature


Reply to: