[libconfig-model-dpkg-perl] 03/06: Patch model: can now fix synopsis when using 'cme fix patch my-great-patch'

dod at debian.org dod at debian.org
Fri Jul 18 19:25:31 UTC 2014


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 9b2aa4e2d337f9b33210b4432c21c985eb36c3c3
Author: Dominique Dumont <dod at debian.org>
Date:   Sat Jul 12 17:53:41 2014 +0200

    Patch model: can now fix synopsis when using 'cme fix patch my-great-patch'
---
 lib/Config/Model/Backend/Dpkg/Patch.pm  | 2 +-
 lib/Config/Model/models/Dpkg/Patch.pl   | 6 ++++--
 t/model_tests.d/dpkg-patch-test-conf.pl | 6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/Config/Model/Backend/Dpkg/Patch.pm b/lib/Config/Model/Backend/Dpkg/Patch.pm
index f835743..607a30a 100644
--- a/lib/Config/Model/Backend/Dpkg/Patch.pm
+++ b/lib/Config/Model/Backend/Dpkg/Patch.pm
@@ -39,7 +39,7 @@ sub read {
     my $node      = $args{object};
     my $file_path = $args{file_path};
 
-    my $patch_name = $node->index_value;
+    my $patch_name = $node->index_value || $args{config_file};
 
     my $patch_file
         = ($file_path and -e $file_path) ? $file_path
diff --git a/lib/Config/Model/models/Dpkg/Patch.pl b/lib/Config/Model/models/Dpkg/Patch.pl
index 676c16f..ab5e1bb 100644
--- a/lib/Config/Model/models/Dpkg/Patch.pl
+++ b/lib/Config/Model/models/Dpkg/Patch.pl
@@ -27,9 +27,11 @@ field',
         'warn_unless' => {
           'empty' => {
             'code' => 'defined $_ && /\\w/ ? 1 : 0 ;',
-            'fix' => '$_ = ucfirst( $self->parent->index_value )  ;
+            'fix' => 'my $node = $self->parent;
+$_ = ucfirst( $node->index_value // $node->config_file )  ;
 s/-/ /g;
-',
+s/\\.patch$//;
+s/^\\d+\\s*//;',
             'msg' => 'Empty synopsis'
           }
         }
diff --git a/t/model_tests.d/dpkg-patch-test-conf.pl b/t/model_tests.d/dpkg-patch-test-conf.pl
index b5fe512..ed1e7a0 100644
--- a/t/model_tests.d/dpkg-patch-test-conf.pl
+++ b/t/model_tests.d/dpkg-patch-test-conf.pl
@@ -13,10 +13,10 @@ $skip = ( $@ or not -r '/etc/debian_version' ) ? 1 : 0;
 @tests = (
     { 
         name => 'libperl5i' ,
-        dump_warnings => [qr/synopsis/],
-        config_file => $conf_dir.'/'.$conf_file_name,
-        # apply_fix => 1 ,
+        config_file => $conf_file_name,
+        apply_fix => 1 ,
         check => {
+            'Synopsis' => 'Some patch',
             'Bug:0' => 'https://github.com/schwern/perl5i/issues/218',
             'Bug:1' => 'https://github.com/schwern/perl5i/issues/219',
             'Origin' => 'https://github.com/doherty/perl5i',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



More information about the Pkg-perl-cvs-commits mailing list