[Yum-devel] RFC: Package object comparison -- do we need a slight change?
katzj at redhat.com
Thu Oct 12 02:54:20 UTC 2006
On Wed, 2006-10-11 at 22:37 -0400, seth vidal wrote:
> On Wed, 2006-10-11 at 22:22 -0400, Jeremy Katz wrote:
> > > I get where you're coming from about the comparison - I'm just worried
> > > about the next requested step:
> > > - take arch into account when dealing with < > comparisons
> > I thought about it when we first brought it up and I think we even
> > talked about it. Arguably, we should add it for consistency as it only
> > makes things "more" correct. The problem comes in (slightly) with
> > multiarch where you might want to install both equal version but
> > different arch'd packages. From a quick look, though, we'd actually be
> > safe to do so.
> arch is a problem b/c it means the comparison methods have to know about
> what your current arch is and the chroot and what you SAY your arch is
> (re: /etc/rpm/platform) etc etc etc. It's not something that we could
> easily bottle up inside a comparison method.
Right, let's just forget this part for now :-)
> > [snip]
> > > It almost feels like we should never allow rich comparison against
> > > non-matching archs. Which might be an argument for how to keep someone
> > > from doing this accidentally.
> > I'm not sure how you keep people from doing it, though -- except by not
> > having the comparison operators at all. And I think we might be stuck
> > there now :/
> well, like I said on jabber
> if other.arch != po.arch:
> raise InvalidComparisonError, foo foo foo
> but you're correct that will definitely break people's code.
> I'm not sure I see a happier way.
A quick look through the code shows a few places in yum proper where we
seem to expect that po1 == po2 if and only if po1.pkgtup == po2.pkgtup.
So, I think that going with my patch (plus also checking arch) might
give what most things are expecting...
More information about the Yum-devel