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

lintian: r865 - in trunk: checks debian testset testset/libbaz/debian



Author: rra
Date: 2007-04-28 05:03:09 +0200 (Sat, 28 Apr 2007)
New Revision: 865

Modified:
   trunk/checks/shared-libs
   trunk/checks/shared-libs.desc
   trunk/debian/changelog
   trunk/testset/libbaz/debian/control
   trunk/testset/libbaz/debian/lib.shlibs
   trunk/testset/tags.libbaz
Log:
* checks/shared-libs{.desc,}:
  + [RA] Warn if a package declares dependencies in its shlibs control
    file that cannot be satisfied by that package (including via
    Provides).  (Closes: #56440)

Modified: trunk/checks/shared-libs
===================================================================
--- trunk/checks/shared-libs	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/checks/shared-libs	2007-04-28 03:03:09 UTC (rev 865)
@@ -20,6 +20,7 @@
 
 package Lintian::shared_libs;
 use strict;
+use Dep;
 use Tags;
 use File::Basename;
 use Util;
@@ -309,6 +310,7 @@
     } else {
 	my %shlibs_control_used;
 	my %shlibs_control;
+	my @shlibs_depends;
 	open(SHLIBS,$shlibs_control_file) or fail("cannot open shlibs control file $shlibs_control_file for reading: $!");
 	while (<SHLIBS>) {
 	    chop;
@@ -321,6 +323,7 @@
 		tag "duplicate-entry-in-shlibs-control-file", $shlibs_string;
 	    } else {
 		$shlibs_control{$shlibs_string} = 1;
+		push (@shlibs_depends, join (' ', @words[2 .. $#words]));
 	    }
 	}
 	close(SHLIBS);
@@ -347,6 +350,35 @@
 	    tag "unused-shlib-entry-in-control-file", $shlib_name
 		unless $shlibs_control_used{$shlib_name};
 	}
+
+	# Check that all of the packages listed as dependencies in the shlibs
+	# file are satisfied by the current package or its Provides.
+	# Normally, packages should only declare dependencies in their shlibs
+	# that they themselves can satisfy.
+	#
+	# Deduplicate the list of dependencies before warning so that we don't
+	# dupliate warnings.
+	my $provides = $pkg;
+	if (open (VERSION, 'fields/version')) {
+	    my $version = <VERSION>;
+	    close VERSION;
+	    chomp $version;
+	    $provides .= " (= $version)";
+	}
+	if (open (PROVIDES, 'fields/provides')) {
+	    my $line = <PROVIDES>;
+	    close PROVIDES;
+	    chomp $line;
+	    $provides .= ", $line";
+	}
+	$provides = Dep::parse($provides);
+	my %seen;
+	@shlibs_depends = grep { !$seen{$_}++ } @shlibs_depends;
+	for my $depend (@shlibs_depends) {
+	    unless (Dep::implies($provides, Dep::parse($depend))) {
+		tag "shlibs-declares-dependency-on-other-package", $depend;
+	    }
+	}
     }
 }
 

Modified: trunk/checks/shared-libs.desc
===================================================================
--- trunk/checks/shared-libs.desc	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/checks/shared-libs.desc	2007-04-28 03:03:09 UTC (rev 865)
@@ -122,6 +122,21 @@
  is not installed by this package.
 Ref: policy 8.6
 
+Tag: shlibs-declares-dependency-on-other-package
+Type: warning
+Info: This package declares in its shlibs control file a dependency on
+ some other package (and not one listed in the Provides of this package).
+ .
+ Packages should normally only list in their shlibs control file the
+ shared libraries included in that package, and therefore the dependencies
+ listed there should normally be satisfied by either the package itself or
+ one of its Provides.
+ .
+ In unusual circumstances where it's necessary to declare more complex
+ dependencies in the shlibs control file, please add a lintian override
+ for this warning.
+Ref: policy 8.6
+
 Tag: ldconfig-symlink-referencing-wrong-file
 Type: error
 Info: The symbolic link references the wrong file. (It should reference

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/debian/changelog	2007-04-28 03:03:09 UTC (rev 865)
@@ -56,8 +56,12 @@
     + [RA] Add pike7.6 and ruby1.9 as valid interpreters.
     + [RA] Diagnose use of /bin/env with a more specific message than the
       generic unusual interpreter tag.
+  * checks/shared-libs{.desc,}:
+    + [RA] Warn if a package declares dependencies in its shlibs control
+      file that cannot be satisfied by that package (including via
+      Provides).  (Closes: #56440)
 
- -- Russ Allbery <rra@debian.org>  Fri, 27 Apr 2007 19:22:32 -0700
+ -- Russ Allbery <rra@debian.org>  Fri, 27 Apr 2007 20:02:07 -0700
 
 lintian (1.23.29) unstable; urgency=low
 

Modified: trunk/testset/libbaz/debian/control
===================================================================
--- trunk/testset/libbaz/debian/control	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/testset/libbaz/debian/control	2007-04-28 03:03:09 UTC (rev 865)
@@ -7,6 +7,7 @@
 
 Package: libbaz1
 Architecture: any
+Provides: libbaz
 Description: test handling of library packages
  Regression test for lintian's handling of libraries
 

Modified: trunk/testset/libbaz/debian/lib.shlibs
===================================================================
--- trunk/testset/libbaz/debian/lib.shlibs	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/testset/libbaz/debian/lib.shlibs	2007-04-28 03:03:09 UTC (rev 865)
@@ -1,6 +1,8 @@
-libdoesntexist2 1.0 libbaz2
-libdoesntexist2 1.0 libbaz2
-libbaz2 1.1 libbaz2
-libbaz3 1 libbaz2
+libdoesntexist2 1.0 libbaz1
+libdoesntexist2 1.0 libbaz1
+libbaz2 1.1 libbaz
+libbaz3 1 libbaz1 (>> 1)
+libbaz4 1 libbaz1 (= 1)
+libbaz5 1 libbaz2
 udeb: libdoesntexist2 1.0 libbaz2
 udeb: libdoesntexist2 1.0 libbaz2

Modified: trunk/testset/tags.libbaz
===================================================================
--- trunk/testset/tags.libbaz	2007-04-28 02:22:47 UTC (rev 864)
+++ trunk/testset/tags.libbaz	2007-04-28 03:03:09 UTC (rev 865)
@@ -29,7 +29,11 @@
 W: libbaz1: missing-depends-line
 W: libbaz1: package-name-doesnt-match-sonames libbaz3-1 libbaz2-1.0
 W: libbaz1: postinst-should-not-set-usr-doc-link
+W: libbaz1: shlibs-declares-dependency-on-other-package libbaz1 (>> 1)
+W: libbaz1: shlibs-declares-dependency-on-other-package libbaz2
 W: libbaz1: unused-shlib-entry-in-control-file libbaz2 1.1
+W: libbaz1: unused-shlib-entry-in-control-file libbaz4 1
+W: libbaz1: unused-shlib-entry-in-control-file libbaz5 1
 W: libbaz1: unused-shlib-entry-in-control-file libdoesntexist2 1.0
 W: libbaz1: unused-shlib-entry-in-control-file udeb: libdoesntexist2 1.0
 W: libbaz1: zero-byte-file-in-doc-directory usr/share/doc/README.Debian



Reply to: