Parcourir la source

dpkg-source: do not try to apply empty patch set

In format 2.0 and 3.0 (quilt), do not try to apply the patches if
there are none.
Raphael Hertzog il y a 17 ans
Parent
commit
70c760198f
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 2 0
      scripts/Dpkg/Source/Package/V2.pm
  2. 2 1
      scripts/Dpkg/Source/Package/V3/quilt.pm

+ 2 - 0
scripts/Dpkg/Source/Package/V2.pm

@@ -179,6 +179,8 @@ sub get_patches {
 
 sub apply_patches {
     my ($self, $dir, $skip_auto) = @_;
+    my @patches = $self->get_patches($dir, $skip_auto);
+    return unless scalar(@patches);
     my $timestamp = time();
     my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
     open(APPLIED, '>', $applied) || syserr(_g("cannot write %s"), $applied);

+ 2 - 1
scripts/Dpkg/Source/Package/V3/quilt.pm

@@ -137,6 +137,8 @@ sub apply_patches {
                 syserr(_g("can't create symlink %s"), $dest);
         }
     }
+    my @patches = $self->get_patches($dir, $skip_auto);
+    return unless scalar(@patches);
 
     # Apply patches
     my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
@@ -144,7 +146,6 @@ sub apply_patches {
     my $now = time();
     my $pobj = {};
     my $panalysis = {};
-    my @patches = $self->get_patches($dir, $skip_auto);
     foreach my $patch (@patches) {
         my $path = File::Spec->catfile($dir, "debian", "patches", $patch);
         $pobj->{$patch} = Dpkg::Source::Patch->new(filename => $path);