Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2000 13:52:01 +0900
From:      "Akinori -Aki- MUSHA" <knu@idaemons.org>
To:        asami@FreeBSD.org
Cc:        freebsd-ports@FreeBSD.org, bmah@FreeBSD.org
Subject:   Re: Enhancement of pkg_version's version comparison routine
Message-ID:  <86wvfy4etq.wl@archon.local.idaemons.org>
In-Reply-To: In your message of "26 Sep 2000 16:31:28 -0700" <vqcog1aohm7.fsf@silvia.hip.berkeley.edu>
References:  <86k8by6eis.wl@archon.local.idaemons.org> <vqcog1aohm7.fsf@silvia.hip.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

At 26 Sep 2000 16:31:28 -0700,
Satoshi Asami wrote:
>  * Winer       Loser       Comment
     Winner
>  * 1.6.0       1.6.0.p3    Pre is before the release (*)
>  * 1.0.b       1.0.a3      Beta is after alpha's
>  * 1.0a        1.0         A letter "a" means alpha only when it appears
>  *                         after an period.
>  * 5.0a        5.0.b       Ditto.
>  * 3.2.ab1     3.2.p1      "ab" is unknown, but at least it should be
>  *                         after alpha's, beta's and pre's. (*)
>  * 2.3pl10     2.3pl9      Patchlevel 10 is after 9, of course (*)
>  * 
>  * where (*) indicates previously it wasn't handled correctly.
> 
> Thanks, but I think the last two cases should be handled differently.
> I think you should just compare the alphabetical part of "ab1" and
> "p1" in dictionary order.  If the author says "a", "ab", then "b",
> then that's probably what they want.  It will be easier for the porter
> if they knew they will be compared in alphabetical order.

It's not obvious...  Then they should be 3.2a, 3.2ab and 3.2b in the
ports world because we decided to use .a as alpha, and .b as beta.

> That should be clarified in the handbook.  Also, it should also be
> noted that if the progression is "alpha", "beta", "gamma", "delta",
> and then "epsilon", then "gamma" translates to "c", not "g".  (Damn
> Greek alphabets. :)

My top priority was to achieve this issue, that is, to put pre-release
versions before release versions.  And it's very easy to add support
for gamma, delta, and epsilon, as follows:

*** pkg_version.pl~	Wed Sep 27 05:42:20 2000
--- pkg_version.pl	Wed Sep 27 13:41:54 2000
***************
*** 95,111 ****
      my $x1 = shift @x1;
      my $x2 = shift @x2;
  
!     # Check for alpha, beta, or pre
!     if ($x1 =~ /^[abp]$/) {
! 	if ($x2 !~ /^[abp]$/) {
! 	    return -1;		# A non-abp (including null) wins over an abp
  	}
  
  	if ($x1 ne $x2) {
! 	    return $x1 cmp $x2;	# Accidentally, 'a' < 'b' < 'p' :)
  	}
!     } elsif ($x2 =~ /^[abp]$/) {
! 	return 1;		# A non-abp (including null) wins over an abp
      }
  
      # Seek for the difference
--- 95,113 ----
      my $x1 = shift @x1;
      my $x2 = shift @x2;
  
!     # Check for pre-release versions
!     my $pre_chars = "abgdep";
! 
!     if ($x1 =~ /^[$pre_chars]$/o) {
! 	if ($x2 !~ /^[$pre_chars]$/o) {	# release wins over pre-release
! 	    return -1;
  	}
  
  	if ($x1 ne $x2) {
! 	    return index($pre_chars, $x1) <=> index($pre_chars, $x2);
  	}
!     } elsif ($x2 =~ /^[$pre_chars]$/o) {
! 	return 1;			# release wins over pre-release
      }
  
      # Seek for the difference

> As for the last one, "pl" is not allowed in the middle -- it can be
> used only when there is no major/minor numbers.  The handbook is quite
> clear on this.  Maybe pkg_version can print an error message and say
> that it should be changed to "2.3.10" and "2.3.9"?  (Looking at the
> INDEX, there is no port that currently violates this rule.)

Ok, portlint me. ;)

> Of course, if for versions such as "pl10" and "pl9", the numerals
> should be treated as whole numbers, not strings.

Yes, that's the point.

-- 
                           /
                          /__  __       
                         / )  )  ) )  /
Akinori -Aki- MUSHA aka / (_ /  ( (__(  @ idaemons.org / FreeBSD.org

"We're only at home when we're on the run, on the wing, on the fly"


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wvfy4etq.wl>