From 995f0ec02cec6106c1ea1de3be3893f4a15fb060 Mon Sep 17 00:00:00 2001 From: "Makoto Fujiwara (CF-SX2)" Date: Tue, 2 May 2017 00:18:13 +0900 Subject: [PATCH] (check-update) remove unconditional comment lines. Add quick escape from sub CompareVersion_make_equal_length() --- check-update | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/check-update b/check-update index fbc43d3..b2551a2 100755 --- a/check-update +++ b/check-update @@ -1401,18 +1401,17 @@ sub CompareVersion_make_equal_length($$) { my $a = shift; my $b = shift; my $diff = length($a) - length($b); + if (substr($a, 0, 1 ) ne '0' ) { return ($a, $b);} + if (substr($b, 0, 1 ) ne '0' ) { return ($a, $b);} if ($diff == 0) {} else { - if (substr($a, 0, 1 ) eq 0 && - substr($b, 0, 1 ) eq 0 ) { - if ($diff > 0 ) { - while ($diff--) { - $b .='0'; - } - } else { - while ($diff++ < 0) { - $a .='0'; - } + if ($diff > 0 ) { + while ($diff--) { + $b .='0'; + } + } else { + while ($diff++ < 0) { + $a .='0'; } } } @@ -1440,11 +1439,10 @@ sub CompareVersion($$){ if ($a[0] > $b[0]) { return 1;} if ($a[0] < $b[0]) { return -1;} if ($a[0] == $b[0]) { -# if ( $max_count = 1 ) {return 0;} +# if ( $max_count == 1 ) {return 0;} if ( $max_count == 2 ) { - print STDERR sprintf("%4d ", __LINE__), 'max count: ', $max_count, 'a: ', $a, ' b: ',$b,"\n"; +# print STDERR sprintf("%4d ", __LINE__), 'max count: ', $max_count, 'a: ', $a, ' b: ',$b,"\n"; ($a[1], $b[1]) = CompareVersion_make_equal_length($a[1], $b[1]); # 0.043 > 0.0301 -# above line is harmfull for (pango) 1.40.3 -> 1.40.5 or 1.9.1 } if ($a[1] > $b[1]) { return 1;} if ($a[1] < $b[1]) { return -1;} @@ -1452,7 +1450,7 @@ sub CompareVersion($$){ # print STDERR sprintf("%4d ", __LINE__ ), ' ', '$a[1]: ', $a[1], ' $b[1]: ', $b[1], "\n"; return $a[1] cmp $b[1];} # arc-5.21[op] if ($a[1] == $b[1]) { -# if ( $max_count = 1 ) { return 0;} +# if ( $max_count == 1 ) { return 0;} if ($a[2] =~ /rc/ ) {$a[2] =~ s/rc.*//;} if ($b[2] =~ /rc/ ) {$b[2] =~ s/rc.*//;} # print STDERR sprintf("%4d ", __LINE__ ), ' ', '$a[2]: ', $a[2], ' $b[2]: ', $b[2], "\n"; @@ -4593,8 +4591,8 @@ print STDERR sprintf("%4d ", __LINE__ ), ($Github_no_release, $returnCode, @CANDIDATE) = GitHubSpecial($DISTBASE, $HOMEPAGE, $dir, $PackageName); push(@candidate, @CANDIDATE); if ($Github_no_release) { - print STDERR sprintf("%4d <", __LINE__ ), (caller 0)[3], '>:', (caller 0)[2], ': ', "\n",join ("\n", @candidate ), "\n"; - print STDERR sprintf("%4d <", __LINE__ ), (caller 0)[3], '>:', (caller 0)[2], ': ', $PKGVERSION,"\n"; +# print STDERR sprintf("%4d <", __LINE__ ), (caller 0)[3], '>:', (caller 0)[2], ': ', "\n",join ("\n", @candidate ), "\n"; +# print STDERR sprintf("%4d <", __LINE__ ), (caller 0)[3], '>:', (caller 0)[2], ': ', $PKGVERSION,"\n"; push(@candidate, $PKGVERSION); # add current version onto @candidate, if no release on github } print STDERR sprintf("%4d <", __LINE__ ), (caller 0)[3], '>:', " -------------\n", (caller 0)[2], ': ', "\n",join ("\n", @candidate),"\n" if $DEBUG_CANDIDATE ;