diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-25 17:39:32 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-26 01:20:44 +0100 |
commit | b6c697655db17a9080849ab40dba7b5a737ffb81 (patch) | |
tree | 8d037e7756a034ed6fd92dff934a878c5d52e687 /git-debrebase | |
parent | b5cfe0264cba9fd70266c40e1a02b41f0cabe0d4 (diff) |
git-debrebase: Use debchange for new-upstream changelog entry
Closes: #905888.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-x | git-debrebase | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/git-debrebase b/git-debrebase index 4756748..3d1f2a8 100755 --- a/git-debrebase +++ b/git-debrebase @@ -2170,30 +2170,39 @@ sub cmd_new_upstream () { "[git-debrebase anchor: new upstream $new_upstream_version, merge]", ]; - my $clogsignoff = cmdoutput qw(git show), - '--pretty=format:%an <%ae> %aD', - $new_bw; - # Now we have to add a changelog stanza so the Debian version - # is right. - die if unlink "debian"; - die $! unless $!==ENOENT or $!==ENOTEMPTY; - unlink "debian/changelog" or $!==ENOENT or die $!; - mkdir "debian" or die $!; - open CN, ">", "debian/changelog" or die $!; - my $oldclog = git_cat_file ":debian/changelog"; - $oldclog =~ m/^($package_re) \(\S+\) / or - fail "cannot parse old changelog to get package name"; - my $p = $1; - print CN <<END, $oldclog or die $!; -$p ($new_version) UNRELEASED; urgency=medium - - * Update to new upstream version $new_upstream_version. - - -- $clogsignoff - -END - close CN or die $!; + # is right. We use debchange to do this. Invoking debchange + # here is a bit fiddly because it has a lot of optional + # exciting behaviours, some of which will break stuff, and + # some of which won't work in a playtree. + + # Make debchange use git's idea of the user's identity. + # That way, if the user never uses debchange et al, configuring + # git is enough. + my $usetup = sub { + my ($e, $k) = @_; + my $v = cfg $k, 1; + defined $v or return; + $ENV{$e} = $v; + }; + $usetup->('DEBEMAIL', 'user.email'); + $usetup->('DEBFULLNAME', 'user.name'); + +sleep 2; + + my @dch = (qw(debchange + --allow-lower-version .* + --no-auto-nmu + --preserve + --vendor=Unknown-Vendor + --changelog debian/changelog + --check-dirname-level 0 + --release-heuristic=changelog + -v), $new_version, + "Update to new upstream version $new_upstream_version."); + + runcmd @git, qw(checkout -q debian/changelog); + runcmd @dch; runcmd @git, qw(update-index --add --replace), 'debian/changelog'; # Now we have the final new breakwater branch in the index |