[libconfig-model-dpkg-perl] 02/04: fix patch writer: write description first
dod at debian.org
dod at debian.org
Wed Jan 18 17:31:24 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 55aa7aeb26aa60aa1f5a092ab8485de232061059
Author: Dominique Dumont <dod at debian.org>
Date: Wed Jan 18 16:23:35 2017 +0100
fix patch writer: write description first
wrting order was messed up in 2.086 while fixing #842391
---
lib/Config/Model/Backend/Dpkg/Patch.pm | 41 ++++++++++++++++++----------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/lib/Config/Model/Backend/Dpkg/Patch.pm b/lib/Config/Model/Backend/Dpkg/Patch.pm
index aec9ded..abe8a06 100644
--- a/lib/Config/Model/Backend/Dpkg/Patch.pm
+++ b/lib/Config/Model/Backend/Dpkg/Patch.pm
@@ -177,25 +177,8 @@ sub write {
message => "cannot write patch $patch_file" );
$io->binmode(":utf8");
- # first pass to write all headers
- foreach my $elt ( $node -> get_element_name ) {
- my $elt_obj = $node->fetch_element($elt) ;
- my $type = $node->element_type($elt) ;
-
- my @v = $type eq 'list' ? $elt_obj->fetch_all_values
- : $type eq 'leaf' ? ($elt_obj->fetch)
- : ();
-
- foreach my $v (@v) {
- # say "write $elt -> $v" ;
- next unless defined $v and $v;
- next if grep {$elt eq $_} qw/Description Subject Synopsis diff/;
-
- $io->print("$elt: ");
- $self->write_dpkg_text($io,$v) ;
- }
- }
-
+ # first: write Description or Subject (where the subuject body is written
+ # outside the structured part -- as required by dep-3)
my $synopsis = $node->fetch_element_value('Synopsis') || "";
my $description_body = $node->fetch_element_value('Description') ;
my $subject_body = $node->fetch_element_value('Subject') ;
@@ -221,6 +204,26 @@ sub write {
$self->write_dpkg_text($io, $synopsis) ;
}
+ # second: write all headers
+ foreach my $elt ( $node -> get_element_name ) {
+ my $elt_obj = $node->fetch_element($elt) ;
+ my $type = $node->element_type($elt) ;
+
+ my @v = $type eq 'list' ? $elt_obj->fetch_all_values
+ : $type eq 'leaf' ? ($elt_obj->fetch)
+ : ();
+
+ foreach my $v (@v) {
+ # say "write $elt -> $v" ;
+ next unless defined $v and $v;
+ next if grep {$elt eq $_} qw/Description Subject Synopsis diff/;
+
+ $io->print("$elt: ");
+ $self->write_dpkg_text($io,$v) ;
+ }
+ }
+
+ # third: write subect body
if ($subject_body) {
$io->print($subject_body."\n");
}
--
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