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 232d75af075f152d48808ec5d4e6bf4e902ac0c3
Author: Dominique Dumont <d...@debian.org>
Date:   Fri Dec 2 18:39:42 2016 +0100

    Store unexpected patch line in Description
---
 lib/Config/Model/Backend/Dpkg/Patch.pm | 12 ++++++------
 lib/Config/Model/Backend/DpkgSyntax.pm | 14 +++++++++-----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/lib/Config/Model/Backend/Dpkg/Patch.pm 
b/lib/Config/Model/Backend/Dpkg/Patch.pm
index 28d6f4c..e7eb243 100644
--- a/lib/Config/Model/Backend/Dpkg/Patch.pm
+++ b/lib/Config/Model/Backend/Dpkg/Patch.pm
@@ -126,12 +126,12 @@ sub read {
 
     my $k = 0;
 
-    if ($description_holder) { 
-        my @desc_lines = map { my $pre = ( $k + 1 == $_ ? '' : "\n"); $k = $_; 
$pre.$stuff{$_} }
-            sort { $a <=> $b ;} keys %stuff ;
-        my $desc = ($description_text || '') .join( "\n", @desc_lines );
-        $node->fetch_element($description_holder)->store( value => $desc, 
check => $check );
-    }
+    my @desc_lines = map { my $pre = ( $k + 1 == $_ ? '' : "\n"); $k = $_; 
$pre.$stuff{$_} }
+        sort { $a <=> $b ;} keys %stuff ;
+    my $desc = ($description_text || '') .join( "\n", @desc_lines );
+    $description_holder //= 'Description';
+    $node->fetch_element($description_holder)->store( value => $desc, check => 
$check );
+
     $node->fetch_element('diff')->store(join('',@$diff));
 
     return 1;
diff --git a/lib/Config/Model/Backend/DpkgSyntax.pm 
b/lib/Config/Model/Backend/DpkgSyntax.pm
index 83628f0..acfe7a8 100644
--- a/lib/Config/Model/Backend/DpkgSyntax.pm
+++ b/lib/Config/Model/Backend/DpkgSyntax.pm
@@ -96,13 +96,14 @@ sub parse_dpkg_lines {
         } 
         elsif ( $l =~ /^\s+\.$/) {   # line with a single dot
             $logger->trace("dot line: adding blank line to field $key");
-            _store_line($store_ref,$file_path,"",$check,$line_nb) ;
+            _store_line($store_ref,$file_path,"",$check,$line_nb, 
$handle_garbage) ;
         }
         elsif ( $l =~ s/^\s//) {     # non empty line
             $logger->trace("text line: adding '$l' to field $key");
-            _store_line($store_ref,$file_path,$l , $check,$line_nb);
+            _store_line($store_ref,$file_path,$l , $check,$line_nb, 
$handle_garbage);
         }
         elsif ($handle_garbage) {
+            $logger->trace("storing garbage in line $line_nb: $l");
             $handle_garbage->($l, $line_nb) ;
         }
         else {
@@ -141,12 +142,15 @@ sub parse_dpkg_lines {
     return wantarray ? @res : \@res ;   
 }
 
-sub _store_line {
-    my ($store_ref,$file_path,$line,$check,$line_nb) = @_ ;
-    
+sub _store_line ($store_ref,$file_path,$line,$check,$line_nb, $handle_garbage) 
{
+
     if (defined $store_ref) {
         $$store_ref .= "\n$line" ;
     }
+    elsif ($handle_garbage) {
+        $logger->trace("storing garbage in line $line_nb: $line");
+        $handle_garbage->($line, $line_nb) ;
+    }
     else {
         my $msg = "Did not find a keyword before: '$line''";
         Config::Model::Exception::Syntax -> throw (

-- 
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

Reply via email to