Преглед изворни кода

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 пре 16 година
родитељ
комит
1731ce5cc2
1 измењених фајлова са 5 додато и 4 уклоњено
  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;
     };