[Yum-devel] [PATCH 2/2] fix in rangeCompare for where the item we're comparing it to has LESS than range for example: if e-1.0-0 in the range of E < 1.1

James Antill james at fedoraproject.org
Tue Aug 11 21:18:19 UTC 2009


On Tue, 2009-08-11 at 16:59 -0400, Seth Vidal wrote:
> There are probably more typeso f insanity here - and some more tests to define and I commented
> about that in the code.
> ---
>  rpmUtils/miscutils.py |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
> index f494fc3..d76f3a8 100644
> --- a/rpmUtils/miscutils.py
> +++ b/rpmUtils/miscutils.py
> @@ -173,8 +173,14 @@ def rangeCompare(reqtuple, provtuple):
>          if reqf in ['GT', 'GE', 4, 12]:
>              return 1
>          if reqf in ['EQ', 8]:
> -            if f in ['LE', 10]:
> +            if f in ['LE', 10, 'LT', 2]:
>                  return 1
> +        # there is more to be done here to make sure it is right
> +        # my brain melted trying to map these- skvidal 8/11/2009
> +        if reqf in ['LT', 2]:
> +            if f in ['LT', 2]:
> +                return 1
> +        


 I'm 99% sure this should mirror the <= cases for GE/GT/etc. so where
that is:

        if reqf in ['GT', 'GE', 'EQ', 4, 12, 8]:
            if f in ['GT', 'GE', 4, 12]:
                return 1
        if reqf in ['LE', 'LT', 10, 2]:
            return 1

...I think you want:

        if reqf in ['LE', 'LT', 'EQ', 10, 2, 8]:
            if f in ['LE', 'LT', 10, 2]:
                return 1
        if reqf in ['GT', 'GE', 4, 12]:
            return 1

...after your patch the following will fail, and should succeed:

rpmUtils.miscutils.rangeCompare(('E', 'LE', ('0', '1.0', '0')),
                                ('E', 'LE', ('0', '1.1', '0')))
rpmUtils.miscutils.rangeCompare(('E', 'LT', ('0', '1.0', '0')),
                                ('E', 'LE', ('0', '1.1', '0')))
rpmUtils.miscutils.rangeCompare(('E', 'LE', ('0', '1.0', '0')),
                                ('E', 'LT', ('0', '1.1', '0')))



-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Yum-devel mailing list