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

Bug#507740: Doesn't recognize Ubuntu native packages as Ubuntu packages



Package: lintian
Version: 2.1.0
Severity: normal
Tags: patch

Basically, Ubuntu native packages (like ubuntu-dev-tools) aren't properly
recognized as Ubuntu packages, which triggers false positives:

W: ubuntu-dev-tools source: changelog-should-mention-nmu
W: ubuntu-dev-tools source: source-nmu-has-incorrect-version-number 0.45
E: ubuntu-dev-tools_0.45_source.changes: bad-distribution-in-changes-file
intrepid

This was reported and fixed in Ubuntu, see LP bug #273997 [1].
You can find attached the patch against current git head, with the following
changelog:
  * Recognize Ubuntu native packages as Ubuntu packages
     - Use distribution (and not only version) to decide whether a package
       is an Ubuntu package

[1] https://launchpad.net/bugs/273997

-- 
Adrien Cunin aka Adri2000
diff --git a/checks/nmu b/checks/nmu
index 8581966..6fc679b 100644
--- a/checks/nmu
+++ b/checks/nmu
@@ -28,6 +28,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 +44,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,7 +83,9 @@ if (defined $uploaders) {
 }
 
 # No such thing as NMUs in Ubuntu-land.
-if ($version =~ /ubuntu/) {
+my $ubuntu_dists = join('|', qw(jaunty intrepid hardy gutsy dapper));
+if ($version =~ /ubuntu|$ubuntu_dists/
+    or $distribution =~ /^$ubuntu_dists/) {
     $upload_is_nmu = 0;
     $version_nmuness = 0;
 }
diff --git a/frontend/lintian b/frontend/lintian
index fe9a823..5653e30 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -820,12 +820,12 @@ while (my $arg = shift) {
 
 	    # check distribution field
 	    if (defined $data->{distribution}) {
+		my $ubuntu_dists = join('|', qw(jaunty intrepid hardy gutsy dapper));
 		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_dists/
+		         or $data->{distribution} =~ /^$ubuntu_dists/) {
+		    if ($data->{distribution} !~ /^($ubuntu_dists)(-(proposed|updates|backports|security))?$/) {
 			tag("bad-ubuntu-distribution-in-changes-file",
 			    $data->{distribution});
 		    }

Attachment: signature.asc
Description: Digital signature


Reply to: