[T/X/Z/A][PATCH] UBUNTU: d/s/m/insert-ubuntu-changes: use full version numbers
Marcelo Henrique Cerri
marcelo.cerri at canonical.com
Tue Sep 26 19:59:45 UTC 2017
Ignore: yes
Change insert-ubuntu-changes to use the full version number when seeking
the changelog entries to be copied instead of using just the revision
number.
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
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, "<debian.master/changelog") ||
open(CHG, "<debian/changelog") ||
die "$0: debian/changelog: open failed - $!\n";
while (<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) {
--
2.7.4
More information about the kernel-team
mailing list