Quellcode durchsuchen

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 vor 16 Jahren
Ursprung
Commit
1731ce5cc2
1 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen
  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'}}) . "}";
         } @{$self->{'options'}{'tar_ignore'}}) . "}";
     my $filter_ignore = sub {
     my $filter_ignore = sub {
         # Filter out files that are not going to be included in the debian
         # 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 %exclude;
+        my $reldir = File::Spec->abs2rel($File::Find::dir, $dir);
         foreach my $fn (glob($tar_ignore_glob)) {
         foreach my $fn (glob($tar_ignore_glob)) {
             $exclude{$fn} = 1;
             $exclude{$fn} = 1;
         }
         }
         my @result;
         my @result;
         foreach my $fn (@_) {
         foreach my $fn (@_) {
-            push @result, $fn unless exists $exclude{$fn};
+            unless (exists $exclude{$fn} or exists $exclude{"$reldir/$fn"}) {
+                push @result, $fn;
+            }
         }
         }
         return @result;
         return @result;
     };
     };