From patchwork Wed Sep 27 20:23:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 819297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3y2Tmz6vtTz9t6B; Thu, 28 Sep 2017 06:24:03 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1dxIs8-0000Ps-HX; Wed, 27 Sep 2017 20:23:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1dxIs7-0000PR-1j for kernel-team@lists.ubuntu.com; Wed, 27 Sep 2017 20:23:55 +0000 Received: from mail-qt0-f199.google.com ([209.85.216.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dxIs6-0005nj-ON for kernel-team@lists.ubuntu.com; Wed, 27 Sep 2017 20:23:54 +0000 Received: by mail-qt0-f199.google.com with SMTP id t46so15939697qtj.5 for ; Wed, 27 Sep 2017 13:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=05s2677mSq9UER+YYNzLHpSv3NztS+i4f8chdcg97q0=; b=jyD7GytCAZRB4UbG15m328OXBZkXqSca63c/8SY5MvFPV/Z2dKwdBJBcqfo+ztJ/MY GAtoexXcLwC+dBPd/hMgczZpfnP+nL3PHr4yu7dlVX6TNYdZCDX/jxDmh1kBQnQG4RN3 bSBGJBfx6PPXK8O+DfVSjuC05t+Xf3mO/GBA2YZpeUEQcjerK+8i9YkdHU3L8TXyDdSW xc2xVk/KppvdvZG6HhH6yw4xAsRkBT4oUoU+/BGEiABM9AmNnCxq4NNg3hke1rkRvRni D4XEz2iDlwTb8SlnMb3xd6O6/GeBzu8z0d9MxPe5ZroxL6e9tciK5NX4WHlxS2hc8t8x iw9g== X-Gm-Message-State: AHPjjUh+JX9vnOmazA7F1yCB+eJhkJgO7feq2w1Yw9tuTQ9svjZ9gwNo WEZCD1p4qlEdsV2BDzG81NLuuqXZr+haVH/wByaxBtrjnaH7O6mBheU8iwc/2fjRygnSr8cTqLz ZQIOiTH6OntFzbQLA3SCam8/FIVol7FT0uMQsuvac X-Received: by 10.55.201.155 with SMTP id m27mr4065581qkl.57.1506543833210; Wed, 27 Sep 2017 13:23:53 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCTlYXGsvIEWCiuyif88fVJeDnzCXJ2+UszjFG44Lnf1oGEhJEN7ZUJmoVZ1SRr2sQE5bc6NA== X-Received: by 10.55.201.155 with SMTP id m27mr4065559qkl.57.1506543832837; Wed, 27 Sep 2017 13:23:52 -0700 (PDT) Received: from localhost.localdomain (rrcs-69-193-151-51.nyc.biz.rr.com. [69.193.151.51]) by smtp.gmail.com with ESMTPSA id y15sm9490504qtc.4.2017.09.27.13.23.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Sep 2017 13:23:51 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [T/X/Z/A v2][PATCH] UBUNTU: d/s/m/insert-ubuntu-changes: use full version numbers Date: Wed, 27 Sep 2017 17:23:49 -0300 Message-Id: <1506543829-11565-1-git-send-email-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506455985-1152-1-git-send-email-marcelo.cerri@canonical.com> References: <1506455985-1152-1-git-send-email-marcelo.cerri@canonical.com> 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: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Ignore: yes Make insert-ubuntu-changes to consider full version numbers when looping through debian.master/changelog entries and comparing the version number of each entry with the arguments passed to the script to decide which entries should be included in the output changelog file. Previously, only the last number in the version was used in this comparison. For example, when comparing 4.4.0-50.51 and 4.4.0-83.84 only the numbers 51 and 84 were actually used in the comparison. That however might not work properly when the major version is bumped. For instance, using "end" as 4.4.0-50.51 and "start" as 4.4.0-83.84 used to work fine because 84 is greater than 51. However when using "end" as 4.11.0-10.11 and "start" as 4.13.0-2.3, no entry was being selected since 3 is not greater than 11. Signed-off-by: Marcelo Henrique Cerri Acked-by: Stefan Bader --- debian/scripts/misc/insert-ubuntu-changes | 32 ++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/debian/scripts/misc/insert-ubuntu-changes b/debian/scripts/misc/insert-ubuntu-changes index 9ede7f3950d7..7af9c20c1215 100755 --- a/debian/scripts/misc/insert-ubuntu-changes +++ b/debian/scripts/misc/insert-ubuntu-changes @@ -5,8 +5,30 @@ if ($#ARGV != 2) { } my ($changelog, $end, $start) = @ARGV; -$end =~ s/.*\.//; -$start =~ s/.*\.//; +$end =~ s/^\D+//; +$start =~ s/^\D+//; + +sub version_cmp($$) { + my @a = split(/[\.-]+/, $_[0]); + my @b = split(/[\.-]+/, $_[1]); + for (my $i = 1;; $i++) { + if (!defined $a[$i]) { + if (!defined $b[$i]) { + return 0; + } + return -1; + } + if (!defined $b[$i]) { + return 1; + } + if ($a[$i] < $b[$i]) { + return -1; + } + if ($a[$i] > $b[$i]) { + return 1; + } + } +} my @changes = (); my $output = 0; @@ -14,11 +36,11 @@ open(CHG, ") { - if (/^\S+\s+\((.*\.(\d+))\)/) { - if ($2 <= $end) { + if (/^\S+\s+\((.*)\)/) { + if (version_cmp($1, $end) <= -1) { last; } - if ($2 == $start) { + if ($1 eq $start) { $output = 1; } if ($output) {