[Reproducible-commits] [dpkg] 05/08: dpkg-source: call quilt only once to apply all patches
Holger Levsen
holger at layer-acht.org
Tue May 3 08:43:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to annotated tag 1.14.27
in repository dpkg.
commit a3ac2a5d4cfdc89da4277ffb436a91306482ec20
Author: Raphael Hertzog <hertzog at debian.org>
Date: Sun Mar 8 15:50:58 2009 +0100
dpkg-source: call quilt only once to apply all patches
Refactor Dpkg::Source::Package::V3::quilt::apply_patches() to
call quilt only once (quilt push -a -q) instead of once per patch. This
dramatically improves performance for packages like glibc that
have a large number of patches.
---
debian/changelog | 2 ++
scripts/Dpkg/Source/Package/V3/quilt.pm | 45 ++++++++++++++++++++-------------
2 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 9c78f0a..dead6ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ dpkg (1.14.27) UNRELEASED; urgency=low
- do not update/create debian/patches/.dpkg-source-applied during build,
it's only meant to document what patches have been applied at extraction
time. Closes: #525835
+ - call quilt only once to apply all patches instead of once per patch
+ when building 3.0 (quilt) source packages. Closes: #518453
-- Raphael Hertzog <hertzog at debian.org> Thu, 09 Apr 2009 20:32:31 +0200
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm
index 132a850..93ce747 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -138,35 +138,44 @@ sub apply_patches {
}
}
- # Apply patches
+ # Apply patches
my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
open(APPLIED, '>', $applied) || syserr(_g("cannot write %s"), $applied);
my $now = time();
- foreach my $patch ($self->get_patches($dir, $skip_auto)) {
+ 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);
- my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
- if (not $self->{'options'}{'without_quilt'}) {
- info(_g("applying %s with quilt"), $patch) unless $skip_auto;
- my $analysis = $patch_obj->analyze($dir);
- foreach my $dir (keys %{$analysis->{'dirtocreate'}}) {
+ $pobj->{$patch} = Dpkg::Source::Patch->new(filename => $path);
+ if ($self->{'options'}{'without_quilt'}) {
+ info(_g("applying %s"), $patch) unless $skip_auto;
+ $pobj->{$patch}->apply($dir, timestamp => $now,
+ force_timestamp => 1, create_dirs => 1,
+ add_options => [ '-E' ]);
+ print APPLIED "$patch\n";
+ } else {
+ $panalysis->{$patch} = $pobj->{$patch}->analyze($dir);
+ foreach my $dir (keys %{$panalysis->{$patch}->{'dirtocreate'}}) {
eval { mkpath($dir); };
syserr(_g("cannot create directory %s"), $dir) if $@;
}
- $self->run_quilt($dir, ['push', $patch],
- delete_env => ['QUILT_PATCH_OPTS'],
- wait_child => 1,
- to_file => '/dev/null');
- foreach my $fn (keys %{$analysis->{'filepatched'}}) {
+ }
+ }
+ if (not $self->{'options'}{'without_quilt'}) {
+ my %opts;
+ $opts{"to_file"} = "/dev/null" if $skip_auto;
+ info(_g("applying all patches with %s"), "quilt push -a -q") unless $skip_auto;
+ $self->run_quilt($dir, ['push', '-a', '-q'],
+ delete_env => ['QUILT_PATCH_OPTS'],
+ wait_child => 1, %opts);
+ foreach my $patch (@patches) {
+ foreach my $fn (keys %{$panalysis->{$patch}->{'filepatched'}}) {
utime($now, $now, $fn) || $! == ENOENT ||
syserr(_g("cannot change timestamp for %s"), $fn);
}
- } else {
- info(_g("applying %s"), $patch) unless $skip_auto;
- $patch_obj->apply($dir, timestamp => $now,
- force_timestamp => 1, create_dirs => 1,
- add_options => [ '-E' ]);
+ print APPLIED "$patch\n";
}
- print APPLIED "$patch\n";
}
close(APPLIED);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list