From: Ian Jackson Date: Tue, 25 Oct 2016 14:05:44 +0000 (+0100) Subject: build changes handling: Introduce postbuild_mergechanges X-Git-Tag: archive/debian/2.8~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=9a0e08c9ff1d9b3a53e8399290afcee426f76f7c;hp=4e73f0c77e0a5c679a39c5e78f67adbb217d5922 build changes handling: Introduce postbuild_mergechanges Affects only the `sbuild' subcommand. Mostly code motion. Other changes include: * Provide in_parent, and use it. * "sbuild" changed to "build" in the msg_if_onlyone failure message * Unapply patches before merging changelogs * Reorganise so that it is possible to use this code when there is only one output changes file. Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index 62feb302..356b48c6 100755 --- a/dgit +++ b/dgit @@ -4891,6 +4891,53 @@ sub massage_dbp_args ($;$) { return $r; } +sub in_parent (&) { + my ($fn) = @_; + my $wasdir = must_getcwd(); + changedir ".."; + $fn->(); + changedir $wasdir; +} + +sub postbuild_mergechanges ($) { # must run with CWD=.. (eg in in_parent) + my ($msg_if_onlyone) = @_; + # If there is only one .changes file, fail with $msg_if_onlyone, + # or if that is undef, be a no-op. + # Returns the changes file to report to the user. + my $pat = changespat $version; + my @changesfiles = glob $pat; + @changesfiles = sort { + ($b =~ m/_source\.changes$/ <=> $a =~ m/_source\.changes$/) + or $a cmp $b + } @changesfiles; + my $result; + if (@changesfiles==1) { + fail < $a =~ m/_source\.changes$/) - or $a cmp $b - } @changesfiles; - fail <