[packagekit] Fwd: Resolve function specification

Mounir Lamouri mounir.lamouri at gmail.com
Mon Jun 29 07:31:27 PDT 2009


Forwarding the message the the list as i only replied to Richard.


---------- Forwarded message ----------
From: Mounir Lamouri <mounir.lamouri at gmail.com>
Date: Mon, Jun 29, 2009 at 4:02 PM
Subject: Re: Resolve function specification
To: Richard Hughes <hughsient at gmail.com>


On Mon, Jun 29, 2009 at 11:43 AM, Richard Hughes<hughsient at gmail.com> wrote:
>> First of all, yum backend is considering the input as a list, not a single
>> package id.
>
> I don't think there are any users of Resolve(list) -- I think they all
> only pass one thing. I think the idea for multiple terms was to do an
> OR search, although in hindsight, there should be a string passed, not
> a string list.
So, we can consider the specification is correct and yum backend has
to be fixed ?
(ie. only one name should be passed to the function) or we move to a
string with multiple keys separated with spaces and result is with OR
operator ? (ie. Resolve("foo bar") = Resolve("foo") + Resolve("bar"))

I think letting client use OR can be better for performance.

> From an implementation point of view, I don't think Resolve is any
> different from SearchFoo, without the wildcarding.

> There's one thing I'm not sure about resolve, is whether to return the
> original package. e.g.
>
> if I have installed dave-002, and there is dave-003 in one repo, and
> dave-002 in another, and I do Resolve(dave, FILTER_NONE) should I get:
>
> installed dave-002
> available dave-002
> available dave-003
>
> or:
>
> installed dave-002
> available dave-003
>
> I think the second makes most sense. Might be good to put an example
> in the docs.
Why the second makes most-sense ?
If every functions should return the first list why Resolve should
return the second ? As Resolve is a SearchName with exact pattern, it
should returns exactly the same things as SearchName for this exact
pattern.
Example:
SearchName(foo):
installed foo-002
available foo-002
available foo-003
[other things like *foo or foo*]

Resolve(foo):
installed foo-002
available foo-002
available foo-003

If we have a Resolve special behaviour it's going to be hard to
understand and as Resolve is atm used with ~installed;newest, this
special behaviour is not needed.

In my opinion, as it is presented, difference between SearchName and
Resolve is a simple regular expression:
SearchName has re.compile(key, re.I) # for every key in keys (AND operator)
Resolve has re.compile("^" + key + "$") # for every key in keys (OR operator)

Mounir



More information about the PackageKit mailing list