The following commit has been merged in the master branch:
commit 3525f79792cff51757d99d45f51c96a15e6fa779
Author: Raphael Hertzog <[email protected]>
Date:   Sun Apr 19 20:08:44 2009 +0200

    dpkg-source: don't complain on binary files that are ignored
    
    To avoid mistakes with "3.0 (quilt)" source packages, dpkg-source fails if
    it finds binary files that have not been whitelisted in the debian
    directory. Unfortunately it also fails on binary files that are ignored
    and that will not be included in the debian tarball. This commit fixes
    that although not completely.
    
    The exclude patterns passed to tar --exclude are used to match filenames
    and also full path names inside the tarball. This commit only adds support
    for simple filename match. It is enough for all realistic cases.

diff --git a/debian/changelog b/debian/changelog
index a23e82e..a43e474 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -57,6 +57,9 @@ dpkg (1.15.1) UNRELEASED; urgency=low
     only spaces. Closes: #522787
   * dpkg-source now accepts additional tarballs (in format "3.0 (quilt)")
     with a "component" name containing dashes. Closes: #524376
+  * Fix dpkg-source to not complain on binary files that are ignored and are
+    not going to be included in the debian tarball of a "3.0 (quilt)" source
+    package. Closes: #524375
 
   [ Guillem Jover ]
   * Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
diff --git a/scripts/Dpkg/Source/Package/V2.pm 
b/scripts/Dpkg/Source/Package/V2.pm
index 8d03ab7..81bd841 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -326,7 +326,29 @@ sub do_build {
             }
         }
     };
-    find({ wanted => $check_binary, no_chdir => 1 }, File::Spec->catdir($dir, 
"debian"));
+    my $tar_ignore_glob = "{" . join(",",
+        map {
+            my $copy = $_;
+            $copy =~ s/,/\\,/g;
+            $copy;
+        } @{$self->{'options'}{'tar_ignore'}}) . "}";
+    my $filter_ignore = sub {
+        # Filter out files that are not going to be included in the debian
+        # tarball due to ignores. Note that the filter logic does not
+        # correspond 100% to the logic of tar --exclude as it doesn't
+        # handle matching files on their full path inside the tarball
+        my %exclude;
+        foreach my $fn (glob($tar_ignore_glob)) {
+            $exclude{$fn} = 1;
+        }
+        my @result;
+        foreach my $fn (@_) {
+            push @result, $fn unless exists $exclude{$fn};
+        }
+        return @result;
+    };
+    find({ wanted => $check_binary, preprocess => $filter_ignore },
+         File::Spec->catdir($dir, "debian"));
     error(_g("detected %d unwanted binary file(s) " .
         "(add them in debian/source/include-binaries to allow their " .
         "inclusion)."), $unwanted_binaries) if $unwanted_binaries;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to