[Yum-devel] [PATCH] Add a simple "how many packages does this provider require" test.
James Antill
james at fedoraproject.org
Wed Apr 21 19:03:39 UTC 2010
On Wed, 2010-04-21 at 14:58 -0400, Seth Vidal wrote:
>
> On Tue, 20 Apr 2010, James Antill wrote:
>
> >
> > ...with this patch we'd pick "pkgA" because it had "less" requirements,
> > even though it actually requires 1 more thing. However, real world
> > result on F12:
>
>
> General idea is great - a few nitpicks.
>
> > + if len(rec_depsolve) > 1:
> > + for po in rec_depsolve:
> > + # FIXME: Can't str() this to something usable...
> > + fake_txmbr = misc.GenericHolder()
>
> make this transactioninfo.TransactionMember() and pack it normally.
>
>
> it'll save us from having some other random info added to the object later
> and _checkInstall() thinking it is getting REAL txmbr objects.
Yeh, I'd planned on doing this originally ... the only problem is that
transactioninfo is only imported into __init__ and all the other
TransactionMember() callers are inside the module.
So you want to import transactioninfo into depsolve, add a
tsInfo.fakeMember() or go via. yum.transactioninfo.TransactionMember() ?
> > + rec_depsolve[po] = self._checkInstall(fake_txmbr)
> > +
> > + # We don't want to decide to use a "shortest first", if something else
> > + # has told us to pick something else. But we want to pick between
> > + # multiple "best" packages. So we just give a bump to those packages
> > + # which are already winning.
> > + bestnum = max(pkgresults.values())
> > + for po in pkgs:
> > + if pkgresults[po] != bestnum:
> > + continue
> > + pkgresults[po] += 1000
> > pkgresults[po] += (len(po.name)*-1)
>
> 1000 is a bump? wow, hate to see what you think spiking looks like :)
I meant bump relative to each other, the +=1000 is to make sure the
-=len(po.name) doesn't make us pick something that didn't win before
I'll fix the comment :)
More information about the Yum-devel
mailing list