[Yum-devel] [PATCH] 'clean' plugin conduit

Luke Macken lmacken at redhat.com
Thu May 4 19:14:53 UTC 2006


Here is a patch to add a 'clean' conduit for plugins.  This will allow
plugins to clean up after themselves (ie, timedhost file in
fastestmirror).

luke
-------------- next part --------------
--- cli.py.orig	2006-04-25 01:36:42.000000000 -0400
+++ cli.py	2006-05-04 15:07:14.000000000 -0400
@@ -404,9 +404,9 @@
         elif self.basecmd == 'clean':
             if len(self.extcmds) == 0:
                 self.errorlog(0,
-                    _('Error: clean requires an option: headers, packages, cache, metadata, all'))
+                    _('Error: clean requires an option: headers, packages, cache, metadata, plugins, all'))
             for cmd in self.extcmds:
-                if cmd not in ['headers', 'packages', 'metadata', 'cache', 'dbcache', 'all']:
+                if cmd not in ['headers', 'packages', 'metadata', 'cache', 'dbcache', 'plugins', 'all']:
                     self.usage()
                     raise CliError
                     
@@ -1296,6 +1296,7 @@
             xmlcode, xmlresults = self.cleanMetadata()
             dbcode, dbresults = self.cleanSqlite()
             piklcode, piklresults = self.cleanPickles()
+            self.plugins.run('clean')
             
             code = hdrcode + pkgcode + xmlcode + piklcode + dbcode
             results = hdrresults + pkgresults + xmlresults + piklresults + dbresults
@@ -1318,6 +1319,10 @@
         if 'dbcache' in self.extcmds:
             self.log(2, 'Cleaning up database cache')
             dbcode, dbresults =  self.cleanSqlite()
+        if 'plugins' in self.extcmds:
+            self.log(2, 'Cleaning up plugins')
+            self.plugins.run('clean')
+
             
         code = hdrcode + pkgcode + xmlcode + piklcode + dbcode
         results = hdrresults + pkgresults + xmlresults + piklresults + dbresults
--- yum/plugins.py.orig	2006-05-04 15:02:11.000000000 -0400
+++ yum/plugins.py	2006-05-04 15:02:49.000000000 -0400
@@ -98,6 +98,7 @@
     'prereposetup': 'PreRepoSetupPluginConduit',
     'postreposetup': 'PostRepoSetupPluginConduit',
     'close': 'PluginConduit',
+    'clean': 'PluginConduit',
     'pretrans': 'MainPluginConduit',
     'posttrans': 'MainPluginConduit',
     'exclude': 'MainPluginConduit',


More information about the Yum-devel mailing list