[T/X/Z/A][PATCH] UBUNTU: d/s/m/insert-ubuntu-changes: use full version numbers

Stefan Bader stefan.bader at canonical.com
Wed Sep 27 19:10:28 UTC 2017


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 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) {
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20170927/ca265708/attachment.sig>


More information about the kernel-team mailing list