summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-05-14 03:56:51 +0200
committerGuillem Jover <guillem@debian.org>2014-05-17 13:30:54 +0200
commit4f333e1c25e3316f895c82eda3689f6d8a074900 (patch)
tree172d72778adc44234dddca298952df8c4e10e090
parent286ba89fa57931688d2950d9c10f49dc1226f310 (diff)
downloaddpkg-4f333e1c25e3316f895c82eda3689f6d8a074900.tar.gz
Dpkg::Source::Quilt: Refactor write_patch_list()
-rw-r--r--scripts/Dpkg/Source/Quilt.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/Dpkg/Source/Quilt.pm b/scripts/Dpkg/Source/Quilt.pm
index 3f902a88a..2b87bef79 100644
--- a/scripts/Dpkg/Source/Quilt.pm
+++ b/scripts/Dpkg/Source/Quilt.pm
@@ -90,12 +90,7 @@ sub write_db {
$self->setup_db();
my $pc_applied = $self->get_db_file('applied-patches');
- open(my $applied_fh, '>', $pc_applied) or
- syserr(_g('cannot write %s'), $pc_applied);
- foreach my $patch (@{$self->{applied_patches}}) {
- print { $applied_fh } "$patch\n";
- }
- close($applied_fh);
+ $self->write_patch_list($pc_applied, $self->{applied_patches});
}
sub load_series {
@@ -277,6 +272,16 @@ sub read_patch_list {
return @patches;
}
+sub write_patch_list {
+ my ($self, $series, $patches) = @_;
+
+ open my $series_fh, '>', $series or syserr(_g('cannot write %s'), $series);
+ foreach my $patch (@{$patches}) {
+ print { $series_fh } "$patch\n";
+ }
+ close $series_fh;
+}
+
sub restore_quilt_backup_files {
my ($self, $patch, %opts) = @_;
my $patch_dir = $self->get_db_file($patch);