diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-07-08 20:01:50 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-07-08 22:51:37 +0100 |
commit | 98f793a762f743f59663dcf61935a3648719fc4c (patch) | |
tree | 8d214ba4b7ebc1358a7421a1077a971890bacad1 /Debian/Dgit.pm | |
parent | 4d87a7d43579ecd11d31116e6e9dab4e6adb1af3 (diff) |
Dgit.pm: Break out parsechangelog_loop from dgit
git-debrebase is going to want this.
No functional change except to some debugging messages.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian/Dgit.pm')
-rw-r--r-- | Debian/Dgit.pm | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 8f069f7..066915b 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -31,6 +31,7 @@ use Data::Dumper; use IPC::Open2; use File::Path; use File::Basename; +use Dpkg::Control::Hash; BEGIN { use Exporter (); @@ -67,7 +68,7 @@ BEGIN { changedir git_slurp_config_src gdr_ffq_prev_branchinfo parsecontrolfh parsecontrol parsechangelog - getfield + getfield parsechangelog_loop playtree_setup); # implicitly uses $main::us %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)], @@ -609,6 +610,27 @@ sub getfield ($$) { fail "missing field $field in ".$dctrl->get_option('name'); } +sub parsechangelog_loop ($$$) { + my ($clogcmd, $descbase, $fn) = @_; + # @$clogcmd is qw(dpkg-parsechangelog ...some...options...) + # calls $fn->($thisstanza, $desc); + debugcmd "|",@$clogcmd; + open CLOGS, "-|", @$clogcmd or die $!; + for (;;) { + my $stanzatext = do { local $/=""; <CLOGS>; }; + printdebug "clogp stanza ".Dumper($stanzatext) if $debuglevel>1; + last if !defined $stanzatext; + + my $desc = "$descbase, entry no.$."; + open my $stanzafh, "<", \$stanzatext or die; + my $thisstanza = parsecontrolfh $stanzafh, $desc, 1; + + $fn->($thisstanza, $desc); + } + die $! if CLOGS->error; + close CLOGS or $?==SIGPIPE or failedcmd @$clogcmd; +} + # ========== playground handling ========== # terminology: |