This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository libconfig-model-dpkg-perl.
commit e0757b72a922ef6327f0162b77cd438b73163570 Author: Dominique Dumont <d...@debian.org> Date: Mon May 5 20:27:23 2014 +0200 CMB::Dpkg::Patch: accept patch file or patch name for edition --- lib/Config/Model/Backend/Dpkg/Patch.pm | 19 ++++++++++--------- t/model_tests.d/dpkg-patch-test-conf.pl | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/Config/Model/Backend/Dpkg/Patch.pm b/lib/Config/Model/Backend/Dpkg/Patch.pm index d677ebd..ded39bc 100644 --- a/lib/Config/Model/Backend/Dpkg/Patch.pm +++ b/lib/Config/Model/Backend/Dpkg/Patch.pm @@ -15,8 +15,6 @@ use IO::File; my $logger = get_logger("Backend::Dpkg::Patch"); -my $patch_name_for_test = 'some-patch'; - sub suffix { return ''; } sub skip_open { 1;} @@ -39,11 +37,16 @@ sub read { my $patch_dir = $args{root} . $args{config_dir}; my $check = $args{check}; my $node = $args{object}; + my $file_path = $args{file_path}; + + my $patch_name = $node->index_value; - # the default value is used for tests - my $patch_name = $node->index_value || $patch_name_for_test; + my $patch_file + = ($file_path and -e $file_path) ? $file_path + : -e "$patch_dir$file_path" ? "$patch_dir$file_path" + : "$patch_dir$patch_name" ; + $self->{patch_file} = $patch_file; - my $patch_file = "$patch_dir$patch_name"; $logger->info("Parsing patch $patch_file"); my $patch_io = IO::File->new($patch_file) || Config::Model::Exception::Syntax->throw( @@ -127,14 +130,12 @@ sub write { # io_handle is not defined as no file is specified in model - my $patch_dir = $args{root} . $args{config_dir}; my $check = $args{check}; my $node = $args{object}; - my $patch_name = $node->index_value || $patch_name_for_test; - - my $patch_file = "$patch_dir/$patch_name"; + my $patch_file = $self->{patch_file} ; $logger->info("Writing patch $patch_file"); + my $io = IO::File->new($patch_file,'w') || Config::Model::Exception::Syntax->throw( message => "cannot write patch $patch_file" ); diff --git a/t/model_tests.d/dpkg-patch-test-conf.pl b/t/model_tests.d/dpkg-patch-test-conf.pl index 006ac61..b5fe512 100644 --- a/t/model_tests.d/dpkg-patch-test-conf.pl +++ b/t/model_tests.d/dpkg-patch-test-conf.pl @@ -2,7 +2,6 @@ use Data::Dumper; use IO::File; use File::HomeDir ; -# keep in sync with the hardcoded value in Patch backend $conf_file_name = "some-patch"; $conf_dir = 'debian/patches'; @@ -15,6 +14,7 @@ $skip = ( $@ or not -r '/etc/debian_version' ) ? 1 : 0; { name => 'libperl5i' , dump_warnings => [qr/synopsis/], + config_file => $conf_dir.'/'.$conf_file_name, # apply_fix => 1 , check => { 'Bug:0' => 'https://github.com/schwern/perl5i/issues/218', -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits