[pacman-dev] vercomp test - Was: [GIT] The official pacman repository branch, master, updated. v3.1.4-182-gb48f703

Dan McGee dpmcgee at gmail.com
Fri May 30 00:59:52 EDT 2008


On Thu, May 29, 2008 at 11:50 PM, Allan McRae <mcrae_allan at hotmail.com> wrote:
> Dan McGee wrote:
>>
>> On Thu, May 29, 2008 at 10:55 PM, Dan McGee <dpmcgee at gmail.com> wrote:
>>
>> Let me know what you think of my latest working branch commit, this
>> solves the original problem as well as makes the vercmptest.sh script
>> a bit more powerful.
>>
>> http://code.toofishes.net/gitweb.cgi?p=pacman.git;a=commitdiff;h=c574bfd8e3aae0e791e3a15f0d35554b157d91c8
>>
>
> Are these comparison really what is wanted?
> runtest 1.5   1.5-1 0
> runtest 1.5-1 1.5   0
> runtest 1.1-1 1.1   0

Yes, quite sure. First off, we have the old behavior, which matches
the above. Second, we have the reason for the old behavior, which is
that a depend can be specified as such:
foobar<=1.5
and foobar 1.5-13 needs to meet this requirement (aka 1.5 cmp 1.5-13
should yield 0). So a pkgrel is no sign of being newer, only a sign of
something different to compare, and not to be compared until the
versions are identical.

> I would have assumed the package with the pkgrel is newer.  In the current
> situation version 1.5 is equivalent to 1.5-1, 1.5-2, 1.5-3, etc.  I think
> this would be better:
>
>              } else if(*ptr1 == '-') {
>                      /* ptr1 has hit the pkgrel and ptr2 has not.
>                       * version 2 is newer iff we are not at the end of ptr2
> */
> -                       ret = *ptr2 ? -1 : 0;
> +                       ret = *ptr2 ? -1 : 1;
>                      goto cleanup;
>              } else if(*ptr2 == '-') {
>                      /* ptr2 has hit the pkgrel and ptr1 has not.
>                       * version 1 is newer iff we are not at the end of ptr1
> */
> -                       ret = *ptr1 ? 1 : 0;
> +                       ret = *ptr1 ? 1 : -1;
>                      goto cleanup;
>              }
>
> Allan




More information about the pacman-dev mailing list