[libconfig-model-dpkg-perl] 01/03: fix comment handling before Description (Closes: #877984)
dod at debian.org
dod at debian.org
Mon Oct 9 12:01:33 UTC 2017
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 77d5ab14f14913edf5c327f42b74cf8a858140e9
Author: Dominique Dumont <dod at debian.org>
Date: Mon Oct 9 13:58:37 2017 +0200
fix comment handling before Description (Closes: #877984)
---
lib/Config/Model/Backend/Dpkg/Control.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/Config/Model/Backend/Dpkg/Control.pm b/lib/Config/Model/Backend/Dpkg/Control.pm
index 496b8c8..4953739 100644
--- a/lib/Config/Model/Backend/Dpkg/Control.pm
+++ b/lib/Config/Model/Backend/Dpkg/Control.pm
@@ -158,7 +158,7 @@ sub store_section_element_in_tree {
# error message
my $found = $node->find_element( $key, case => 'any' ) || $key;
- # v_ref is a list of ($value, $line_nb ,$note, at comment) = @$v_ref;
+ # v_ref is a list of (@comment , [ value, $line_nb ,$note ] )
my $elt_obj = $node->fetch_element( name => $found, check => $check );
my $type = $node->element_type($found);
@@ -167,8 +167,10 @@ sub store_section_element_in_tree {
$self->store_section_list_element ( $logger, $elt_obj, $check, $v_ref);
}
elsif ($found eq 'Description' and $elt_obj) {
- my ($synopsis_ref, @desc_ref) = $v_ref->@*;
- $self->store_section_leaf_element ( $logger, $node->fetch_element('Synopsis'), $check, [$synopsis_ref]);
+ my @comment = grep { not ref($_) } $v_ref->@*;
+ my ($synopsis_ref, @desc_ref) = grep { ref($_) } $v_ref->@*;
+ # comment is attached to synopsis to write it back at the same place.
+ $self->store_section_leaf_element ( $logger, $node->fetch_element('Synopsis'), $check, [@comment, $synopsis_ref]);
$self->store_section_leaf_element ( $logger, $node->fetch_element('Description'), $check, \@desc_ref);
}
elsif ($elt_obj ) {
@@ -271,6 +273,8 @@ sub package_spec ( $self, $node ) {
$description_ref = \$section[$#section] ;
}
elsif ($elt eq 'Description') {
+ # annotation attached to Description is written as a
+ # comment *after* the Description block
$$description_ref .= "\n".$node->fetch_element_value($elt) ; # mandatory field
}
else {
--
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