[Yum-devel] [PATCH]: allow plugins to add new commands to the cli

Bastiaan Bakker bastiaan.bakker at enovation.nl
Sat Sep 23 14:32:23 UTC 2006


On Wednesday 20 September 2006 18:51, Menno Smits wrote:
> Hi Bastiaan,
>
> Sorry about the delayed reply. I've been very busy with work.

That's OK. And this time it was my turn to have a delayed reply :-)

>
> Bastiaan Bakker wrote:
> > On Thu, 2006-09-14 at 06:44 +0100, Menno Smits wrote:
> > --8<--
> >
> >> The "command as a class" idea isn't bad.
> >>
> >> How about passing the command name to doCommand and doCheck
> >> rather than relying on base.basecmd? This aids testability and
> >> clarity. I can see basecmd going away in the future.
> >
> > If basecmd goes away, extcmds will go away too, I guess?
> > That introduces lots of small modifications to cli.py.
> > In order to keep the yum-commands patch small and simple so it can be
> > reviewd more easily, can we do the abolishment of basecmd and extcmds
> > either before or after merging the yum-commands patch?
> > They are two separate changes anyway and can easily be done separately.
>
> I'm not suggesting that basecmd and extcmds will go away any time soon
> but relying on them increases the coupling between the YumCommand
> classes and YumBaseCli. It means that we can't easily make future
> changes to how Yum's cli processing works because there will be plugins
> that rely on the existing attributes such as basecmd and extcmds. If we
> decouple the classes by passing these bits of data around rather than
> accessing them directly we avoid such problems in the future.

I did and do not disagree that decoupling YumCommand from self.basecmd and 
self.extcmds is a good idea. I just felt that it might be clearer to do it in 
two patches because the larger a patch becomes the more difficult it is to 
merge it.
Anyway, I've updated the patch. Now doCheck() and doCommand() receive basecmd 
and extcmds. I felt that I had to remove references to self.extcmds in 
YumBaseCli.installPkgs(), etc. in order to keep things clear. This results in 
some small interface changes in these methods: the userlist parameters are no 
longer optional. But that feature wasn't used anywhere outside cli.py, so 
that shouldn't be a problem.
>
> > I've attached a new version of the yum-commands patch which puts
> > YumCommand and subclasses into its own file yumcommands.py so it doesn't
> > clutter cli.py anymore.
> > Do you feel that other changes are necessary before the patch can be
> > merged? I would prefed to have it committed before making other changes
> > to cli.py, etc.
>
> Your patch is getting close but I think that avoiding the direct access
> to at least basecmd and extcmds is a good idea.
>

OK. done :-)

> Menno
> _______________________________________________
> Yum-devel mailing list
> Yum-devel at linux.duke.edu
> https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yum-enable-command-extensions-v4.patch
Type: text/x-diff
Size: 39828 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20060923/aba9d8f4/attachment.bin 


More information about the Yum-devel mailing list