]> err.no Git - dpkg/commitdiff
dpkg-source (2.0/3.0 (quilt)): create stamp file with automatic patch
authorRaphael Hertzog <hertzog@debian.org>
Thu, 8 May 2008 18:17:31 +0000 (20:17 +0200)
committerRaphael Hertzog <hertzog@debian.org>
Thu, 8 May 2008 18:26:52 +0000 (20:26 +0200)
* scripts/Dpkg/Source/Package/V2.pm,
scripts/Dpkg/Source/Package/V3/quilt.pm: Ensure the
.dpkg-source-applied stamp file is created when an automatic patch
is created so that a second build doesn't try to mistakenly
reapply it.

ChangeLog
scripts/Dpkg/Source/Package/V2.pm
scripts/Dpkg/Source/Package/V3/quilt.pm

index 9feccac965d3aad9f2bc31ed06f212f659ad3009..878cce47af04dbbade91e721dd1c7448a48a5a7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-08  Raphael Hertzog  <hertzog@debian.org>
+
+       * scripts/Dpkg/Source/Package/V2.pm,
+       scripts/Dpkg/Source/Package/V3/quilt.pm: Ensure the
+       .dpkg-source-applied stamp file is created when an automatic patch
+       is created so that a second build doesn't try to mistakenly
+       reapply it.
+
 2008-05-08  Raphael Hertzog  <hertzog@debian.org>
 
        * scripts/Dpkg/Source/Functions.pm (is_binary): New function
index dd39976e26b7abd6f2a34fcee8ffa6848c599df4..7d5a0c089f3ea1a6aca95a743cd649c09fe5e2c4 100644 (file)
@@ -386,6 +386,14 @@ sub do_build {
 
 sub register_autopatch {
     my ($self, $dir) = @_;
+    my $autopatch = File::Spec->catfile($dir, "debian", "patches",
+                                        $self->get_autopatch_name());
+    if (-e $autopatch) {
+        my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
+        open(APPLIED, '>>', $applied) || syserr(_g("cannot write %s"), $applied);
+        print APPLIED ($self->get_autopatch_name() . "\n");
+        close(APPLIED);
+    }
 }
 
 # vim:et:sw=4:ts=8
index e995e6658c3c944f0f450972f5708db3ddb9611b..ef270231af8ee6951a8d5c216bec5f9a545e8b9d 100644 (file)
@@ -204,8 +204,10 @@ sub check_patches_applied {
         return;
     }
     unless (-e $applied) {
-        warning(_g("patches have not been applied, applying them now (use --no-preparation to override)"));
-        $self->apply_patches($dir);
+        if (scalar($self->get_patches($dir))) {
+            warning(_g("patches have not been applied, applying them now (use --no-preparation to override)"));
+            $self->apply_patches($dir);
+        }
     }
 }
 
@@ -215,12 +217,16 @@ sub register_autopatch {
     my $has_patch = (grep { $_ eq $auto_patch } $self->get_patches($dir)) ? 1 : 0;
     my $series = $self->get_series_file($dir);
     $series ||= File::Spec->catfile($dir, "debian", "patches", "series");
+    my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
     if (-e "$dir/debian/patches/$auto_patch") {
         # Add auto_patch to series file
         if (not $has_patch) {
             open(SERIES, ">>", $series) || syserr(_g("cannot write %s"), $series);
             print SERIES "$auto_patch\n";
             close(SERIES);
+            open(APPLIED, ">>", $applied) || syserr(_g("cannot write %s"), $applied);
+            print APPLIED "$auto_patch\n";
+            close(APPLIED);
         }
     } else {
         # Remove auto_patch from series