[lintian] 01/01: Bug #540294: add checks for mismatched .changes and Changes: distribution
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit 2bd1743e91471bc77c45b0ca96393fcad9ee4996
Author: Simon McVittie <smcv@debian.org>
Date: Wed Jan 28 18:56:11 2015 +0000
Bug #540294: add checks for mismatched .changes and Changes: distribution
The tag is only emitted for known suites, in an attempt to avoid
interfering with non-Debian workflows.
---
checks/changes-file.desc | 33 ++++++++++++++++++++++
checks/changes-file.pm | 27 ++++++++++++++++++
t/changes/changes-distribution-mismatch.changes.in | 16 +++++++++++
t/changes/changes-distribution-mismatch.desc | 6 ++++
t/changes/changes-distribution-mismatch.tags | 1 +
t/changes/changes-experimental-mismatch.changes.in | 16 +++++++++++
t/changes/changes-experimental-mismatch.desc | 6 ++++
t/changes/changes-experimental-mismatch.tags | 1 +
t/changes/changes-unreleased.changes.in | 16 +++++++++++
t/changes/changes-unreleased.desc | 6 ++++
t/changes/changes-unreleased.tags | 1 +
11 files changed, 129 insertions(+)
diff --git a/checks/changes-file.desc b/checks/changes-file.desc
index 43c9ec4..4506ccc 100644
--- a/checks/changes-file.desc
+++ b/checks/changes-file.desc
@@ -146,3 +146,36 @@ Info: The version number doesn't comply with the standard backport version
rules. It should end in ~bpoX+N, where X is the release version number of
the target distribution.
Ref: http://backports.debian.org/Contribute/
+
+Tag: distribution-and-changes-mismatch
+Severity: normal
+Certainty: possible
+Info: The <tt>Distribution</tt> in the <tt>.changes</tt> file indicates
+ that packages should be installed into one distribution (suite), but the
+ distribution in the <tt>Changes</tt> field copied from
+ <tt>debian/changelog</tt> indicates that a different distribution
+ was intended.
+ .
+ This is an easy mistake to make when invoking "sbuild ... foo.dsc".
+ Double-check the <tt>-d</tt> option if using sbuild in this way.
+Ref: #542747, #529281
+
+Tag: distribution-and-experimental-mismatch
+Severity: serious
+Certainty: certain
+Info: The <tt>Distribution</tt> in the <tt>.changes</tt> file indicates
+ that packages should be installed into a non-experimental distribution
+ (suite), but the distribution in the <tt>Changes</tt> field copied from
+ <tt>debian/changelog</tt> indicates that experimental was intended.
+ .
+ This is an easy mistake to make when invoking "sbuild ... foo.dsc".
+ Double-check the <tt>-d</tt> option if using sbuild in this way.
+Ref: #542747, #529281
+
+Tag: unreleased-changes
+Severity: important
+Certainty: certain
+Info: The distribution in the <tt>Changes</tt> field copied from
+ <tt>debian/changelog</tt> indicates that this package was not intended
+ to be released yet.
+Ref: #542747
diff --git a/checks/changes-file.pm b/checks/changes-file.pm
index 09a8340..4b56525 100644
--- a/checks/changes-file.pm
+++ b/checks/changes-file.pm
@@ -122,6 +122,32 @@ sub run {
# bad distribution entry
tag 'bad-distribution-in-changes-file', $distribution;
}
+
+ my $changes = $info->field('changes');
+ if (defined $changes) {
+ # take the first non-empty line
+ $changes =~ s/^\s+//s;
+ $changes =~ s/\n.*//s;
+
+ if ($changes
+ =~ m/^\s*(?:\w[-+0-9a-z.]*)\s*\([^\(\) \t]+\)\s*([-+0-9A-Za-z.]+)\s*;/
+ ) {
+ my $changesdist = $1;
+ if ($changesdist eq 'UNRELEASED') {
+ tag 'unreleased-changes';
+ } elsif ($changesdist ne $distribution
+ && $changesdist ne $dist) {
+ if ( $changesdist eq 'experimental'
+ && $dist ne 'experimental') {
+ tag 'distribution-and-experimental-mismatch',
+ $distribution;
+ } elsif ($KNOWN_DISTS->known($dist)) {
+ tag 'distribution-and-changes-mismatch',
+ $distribution, $changesdist;
+ }
+ }
+ }
+ }
}
}
@@ -129,6 +155,7 @@ sub run {
tag 'multiple-distributions-in-changes-file',
$info->field('distribution');
}
+
}
# Urgency is only recommended by Policy.
diff --git a/t/changes/changes-distribution-mismatch.changes.in b/t/changes/changes-distribution-mismatch.changes.in
new file mode 100644
index 0000000..22dab07
--- /dev/null
+++ b/t/changes/changes-distribution-mismatch.changes.in
@@ -0,0 +1,16 @@
+Format: 1.8
+Date: {$date}
+Source: {$source}
+Binary: {$source}
+Architecture: source all
+Version: {$version}
+Distribution: stable
+Urgency: low
+Maintainer: {$author}
+Changed-By: {$author}
+Description:
+ {$source} - {$description}
+Changes:
+ {$source} ({$version}) unstable; urgency=low
+ .
+ * I used the wrong argument to `sbuild -d`.
diff --git a/t/changes/changes-distribution-mismatch.desc b/t/changes/changes-distribution-mismatch.desc
new file mode 100644
index 0000000..5771b28
--- /dev/null
+++ b/t/changes/changes-distribution-mismatch.desc
@@ -0,0 +1,6 @@
+Testname: changes-distribution-mismatch
+Sequence: 6000
+Version: 1.0
+Description: Test for unstable package to be installed in stable
+Test-For:
+ distribution-and-changes-mismatch
diff --git a/t/changes/changes-distribution-mismatch.tags b/t/changes/changes-distribution-mismatch.tags
new file mode 100644
index 0000000..b558b63
--- /dev/null
+++ b/t/changes/changes-distribution-mismatch.tags
@@ -0,0 +1 @@
+W: changes-distribution-mismatch changes: distribution-and-changes-mismatch stable unstable
diff --git a/t/changes/changes-experimental-mismatch.changes.in b/t/changes/changes-experimental-mismatch.changes.in
new file mode 100644
index 0000000..fa344d6
--- /dev/null
+++ b/t/changes/changes-experimental-mismatch.changes.in
@@ -0,0 +1,16 @@
+Format: 1.8
+Date: {$date}
+Source: {$source}
+Binary: {$source}
+Architecture: source all
+Version: {$version}
+Distribution: unstable
+Urgency: low
+Maintainer: {$author}
+Changed-By: {$author}
+Description:
+ {$source} - {$description}
+Changes:
+ {$source} ({$version}) experimental; urgency=low
+ .
+ * I used the wrong argument to `sbuild -d`.
diff --git a/t/changes/changes-experimental-mismatch.desc b/t/changes/changes-experimental-mismatch.desc
new file mode 100644
index 0000000..cbc7210
--- /dev/null
+++ b/t/changes/changes-experimental-mismatch.desc
@@ -0,0 +1,6 @@
+Testname: changes-experimental-mismatch
+Sequence: 6000
+Version: 1.0
+Description: Test for experimental package to be installed in unstable
+Test-For:
+ distribution-and-experimental-mismatch
diff --git a/t/changes/changes-experimental-mismatch.tags b/t/changes/changes-experimental-mismatch.tags
new file mode 100644
index 0000000..8302562
--- /dev/null
+++ b/t/changes/changes-experimental-mismatch.tags
@@ -0,0 +1 @@
+E: changes-experimental-mismatch changes: distribution-and-experimental-mismatch unstable
diff --git a/t/changes/changes-unreleased.changes.in b/t/changes/changes-unreleased.changes.in
new file mode 100644
index 0000000..d6fbdd8
--- /dev/null
+++ b/t/changes/changes-unreleased.changes.in
@@ -0,0 +1,16 @@
+Format: 1.8
+Date: {$date}
+Source: {$source}
+Binary: {$source}
+Architecture: source all
+Version: {$version}
+Distribution: unstable
+Urgency: low
+Maintainer: {$author}
+Changed-By: {$author}
+Description:
+ {$source} - {$description}
+Changes:
+ {$source} ({$version}) UNRELEASED; urgency=low
+ .
+ * I'm still working on this package, do not upload.
diff --git a/t/changes/changes-unreleased.desc b/t/changes/changes-unreleased.desc
new file mode 100644
index 0000000..29b0a8d
--- /dev/null
+++ b/t/changes/changes-unreleased.desc
@@ -0,0 +1,6 @@
+Testname: changes-unreleased
+Sequence: 6000
+Version: 1.0
+Description: Test for UNRELEASED package uploaded to unstable
+Test-For:
+ unreleased-changes
diff --git a/t/changes/changes-unreleased.tags b/t/changes/changes-unreleased.tags
new file mode 100644
index 0000000..dc61e25
--- /dev/null
+++ b/t/changes/changes-unreleased.tags
@@ -0,0 +1 @@
+E: changes-unreleased changes: unreleased-changes
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: