diff options
author | Guillem Jover <guillem@debian.org> | 2014-05-14 03:56:51 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2014-05-17 13:30:54 +0200 |
commit | 4f333e1c25e3316f895c82eda3689f6d8a074900 (patch) | |
tree | 172d72778adc44234dddca298952df8c4e10e090 | |
parent | 286ba89fa57931688d2950d9c10f49dc1226f310 (diff) | |
download | dpkg-4f333e1c25e3316f895c82eda3689f6d8a074900.tar.gz |
Dpkg::Source::Quilt: Refactor write_patch_list()
-rw-r--r-- | scripts/Dpkg/Source/Quilt.pm | 17 |
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); |