[Yum-devel] More plugin fun + comments/ideas

Panu Matilainen pmatilai at welho.com
Fri Apr 8 06:34:12 UTC 2005


On Fri, 8 Apr 2005, Menno Smits wrote:

> Panu Matilainen wrote:
>
>> - Currently the "reposetup" slot runs before anything is set up wrt the 
>> repositories and while that's a good thing to have, there should probably 
>> be prereposetup and postreposetup plugin slots.
>
> Agreed.

Ok, attached patch replaces "reposetup" with prereposetup and 
postreposetup slots.

>
>> - There's no clean way (as I assume one shouldn't be messing with 
>> conduit._base) to load additional metadata for plugins that need it, one 
>> has to use stuff like conduit._base.repos.populateSack(with='otherdata') 
>> to get it and in all the wrong places since that wont work in the 
>> (pre)reposetup slot.
>
> No you shouldn't be using conduit._base :)
>
> I will look at a clean way of providing 'otherdata'.

Hmm, it's not just 'otherdata' but potentially the filelists as well, I 
don't think there's any guarantee that yum has loaded those if the 
dependency resolution didn't require it? Not that I have any particular 
use for the filelists in mind at the moment but I'm sure I can come up 
with something sooner or later :)

This added to RepoSetupPluginConduit class gets the job done but dunno if 
it's really the kind of API we want to expose to plugins?

     def loadData(self, which='enabled', with='metadata'):
         return self._base.repos.populateSack(which, with)

Oh and then there's the group data which one might want in plugins as 
well.

>
>> - Getting information about packages already installed on the system 
>> appears to require wrestling with conduit._base.rpmdb (unless I missed 
>> something obvious?) which returns lists of tuples which have to be 
>> converted to package objects.. far too difficult for what I assume to be 
>> relatively common task.
>
> Agreed. I will add functionality for this.

Ok. My first idea was to present the rpmdb in the package list 
you get from getPackages() as "installed" repository but haven't looked 
how to implement that.

>
> The plugin API certainly isn't stable or production ready. This is exactly 
> the type of feedback I'm looking for. Patches are most welcome too :)
>
> It'll probably be a week until I'll have much time to devote to this.

Ok, in the meanwhile I'll try to come up with crazy crack plugins to find 
what more is needed + maybe some patches as well :)

 	- Panu -
-------------- next part --------------
--- yum/__init__.py.orig	2005-04-08 08:46:43.821615413 +0300
+++ yum/__init__.py	2005-04-08 08:47:17.424839150 +0300
@@ -189,7 +189,7 @@
            the basics of the repository"""
 
         
-        self.plugins.run('reposetup')
+        self.plugins.run('prereposetup')
         
         repos = []
         if thisrepo is None:
@@ -219,6 +219,8 @@
                 self.errorlog(0, str(e))
                 raise
 
+        self.plugins.run('postreposetup')
+
     def doSackSetup(self, archlist=None, thisrepo=None):
         """populates the package sacks for information from our repositories,
            takes optional archlist for archs to include"""
--- yum/plugins.py.orig	2005-04-08 08:45:42.895464175 +0300
+++ yum/plugins.py	2005-04-08 08:46:37.000382059 +0300
@@ -87,8 +87,8 @@
 # then the minor number must be incremented.
 API_VERSION = '0.3'
 
-SLOTS = ('config', 'init', 'predownload', 'postdownload', 'reposetup',
-        'exclude', 'pretrans', 'posttrans', 'close')
+SLOTS = ('config', 'init', 'predownload', 'postdownload', 'prereposetup',
+         'postreposetup', 'exclude', 'pretrans', 'posttrans', 'close')
 
 class PluginYumExit(Errors.YumBaseError):
     '''Used by plugins to signal that yum should stop
@@ -123,7 +123,9 @@
             conduitcls = InitPluginConduit
         elif slotname in ('predownload', 'postdownload'):
             conduitcls = DownloadPluginConduit
-        elif slotname == 'reposetup':
+        elif slotname == 'prereposetup':
+            conduitcls = RepoSetupPluginConduit
+        elif slotname == 'postreposetup':
             conduitcls = RepoSetupPluginConduit
         elif slotname == 'close':
             conduitcls = PluginConduit


More information about the Yum-devel mailing list