Message ID | 1506455985-1152-1-git-send-email-marcelo.cerri@canonical.com |
---|---|
State | New |
Headers | show |
Series | [T/X/Z/A] UBUNTU: d/s/m/insert-ubuntu-changes: use full version numbers | expand |
On 26.09.2017 15:59, Marcelo Henrique Cerri wrote: > 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. Hi Marcelo, I think it would be good to know the reasoning behind that change. And probably its best to add that to the commit message (as that will be the only thing that will be easily accessible in git) and make a v2. -Stefan > > Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@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) { >
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) {
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@canonical.com> --- debian/scripts/misc/insert-ubuntu-changes | 32 ++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-)