[SCM] Debian package checker branch, master, updated. 2.1.2-6-g9e1d8eb
The following commit has been merged in the master branch:
commit 9e1d8eb9e9db12e7ddfb1864a476231501f9631c
Author: Russ Allbery <rra@debian.org>
Date: Fri Dec 26 22:33:22 2008 -0800
Recognize Ubuntu native packages for NMU and dist checks
* checks/nmu:
+ [RA] Recognize Ubuntu native packages by the target distribution and
suppress NMU tags for them. Based on a patch by Adrien Cunin.
(Closes: #507740)
* data/changelog-file/ubuntu-dists:
+ [RA] New shared list of Ubuntu distributions.
* frontend/lintian:
+ [RA] Recognize Ubuntu native packages by the target distribution and
check them against the correct set of distributions. Based on a
patch by Adrien Cunin. (Closes: #507740)
* lib/Lintian/Data.pm:
+ [RA] New all() method that returns all valid keywords.
diff --git a/checks/nmu b/checks/nmu
index 8581966..e2f1b69 100644
--- a/checks/nmu
+++ b/checks/nmu
@@ -20,6 +20,8 @@
package Lintian::nmu;
use strict;
+
+use Lintian::Data;
use Tags;
use Util;
@@ -28,6 +30,7 @@ sub run {
my $pkg = shift;
my $type = shift;
my $info = shift;
+my $distribution = undef;
my $changelog_mentions_nmu = 0;
my $changelog_mentions_qa = 0;
my $uploader = undef;
@@ -43,7 +46,7 @@ if (-l "debfiles/changelog") {
open (CHANGELOG, '<', "debfiles/changelog")
or fail("Failed opening changelog");
-<CHANGELOG>;
+$distribution = $1 if (<CHANGELOG> =~ /^.* \(.*\) (.*); .*$/);
my $firstline = 1;
while (<CHANGELOG>) {
if ($firstline) {
@@ -82,9 +85,11 @@ if (defined $uploaders) {
}
# No such thing as NMUs in Ubuntu-land.
-if ($version =~ /ubuntu/) {
- $upload_is_nmu = 0;
- $version_nmuness = 0;
+my $ubuntu_dists = Lintian::Data->new('changelog-file/ubuntu-dists');
+my $ubuntu_regex = join('|', 'ubuntu', $ubuntu_dists->all);
+if ($version =~ /$ubuntu_regex/ or $distribution =~ /$ubuntu_regex/) {
+ $upload_is_nmu = 0;
+ $version_nmuness = 0;
}
if ($maintainer =~ /packages\@qa.debian.org/) {
diff --git a/data/changelog-file/ubuntu-dists b/data/changelog-file/ubuntu-dists
new file mode 100644
index 0000000..6a1545d
--- /dev/null
+++ b/data/changelog-file/ubuntu-dists
@@ -0,0 +1,8 @@
+# A list of Ubuntu distributions, used to suppress some checks for Ubuntu
+# packages and to validate Ubuntu distributions.
+
+dapper
+gutsy
+hardy
+intrepid
+jaunty
diff --git a/debian/changelog b/debian/changelog
index 969cd36..210263f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,10 @@ lintian (2.1.3) UNRELEASED; urgency=low
+ [RA] Check for extended descriptions shorter than three lines; they
probably don't contain enough information. Patch from Raphael
Geissert.
+ * checks/nmu:
+ + [RA] Recognize Ubuntu native packages by the target distribution and
+ suppress NMU tags for them. Based on a patch by Adrien Cunin.
+ (Closes: #507740)
* checks/watch-file{,.desc}:
+ [RA] Merge a set of changes by Raphael Geissert:
- Correctly parse multiple line continuations.
@@ -25,6 +29,17 @@ lintian (2.1.3) UNRELEASED; urgency=low
changelog entry when the current changelog entry has a newer
upstream version.
+ * data/changelog-file/ubuntu-dists:
+ + [RA] New shared list of Ubuntu distributions.
+
+ * frontend/lintian:
+ + [RA] Recognize Ubuntu native packages by the target distribution and
+ check them against the correct set of distributions. Based on a
+ patch by Adrien Cunin. (Closes: #507740)
+
+ * lib/Lintian/Data.pm:
+ + [RA] New all() method that returns all valid keywords.
+
* reporting/templates/maintainer.tmpl:
+ [ADB] Print tags affecting udeb packages under a heading for that
package, rather than merging them in to whichever binary package
diff --git a/frontend/lintian b/frontend/lintian
index 0c77c5b..4b96d52 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -627,6 +627,7 @@ import Util;
require Tags;
import Tags;
+require Lintian::Data;
require Lintian::Schedule;
require Lintian::Output;
import Lintian::Output qw(:messages);
@@ -793,12 +794,13 @@ while (my $arg = shift) {
# check distribution field
if (defined $data->{distribution}) {
+ my $ubuntu_dists = Lintian::Data->new ('changelog-file/ubuntu-dists');
+ my $ubuntu_regex = join('|', $ubuntu_dists->all);
if ($data->{distribution} eq 'UNRELEASED') {
# ignore
- } elsif ($data->{'version'} =~ /ubuntu|jaunty|intrepid|hardy|gutsy|dapper/) {
- my @ubuntu_dists = qw(jaunty intrepid hardy gutsy dapper);
- my $regex = '^(' . join ('|', @ubuntu_dists) . ')';
- if ($data->{distribution} !~ /^$regex(-(proposed|updates|backports|security))?$/ ) {
+ } elsif ($data->{version} =~ /ubuntu|$ubuntu_regex/
+ or $data->{distribution} =~ /$ubuntu_regex/) {
+ if ($data->{distribution} !~ /^($ubuntu_regex)(-(proposed|updates|backports|security))?$/ ) {
tag("bad-ubuntu-distribution-in-changes-file",
$data->{distribution});
}
diff --git a/lib/Lintian/Data.pm b/lib/Lintian/Data.pm
index e119488..e529069 100644
--- a/lib/Lintian/Data.pm
+++ b/lib/Lintian/Data.pm
@@ -62,6 +62,11 @@ sub known {
return (exists $self->{data}{$keyword}) ? 1 : undef;
}
+# Return all known keywords (in no particular order).
+sub all {
+ my ($self) = @_;
+ return keys(%{ $self->{data} });
+}
# Query a data object for the value attached to a particular keyword.
sub value {
@@ -85,6 +90,7 @@ Lintian::Data - Lintian interface to query lists of keywords
if ($list->value($keyword) > 1) {
# do something ...
}
+ my @keywords = $list->all;
=head1 DESCRIPTION
@@ -128,6 +134,12 @@ multiple file reads.
=over 4
+=item all()
+
+Returns all keywords listed in the data file as a list (in no particular
+order; the original order is not preserved). In a scalar context, returns
+the number of keywords.
+
=item known(KEYWORD)
Returns true if KEYWORD was listed in the data file represented by this
diff --git a/t/tests/2500_distribution-ubuntu-native.desc b/t/tests/2500_distribution-ubuntu-native.desc
new file mode 100644
index 0000000..0edfd01
--- /dev/null
+++ b/t/tests/2500_distribution-ubuntu-native.desc
@@ -0,0 +1,5 @@
+Testname: distribution-ubuntu-native
+Version: 1.0
+Description: Check *.changes distribution checking for Ubuntu
+Test-Against: bad-distribution-in-changes-file
+References: Debian Bug#507740
diff --git a/t/tests/6000_nmu-ubuntu-native.desc b/t/tests/6000_nmu-ubuntu-native.desc
new file mode 100644
index 0000000..a0efd28
--- /dev/null
+++ b/t/tests/6000_nmu-ubuntu-native.desc
@@ -0,0 +1,5 @@
+Testname: nmu-ubuntu-native
+Version: 1.0
+Description: Test NMU tag suppression for Ubuntu native packages
+Test-Against: changelog-should-mention-nmu
+References: Debian Bug #507740
diff --git a/t/templates/skel/debian/changelog.in b/t/tests/distribution-ubuntu-native/debian/debian/changelog.in
similarity index 61%
copy from t/templates/skel/debian/changelog.in
copy to t/tests/distribution-ubuntu-native/debian/debian/changelog.in
index 240c83a..2731d63 100644
--- a/t/templates/skel/debian/changelog.in
+++ b/t/tests/distribution-ubuntu-native/debian/debian/changelog.in
@@ -1,4 +1,4 @@
-{$srcpkg} ({$version}) unstable; urgency=low
+{$srcpkg} ({$version}) jaunty; urgency=low
* Lintian Test Suite.
* Test: {$testname}
diff --git a/t/tests/basic-non-native/tags b/t/tests/distribution-ubuntu-native/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/distribution-ubuntu-native/tags
diff --git a/t/tests/nmu-ubuntu-native/debian/debian/changelog.in b/t/tests/nmu-ubuntu-native/debian/debian/changelog.in
new file mode 100644
index 0000000..48636ac
--- /dev/null
+++ b/t/tests/nmu-ubuntu-native/debian/debian/changelog.in
@@ -0,0 +1,6 @@
+{$srcpkg} ({$version}) jaunty; urgency=low
+
+ * Lintian Test Suite.
+ * Test: {$testname}
+
+ -- Russ Allbery <rra@debian.org> {$date}
diff --git a/t/tests/basic-non-native/tags b/t/tests/nmu-ubuntu-native/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/nmu-ubuntu-native/tags
--
Debian package checker
Reply to: