[yum-cvs] yum/yum __init__.py,1.114,1.115 plugins.py,1.7,1.8

Menno Smits mjs at login.linux.duke.edu
Fri Apr 15 04:02:22 UTC 2005


Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv30151

Modified Files:
	__init__.py plugins.py 
Log Message:
Panu's patch for prereposetup and postreposetup slots.
Increased major API version number as the above breaks backward compat.
Added getRpmDB() and getPackageByNevra()


Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- __init__.py	14 Apr 2005 03:26:44 -0000	1.114
+++ __init__.py	15 Apr 2005 04:02:20 -0000	1.115
@@ -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"""
@@ -477,7 +479,7 @@
            raiseError  = defaults to 0 - if 1 then will raise
            a URLGrabError if the file does not check out.
            otherwise it returns false for a failure, true for success"""
-        
+
         if type(fo) is types.InstanceType:
             fo = fo.filename
 

Index: plugins.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/plugins.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- plugins.py	30 Mar 2005 12:55:09 -0000	1.7
+++ plugins.py	15 Apr 2005 04:02:20 -0000	1.8
@@ -85,10 +85,16 @@
 # API, the major version number must be incremented and the minor version number
 # reset to 0. If a change is made that doesn't break backwards compatibility,
 # then the minor number must be incremented.
-API_VERSION = '0.3'
+API_VERSION = '1.0'
 
-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 +129,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
@@ -341,6 +349,16 @@
         '''
         return self._base.repos.findRepos(pattern)
 
+    def getRpmDB(self):
+        '''Return a representation of local RPM database. This allows querying
+        of installed packages.
+
+        @return: rpmUtils.RpmDBHolder instance
+        '''
+        self._base.doTsSetup()
+        self._base.doRpmDBSetup()
+        return self._base.rpmdb
+
 class DownloadPluginConduit(RepoSetupPluginConduit):
 
     def __init__(self, parent, base, conf, pkglist, errors=None):
@@ -373,6 +391,16 @@
             arg = None
         return self._base.pkgSack.returnPackages(arg)
 
+    def getPackageByNevra(self, nevra):
+        '''Retrieve a package object from the packages loaded by Yum using
+        nevra information 
+        
+        @param nevra: A tuple holding (name, epoch, version, release, arch)
+            for a package
+        @return: A PackageObject instance (or subclass)
+        '''
+        return self._base.getPackageObject(nevra)
+
     def delPackage(self, po):
         self._base.pkgSack.delPackage(po)
 




More information about the Yum-cvs-commits mailing list