[Yum-devel] a lot of api breaking, I think

Tim Lauridsen tim at rasmil.dk
Fri Jan 27 14:29:11 UTC 2006


On Thu, 2006-01-26 at 18:32 -0500, seth vidal wrote:
> Menno and I were talking about making package objects more useful and
> letting them handle simple things internally like
> package_object.return_to_me_your_url()
> 
> In order to do that the package_object needs to have a reference to the
> repository as an attribute instead of having just the string of the
> repoid. 
> 
Sounds fine to me.
What about the installed packages, where do they point to. ??

> Menno mentioned that it would actually make each package object a bit
> smaller b/c references are smaller, in memory, than a string, as an
> attribute. However, to make this change will mean a lot of things will
> stop working, from a quick grep through the code.
> 
> So a couple of options that should work:
> 
> 1. suck it up, search through all our code and make the changes
> 2. figure out if the __str__ comparison in the repo object is enough to
> handle most of the comparisons needed.
> 3. define a new attribute in the package object called 'repo' and
> deprecate 'repoid' for use. Then, as we work through the code prune out
> all the references to packageobject.repoid
> 
> I kinda like 3 - even though it would make it a bit bigger for a little
> while.
> 

I like 3. best, what about change po.repoid to return po.repo.id
directly by adding a __get__ method to the package object, like it is
done in the Option Classes.

I would be smart in the YumAvailablePackage class, where a __get__ class
could be used to return tag from the rpm header directly and don't have
to have a local copy of fx. name,arch,ver,description etc.

Tim







More information about the Yum-devel mailing list