From patchwork Thu Nov 5 16:16:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1395089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CRpZ824dwz9sTD; Fri, 6 Nov 2020 03:17:04 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kahwa-0006cH-Un; Thu, 05 Nov 2020 16:17:00 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kahwZ-0006c6-CU for kernel-team@lists.ubuntu.com; Thu, 05 Nov 2020 16:16:59 +0000 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kahwY-0002Rz-NG for kernel-team@lists.ubuntu.com; Thu, 05 Nov 2020 16:16:59 +0000 From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU X/B/F/G/H/U] UBUNTU: [Packaging] insertchanges: avoid double newline Date: Thu, 5 Nov 2020 13:16:43 -0300 Message-Id: <20201105161643.1087403-1-cascardo@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" 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 Acked-by: Andrea Righi Acked-by: Kelsey Skunberg --- 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 () { if (/^ CHANGELOG: /) { next if $printed; + $skip_newline = 1; while () { + $skip_newline = 0; print NEW; } $printed = 1; } else { + if (/^$/) { + if ($skip_newline == 1) { + $skip_newline = 0; + next; + } + } print NEW; } }