The following commit has been merged in the master branch:
commit e9b2df2133a4fae9d20107bd386dce75891de1a2
Author: Niels Thykier <[email protected]>
Date:   Sat Jul 9 16:32:13 2011 +0200

    Use ProcessableGroup to determine if a package is foreign
    
    With this copyright-file no longer needs the "source" symlink.

diff --git a/checks/copyright-file b/checks/copyright-file
index 53c2af8..7d90d26 100644
--- a/checks/copyright-file
+++ b/checks/copyright-file
@@ -39,6 +39,8 @@ sub run {
 my $pkg = shift;
 my $type = shift;
 my $info = shift;
+my $proc = shift;
+my $group = shift;
 
 my $ppkg = quotemeta($pkg);
 
@@ -105,23 +107,8 @@ foreach (@{$info->sorted_index}) {
            tag 'usr-share-doc-symlink-without-dependency', $link;
            last;
        }
-
-       # We can only check if both packages come from the same source
-       # if our source package is currently unpacked in the lab, too!
-       if (-d 'source') {      # yes, it's unpacked
-
-           # $link from the same source pkg?
-           if (-l "source/binary/$link") {
-               # yes, everything is ok.
-           } else {
-               # no, it is not.
-               tag 'usr-share-doc-symlink-to-foreign-package', $link;
-           }
-       } else {                # no, source is not available
-           tag 
'cannot-check-whether-usr-share-doc-symlink-points-to-foreign-package';
-       }
-
-       # everything is ok.
+       # Check if the link points to a package from the same source.
+       check_cross_link($group, $link);
        last;
     } elsif (m,usr/doc/copyright/$ppkg$,) {
        tag 'old-style-copyright-file';
@@ -343,6 +330,28 @@ sub depends_on {
     return 0;
 }
 
+# Checks cross pkg links for /usr/share/doc/$pkg links
+sub check_cross_link {
+    my ($group, $fpkg) = @_;
+    my $src = $group->get_source_processable();
+    if ( $src ) {
+       # source package is available; check it's list of binary
+       my $bin = $src->info->binaries;
+       return if $bin->{$fpkg};
+       tag 'usr-share-doc-symlink-to-foreign-package', $fpkg;
+    } else {
+       # The source package is not available, but the binary could
+       # be present anyway;  If they are in the same group, they claim
+       # to have the same source (and source version)
+       foreach my $proc ($group->get_processables('binary')){
+           return if($proc->pkg_name eq $fpkg);
+       }
+       # It was not, but since the source package was not present, we cannot
+       # tell if it is foreign or not at this point.
+       tag 
'cannot-check-whether-usr-share-doc-symlink-points-to-foreign-package';
+    }
+}
+
 1;
 
 # Local Variables:
diff --git a/debian/changelog b/debian/changelog
index f44971e..95e2f32 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,10 @@ lintian (2.5.2) UNRELEASED; urgency=low
       helper templates.  This should prevent false-positives for
       some license texts.  Thanks to Charles Plessy for the
       report.  (Closes: #631674)
+    + [NT] Use group data to determine if a package is foreign
+      or not for symlinked /usr/share/doc/<pkg> dirs.  This
+      avoids the need for symlinks between packages in the
+      lab.
   * checks/deb-format{,.desc}:
     + [NT] Allow data.tar.xz as the third member.  Thanks to
       Ansgar Burchardt for the report and patch.

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to