Explorar o código

Dpkg::Source::Package::V2::do_build(): improve matching of ignored files

Modify logic to also match ignored files based on their relative path
inside the source package (and not only on their filename).
Raphaël Hertzog %!s(int64=16) %!d(string=hai) anos
pai
achega
1731ce5cc2
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      scripts/Dpkg/Source/Package/V2.pm

+ 5 - 4
scripts/Dpkg/Source/Package/V2.pm

@@ -336,16 +336,17 @@ sub do_build {
         } @{$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
+        # tarball due to ignores.
         my %exclude;
+        my $reldir = File::Spec->abs2rel($File::Find::dir, $dir);
         foreach my $fn (glob($tar_ignore_glob)) {
             $exclude{$fn} = 1;
         }
         my @result;
         foreach my $fn (@_) {
-            push @result, $fn unless exists $exclude{$fn};
+            unless (exists $exclude{$fn} or exists $exclude{"$reldir/$fn"}) {
+                push @result, $fn;
+            }
         }
         return @result;
     };