[Yum-devel] [PATCH/RFC] New processConflict implementation

Tim Lauridsen tim.lauridsen at googlemail.com
Mon Nov 5 15:10:42 UTC 2007


Florian Festi wrote:
> Tim Lauridsen wrote:
>> What if some one want to use the desolve class directly, it will fail 
>> because there is no update method, there need to be some virtual 
>> method raising NotImplemted or something like that.
>
> We need to move that method to the Depsolve class anyway because we 
> (ehm... I) introduced that dependency already with patch 
> 141377905b5851f937e8f76b0255ebac67b76ff7. Raising NotImplemented is 
> the wrong answer here, IMHO. We should just move the code to the right 
> place.
>
> Btw: There's probably more code that could be move around between the 
> different classes of the yum hierarchy (mainly Depsolve, YumBase, 
> YumBaseCli). I think the depsolver should rely more on code from (now) 
> YumBase (install, update, remove, bestPackagesFromList, ...)(I already 
> started that and this patch is another step in that direction). Same 
> is true for YumBaseCli which should also call code currently found in 
> YumBase (from installPkgs, updatePkgs, erasePkgs, localInstall, ...). 
> This could lead to a more compact code base which should be easier to 
> maintain and to keep consistent.
I agree in it could be useful to move around code YumBaseCLI <-> YumBase 
<-> Depsolve
while coding the PackageKit Yum Backend[1] i found out what is easy to 
do by the Yum API and what is hard to do.
http://gitweb.freedesktop.org/?p=packagekit.git;a=tree;;f=backends/yum/helpers

* Searching work very nicely
* Process the Transaction is easy.
* Something like 'yum localinstall /path/to/rpm/file' is hard to do, i 
need to copy a lot of code from YumBaseCli to make it work.
* install/remove/update is working fine too.

But on the other side maybe some of the classes should be renamed, 
because a Depsolve class containing method like update/remove/install 
don't sound rigth to me (maybe it is just me)

YumBase (toplevel API) <-> YumBackend (backend Lowlevel API / internal 
private code )

The method in YumBase should contain code to do the basic task yum can 
perform, the YumBackend code should only be used inside YumBase not be a 
3 party applications.
if the update method (YumBase) is need by YumBacked it should be added 
to YumBackend as _update and the update (YumBase) should just be a 
wrapper calling _remove() (YumBackend).

This will make it easier to document the API and howto use it. And keep 
the highlevel API stable (This is very important, there is a lot of code 
out there using YUM API)

YumBaseCli should only take care of the parse the command line options / 
command and call appropiate code in YumBase and show the right output.
All there package processing should be done in YumBase.

Tim



More information about the Yum-devel mailing list