From: Raphael Hertzog Date: Thu, 8 May 2008 18:17:31 +0000 (+0200) Subject: dpkg-source (2.0/3.0 (quilt)): create stamp file with automatic patch X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36ac590f5fbb2950330df2aaeb6c3f48455d1891;p=dpkg dpkg-source (2.0/3.0 (quilt)): create stamp file with automatic patch * 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. --- diff --git a/ChangeLog b/ChangeLog index 9feccac9..878cce47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-08 Raphael Hertzog + + * 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 * scripts/Dpkg/Source/Functions.pm (is_binary): New function diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index dd39976e..7d5a0c08 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -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 diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm index e995e665..ef270231 100644 --- a/scripts/Dpkg/Source/Package/V3/quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/quilt.pm @@ -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