[Yum-devel] [PATCH] remove RPMDBPackageSack.installed()

Tim Lauridsen tla at rasmil.dk
Thu Oct 4 09:01:14 UTC 2007


Florian Festi wrote:
> Hi!
>
> While creating the new test frame work I came across several minor 
> issues. One problem is the existence of the 
> RPMDBPackageSack.installed() method. It is currently only supported by 
> the RPMDBPackageSack class. This doesn't allow to replace the rpmdb 
> with an inmemory PackageSack. Seth already rejected the idea of just 
> moving the method to the base class as "installed" doesn't make any 
> sense for non RpmDB sacks.
>
> As I really dislike inconsistent APIs I'd like to suggest to just 
> remove the usage of that method from the code. There are just 7 places 
> in yum and one place in yum-utils where it is used and it is nothing 
> more than a tiny convenience wrapper. In fact it can be replaced quite 
> easily by .searchNevra() - one of our work horse methods. The attached 
> patches remove the usage of the method and add an deprecation warning 
> (feel free to ignore that if we want to keep the method).
>
> Florian
>
> PS: The patch also fixes a small issue when running without 
> repositories which simplifies setting up the test cases.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Yum-devel mailing list
> Yum-devel at linux.duke.edu
> https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
RPMDBPackageSack.installed() make the code look better and make it 
easier to understand.

self.rpmdb.installed(po)

Look much better then 

self.rpmdb.searchNevra(po.name, po.epoch, po.version, po.release, po.arch)

Removing the installed() method is a API breakage and there is other API users out there (yumex, pirut, pungi, revisor, PackageKit etc)

and api users (like me) hate this kind of breakage :)

from an API users point of view, he/she want to simple and easy to use 
API, and in this case 'installed(po)' is much better than 
'self.rpmdb.searchNevra(n,e,v,r,a)', there have also been done a lot of 
work to replace n,e,v,r,a tuples with po object, this is a step backwards.

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.baseurl.org/pipermail/yum-devel/attachments/20071004/6da7a2d8/attachment.htm 


More information about the Yum-devel mailing list