APPLIED[X/B/F/G]/cmnt: [SRU X/B/F/G/H/U] UBUNTU: [Packaging] insertchanges: avoid double newline
Kleber Souza
kleber.souza at canonical.com
Fri Nov 6 16:28:10 UTC 2020
On 05.11.20 17:16, Thadeu Lima de Souza Cascardo wrote:
> When some changes have been already added to the changelog, like when using
> insert-ubuntu-changes, and there are no other changes, we end up with two
> newlines right after the stanza header.
>
> Add a $skip_newline variable that allows us to skip that extra newline when
> there are no other changes.
>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
Applied to {xenial,bionic,focal,groovy}/linux, with the BugLink added and
the change suggested by Andrea.
Thanks,
Kleber
> ---
> debian/scripts/misc/insert-changes.pl | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/debian/scripts/misc/insert-changes.pl b/debian/scripts/misc/insert-changes.pl
> index c820597a9fc9..dde210faac34 100755
> --- a/debian/scripts/misc/insert-changes.pl
> +++ b/debian/scripts/misc/insert-changes.pl
> @@ -13,17 +13,26 @@ open(CHANGES, "< $debian/changes") or die "Cannot open new changes";
> open(NEW, "> $debian/changelog.new") or die "Cannot open new changelog";
>
> $printed = 0;
> +my $skip_newline = 0;
>
> while (<CHANGELOG>) {
> if (/^ CHANGELOG: /) {
> next if $printed;
>
> + $skip_newline = 1;
> while (<CHANGES>) {
> + $skip_newline = 0;
> print NEW;
> }
>
> $printed = 1;
> } else {
> + if (/^$/) {
> + if ($skip_newline == 1) {
> + $skip_newline = 0;
> + next;
> + }
> + }
> print NEW;
> }
> }
>
More information about the kernel-team
mailing list