]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
UBUNTU: [Packaging] insertchanges: avoid double newline
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 5 Nov 2020 16:16:00 +0000 (17:16 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 9 Nov 2020 13:49:22 +0000 (14:49 +0100)
BugLink: https://bugs.launchpad.net/bugs/1903293
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@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
debian/scripts/misc/insert-changes.pl

index c820597a9fc948663527ccf514298053f74c30fe..4eed4e28f9d32a44ec5004d0930fbea6e971dd79 100755 (executable)
@@ -13,17 +13,24 @@ 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 (/^$/ && $skip_newline == 1) {
+                       $skip_newline = 0;
+                       next;
+               }
                print NEW;
        }
 }