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

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7



The following commit has been merged in the master branch:
commit f014760b1e971622ca78b59ea0912fca66057c91
Author: Russ Allbery <rra@debian.org>
Date:   Tue Dec 30 13:28:25 2008 -0800

    Clean up /usr/share/doc checks and avoid global $info
    
    * checks/copyright-file{,.desc}:
      + [RA] Clean up checks of a symlinked /usr/share/doc directory and
        avoid making package info global.

diff --git a/checks/copyright-file b/checks/copyright-file
index 571dcd8..9389031 100644
--- a/checks/copyright-file
+++ b/checks/copyright-file
@@ -20,6 +20,10 @@
 
 package Lintian::copyright_file;
 use strict;
+
+use lib "$ENV{'LINTIAN_ROOT'}/checks/";
+use common_data;
+
 use Dep;
 use Spelling;
 use Tags;
@@ -27,23 +31,17 @@ use Util;
 
 use Encode qw(decode);
 
-# Used in depends_on()
-my $info;
-
 sub run {
 
 my $pkg = shift;
 my $type = shift;
-$info = shift;
+my $info = shift;
 
 my $ppkg = quotemeta($pkg);
 
 my $found = 0;
 my $linked = 0;
 
-use lib "$ENV{'LINTIAN_ROOT'}/checks/";
-use common_data;
-
 # Read package contents...
 foreach (sort keys %{$info->index}) {
     my $index_info = $info->index->{$_};
@@ -86,27 +84,23 @@ foreach (sort keys %{$info->index}) {
 	    last;
     	}
 
-	# link might point to a subdirectory of another /usr/share/doc
-	# directory
+	# The symlink may point to a subdirectory of another /usr/share/doc
+	# directory.  This is allowed if this package depends on link and both
+	# packages come from the same source package.
+	#
+	# Policy requires that packages be built from the same source if
+	# they're going to do this, which by my (rra's) reading means that we
+	# should have a strict version dependency.  However, in practice the
+	# copyright file doesn't change a lot and strict version dependencies
+	# cause other problems (such as with arch: any / arch: all package
+	# combinations and binNMUs).
+	#
+	# We therefore just require the dependency for now and don't worry
+	# about the version number.
 	$link =~ s,/.*,,;
-
-    	# this case is allowed, if this package depends on link
-    	# and both packages come from the same source package
-
-	if (not defined $info->field('version')) {
-	    fail("Can't open fields/version: $!");
-	} else {
-	    my $our_version = $info->field('version');
-
-	    # depend on $link pkg?
-	    if ((not depends_on($link, $our_version)) &&
-	         not (exists($known_essential{$link}) &&
-	         defined($known_essential{$link}))) {
-		# no, it does not.
-
-		tag "usr-share-doc-symlink-without-dependency", "$link";
-		last;
-	    }
+	if (not depends_on($info, $link)) {
+	    tag 'usr-share-doc-symlink-without-dependency', $link;
+	    last;
     	}
 
     	# We can only check if both packages come from the same source
@@ -285,7 +279,6 @@ if ($gpl || m,/usr/share/common-licenses/GPL,) {
 	if (defined $info->field('pre-depends')) {
 	    push @depends, split (/\s*,\s*/, scalar $info->field('pre-depends'));
 	}
-	close DEP;
 	if (grep { /^libssl[0-9.]+(\s|\z)/ && !/\|/ } @depends) {
 	    tag 'possible-gpl-code-linked-with-openssl';
 	}
@@ -296,22 +289,17 @@ if ($gpl || m,/usr/share/common-licenses/GPL,) {
 
 # -----------------------------------
 
-# returns true, if $foo depends on $bar
+# Returns true if the package whose information is in $info depends $package
+# or if $package is essential.
 sub depends_on {
-    my ($package, $version) = @_;
-
-    my ($deps, $predeps) = ("", "");
-
-    if (defined $info->field('depends')) {
-	$deps = $info->field('depends');
-    }
-
-    if (defined $info->field('pre-depends')) {
-	$predeps = $info->field('pre-depends');
+    my ($info, $package) = @_;
+    return 1 if $known_essential{$package};
+    my $deps = $info->field('pre-depends') || '';
+    if ($info->field('depends')) {
+	$deps .= ', ' if $deps;
+	$deps .= $info->field('depends');
     }
     return 1 if Dep::implies(Dep::parse($deps), Dep::parse($package));
-    return 1 if Dep::implies(Dep::parse($predeps), Dep::parse($package));
-
     return 0;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 5ed297c..a57321f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ lintian (2.1.4) UNRELEASED; urgency=low
     + [RA] Warn (severity: wishlist) about the old dh_make packaging
       copyright, which used (C) without the word or symbol.  Based on a
       patch by Raphael Geissert.  (Closes: #497347)
+    + [RA] Clean up checks of a symlinked /usr/share/doc directory and
+      avoid making package info global.
   * checks/debhelper{,.desc}:
     + [RA] Check for use of shell brace expansion in debhelper config
       files that list filenames, which is not supported.  Based on a patch
diff --git a/t/tests/6000_copyright-file-doc-symlink.desc b/t/tests/6000_copyright-file-doc-symlink.desc
new file mode 100644
index 0000000..90146ee
--- /dev/null
+++ b/t/tests/6000_copyright-file-doc-symlink.desc
@@ -0,0 +1,4 @@
+Testname: copyright-file-doc-symlink
+Version: 1.0
+Description: Test a symlinked /usr/share/doc
+Test-Against: usr-share-doc-symlink-without-dependency
diff --git a/t/tests/copyright-file-doc-symlink/debian/debian/control.in b/t/tests/copyright-file-doc-symlink/debian/debian/control.in
new file mode 100644
index 0000000..4032211
--- /dev/null
+++ b/t/tests/copyright-file-doc-symlink/debian/debian/control.in
@@ -0,0 +1,35 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 7)
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.
+
+Package: {$srcpkg}-helper
+Architecture: {$architecture}
+Depends: {$srcpkg} (= {$version}), $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description} (symlink)
+ Helper package with a legitimate /usr/share/doc symlink.
+ .
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.
+
+Package: {$srcpkg}-weak
+Architecture: {$architecture}
+Depends: {$srcpkg}, $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description} (weak)
+ Helper package with a /usr/share/doc symlink but an insufficiently
+ strong dependency.  We intentionally don't diagnose this.
+ .
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.
diff --git a/t/tests/copyright-file-doc-symlink/debian/debian/rules b/t/tests/copyright-file-doc-symlink/debian/debian/rules
new file mode 100755
index 0000000..e242291
--- /dev/null
+++ b/t/tests/copyright-file-doc-symlink/debian/debian/rules
@@ -0,0 +1,16 @@
+#!/usr/bin/make -f
+
+pkg := copyright-file-doc-symlink
+
+%:
+	dh $@
+
+binary: binary-indep
+binary-arch:
+binary-indep:
+	dh binary-indep --until dh_prep
+	mkdir -p debian/$(pkg)-helper/usr/share/doc
+	ln -s $(pkg) debian/$(pkg)-helper/usr/share/doc/$(pkg)-helper
+	mkdir -p debian/$(pkg)-weak/usr/share/doc
+	ln -s $(pkg) debian/$(pkg)-weak/usr/share/doc/$(pkg)-weak
+	dh binary --remaining
diff --git a/t/tests/basic-non-native/tags b/t/tests/copyright-file-doc-symlink/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/copyright-file-doc-symlink/tags

-- 
Debian package checker


Reply to: