[yum-cvs] 6 commits - .gitignore cli.py docs/.gitignore rpmUtils/miscutils.py rpmUtils/updates.py yum/__init__.py yum/misc.py yum/packageSack.py yum/parser.py yum/repos.py yum/rpmtrans.py yum/update_md.py

James Bowes jbowes at linux.duke.edu
Mon Oct 1 00:56:12 UTC 2007


 .gitignore            |    1 
 cli.py                |   15 ++++++++------
 docs/.gitignore       |    1 
 rpmUtils/miscutils.py |   10 +++++----
 rpmUtils/updates.py   |   12 ++++++-----
 yum/__init__.py       |   41 +++++++++++++++++++++++----------------
 yum/misc.py           |   11 +++++-----
 yum/packageSack.py    |   12 +++++------
 yum/parser.py         |   52 +++++++++++++++++++++++++-------------------------
 yum/repos.py          |    9 +++++---
 yum/rpmtrans.py       |   36 +++++++++++++++++++---------------
 yum/update_md.py      |   12 +++++++----
 12 files changed, 120 insertions(+), 92 deletions(-)

New commits:
commit 186fefb2e3844ee4cc087155cd458c83fa983741
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:51:02 2007 -0400

    Don't override built-in 'file' in the packagesack searchFiles method.

diff --git a/yum/packageSack.py b/yum/packageSack.py
index b508e58..72b35bf 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -93,7 +93,7 @@ class PackageSackBase(object):
         """returns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]"""
         raise NotImplementedError()
 
-    def searchFiles(self, file):
+    def searchFiles(self, name):
         """return list of packages by filename"""
         raise NotImplementedError()
 
@@ -276,9 +276,9 @@ class MetaSack(PackageSackBase):
         
         return obsdict
         
-    def searchFiles(self, file):
+    def searchFiles(self, name):
         """return list of packages by filename"""
-        return self._computeAggregateListResult("searchFiles", file)
+        return self._computeAggregateListResult("searchFiles", name)
 
     def addPackage(self, obj):
         """Add a pkgobject to the packageSack.  This is a meaningless operation
@@ -514,13 +514,13 @@ class PackageSack(PackageSackBase):
             
         return obs
         
-    def searchFiles(self, file):
+    def searchFiles(self, name):
         """return list of packages by filename
            FIXME - need to add regex match against keys in file list
         """
         self._checkIndexes(failure='build')
-        if self.filenames.has_key(file):
-            return self.filenames[file]
+        if self.filenames.has_key(name):
+            return self.filenames[name]
         else:
             return []
 
commit c0a092bc9bb1beb026c1a28940fe909296a276e7
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:48:15 2007 -0400

    Add gitignore for epydoc

diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000..4a43cc2
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1 @@
+epydoc
commit 78327f82450d93c6d1334ef891ed6f816f17a31a
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:45:51 2007 -0400

    Fix some epydoc syntax errors in yum

diff --git a/yum/misc.py b/yum/misc.py
index b98461f..a16cb72 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -231,17 +231,18 @@ def keyIdToRPMVer(keyid):
 
 
 def keyInstalled(ts, keyid, timestamp):
-    '''Return if the GPG key described by the given keyid and timestamp are
+    '''
+    Return if the GPG key described by the given keyid and timestamp are
     installed in the rpmdb.  
 
     The keyid and timestamp should both be passed as integers.
     The ts is an rpm transaction set object
 
     Return values:
-        -1      key is not installed
-        0       key with matching ID and timestamp is installed
-        1       key with matching ID is installed but has a older timestamp
-        2       key with matching ID is installed but has a newer timestamp
+        - -1      key is not installed
+        - 0       key with matching ID and timestamp is installed
+        - 1       key with matching ID is installed but has a older timestamp
+        - 2       key with matching ID is installed but has a newer timestamp
 
     No effort is made to handle duplicates. The first matching keyid is used to 
     calculate the return result.
diff --git a/yum/parser.py b/yum/parser.py
index f9d2caa..ca5a068 100644
--- a/yum/parser.py
+++ b/yum/parser.py
@@ -40,18 +40,18 @@ def varReplace(raw, vars):
 class ConfigPreProcessor:
     """
     ConfigParser Include Pre-Processor
-    
-        File-like Object capable of pre-processing include= lines for
-        a ConfigParser. 
-        
-        The readline function expands lines matching include=(url)
-        into lines from the url specified. Includes may occur in
-        included files as well. 
-        
-        Suggested Usage:
-            cfg = ConfigParser.ConfigParser()
-            fileobj = confpp( fileorurl )
-            cfg.readfp(fileobj)
+
+    File-like Object capable of pre-processing include= lines for
+    a ConfigParser. 
+
+    The readline function expands lines matching include=(url)
+    into lines from the url specified. Includes may occur in
+    included files as well. 
+
+    Suggested Usage::
+        cfg = ConfigParser.ConfigParser()
+        fileobj = confpp( fileorurl )
+        cfg.readfp(fileobj)
     """
     
     
@@ -95,21 +95,21 @@ class ConfigPreProcessor:
         of the stack. Finally, we return EOF when the bottom-most (configfile
         arg to __init__) FLO returns EOF.
         
-        Very Technical Pseudo Code:
+        Very Technical Pseudo Code::
         
-        def confpp.readline() [this is called by ConfigParser]
-            open configfile, push on stack
-            while stack has some stuff on it
-                line = readline from file on top of stack
-                pop and continue if line is EOF
-                if line starts with 'include=' then
-                    error if file is recursive or duplicate
-                    otherwise open file, push on stack
-                    continue
-                else
-                    return line
-            
-            return EOF
+            def confpp.readline() [this is called by ConfigParser]
+                open configfile, push on stack
+                while stack has some stuff on it
+                    line = readline from file on top of stack
+                    pop and continue if line is EOF
+                    if line starts with 'include=' then
+                        error if file is recursive or duplicate
+                        otherwise open file, push on stack
+                        continue
+                    else
+                        return line
+                
+                return EOF
         """
         
         # set line to EOF initially. 
diff --git a/yum/repos.py b/yum/repos.py
index 4efe22b..3b1214f 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -203,9 +203,12 @@ class RepoStorage:
 
 
     def populateSack(self, which='enabled', mdtype='metadata', callback=None, cacheonly=0):
-        """This populates the package sack from the repositories, two optional 
-           arguments: which='repoid, enabled, all'
-                      mdtype='metadata, filelists, otherdata, all'"""
+        """
+        This populates the package sack from the repositories, two optional 
+        arguments:
+            - which='repoid, enabled, all'
+            - mdtype='metadata, filelists, otherdata, all'
+        """
 
         if not self._setup:
             self.doSetup()
diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 08c7b4c..1a9165b 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -31,14 +31,16 @@ class NoOutputCallBack:
         pass
         
     def event(self, package, action, te_current, te_total, ts_current, ts_total):
-        """package is a yum package object or simple string of a package name
-           action is a yum.constant transaction set state or in the obscure 
-              rpm repackage case it could be the string 'repackaging'
-           te_current: current number of bytes processed in the transaction
-                       element being processed
-           te_total: total number of bytes in the transaction element being processed
-           ts_current: number of processes completed in whole transaction
-           ts_total: total number of processes in the transaction.
+        """
+        @param package: A yum package object or simple string of a package name
+        @param action: A yum.constant transaction set state or in the obscure 
+                       rpm repackage case it could be the string 'repackaging'
+        @param te_current: current number of bytes processed in the transaction
+                           element being processed
+        @param te_total: total number of bytes in the transaction element being
+                         processed
+        @param ts_current: number of processes completed in whole transaction
+        @param ts_total: total number of processes in the transaction.
         """
         # this is where a progress bar would be called
         
@@ -83,14 +85,16 @@ class RPMBaseCallback:
         self.logger = logging.getLogger('yum.filelogging.RPMInstallCallback')        
         
     def event(self, package, action, te_current, te_total, ts_current, ts_total):
-        """package is a yum package object or simple string of a package name
-           action is a yum.constant transaction set state or in the obscure 
-              rpm repackage case it could be the string 'repackaging'
-           te_current: current number of bytes processed in the transaction
-                       element being processed
-           te_total: total number of bytes in the transaction element being processed
-           ts_current: number of processes completed in whole transaction
-           ts_total: total number of processes in the transaction.
+        """
+        @param package: A yum package object or simple string of a package name
+        @param action: A yum.constant transaction set state or in the obscure 
+                       rpm repackage case it could be the string 'repackaging'
+        @param te_current: Current number of bytes processed in the transaction
+                           element being processed
+        @param te_total: Total number of bytes in the transaction element being
+                         processed
+        @param ts_current: number of processes completed in whole transaction
+        @param ts_total: total number of processes in the transaction.
         """
         raise NotImplementedError()
 
diff --git a/yum/update_md.py b/yum/update_md.py
index c45fe7e..441aa19 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -110,7 +110,8 @@ class UpdateNotice(object):
         return self._md
 
     def _parse(self, elem):
-        """ Parse an update element.
+        """
+        Parse an update element::
 
             <!ELEMENT update (id, synopsis?, issued, updated,
                               references, description, pkglist)>
@@ -147,7 +148,8 @@ class UpdateNotice(object):
             raise UpdateNoticeException('No update element found')
 
     def _parse_references(self, elem):
-        """ Parse the update references.
+        """
+        Parse the update references::
 
             <!ELEMENT references (reference*)>
             <!ELEMENT reference>
@@ -166,7 +168,8 @@ class UpdateNotice(object):
                 raise UpdateNoticeException('No reference element found')
 
     def _parse_pkglist(self, elem):
-        """ Parse the package list.
+        """
+        Parse the package list::
 
             <!ELEMENT pkglist (collection+)>
             <!ELEMENT collection (name?, package+)>
@@ -186,7 +189,8 @@ class UpdateNotice(object):
             self._md['pkglist'].append(data)
 
     def _parse_package(self, elem):
-        """ Parse an individual package.
+        """
+        Parse an individual package::
 
             <!ELEMENT package (filename, sum, reboot_suggested)>
                 <!ATTLIST package name CDATA #REQUIRED>
commit f7a7b8def6b608ebe4517a3a96e149e01883802a
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:13:00 2007 -0400

    Ignore vim swap files

diff --git a/.gitignore b/.gitignore
index de339a8..52ce707 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 *.pyo
 *~
 *.bak
+*.swp
commit 9f4de51c97409a75d77f2c3c88ffd5e8ec0ca30f
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:10:15 2007 -0400

    Fix some epydoc syntax errors in rpmUtils

diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
index a40f8d3..64e232e 100644
--- a/rpmUtils/miscutils.py
+++ b/rpmUtils/miscutils.py
@@ -276,10 +276,12 @@ def unique(s):
 
 
 def splitFilename(filename):
-    """pass in a standard style rpm fullname and it returns
-    a name, version, release, epoch, arch
-    aka  foo-1.0-1.i386.rpm returns foo, 1.0, 1, i386
-         1:bar-9-123a.ia64.rpm returns bar, 9, 123a, 1, ia64
+    """
+    Pass in a standard style rpm fullname 
+    
+    Return a name, version, release, epoch, arch, e.g.::
+        foo-1.0-1.i386.rpm returns foo, 1.0, 1, i386
+        1:bar-9-123a.ia64.rpm returns bar, 9, 123a, 1, ia64
     """
 
     if filename[-4:] == '.rpm':
diff --git a/rpmUtils/updates.py b/rpmUtils/updates.py
index dc68b4f..5a98fde 100644
--- a/rpmUtils/updates.py
+++ b/rpmUtils/updates.py
@@ -19,11 +19,13 @@ import rpmUtils.miscutils
 import rpmUtils.arch
 
 class Updates:
-    """This class computes and keeps track of updates and obsoletes.
-       initialize, add installed packages, add available packages (both as
-       unique lists of name, epoch, ver, rel, arch tuples), add an optional dict
-       of obsoleting packages with obsoletes and what they obsolete ie:
-        foo, i386, 0, 1.1, 1: bar >= 1.1."""
+    """
+    This class computes and keeps track of updates and obsoletes.
+    initialize, add installed packages, add available packages (both as
+    unique lists of name, epoch, ver, rel, arch tuples), add an optional dict
+    of obsoleting packages with obsoletes and what they obsolete ie::
+        foo, i386, 0, 1.1, 1: bar >= 1.1.
+    """
 
     def __init__(self, instlist, availlist):
         self.changeTup = [] # storage list tuple of updates or obsoletes
commit 2b7050768b00b556258de3ddb5064137211298ec
Author: James Bowes <jbowes at redhat.com>
Date:   Sun Sep 30 20:02:13 2007 -0400

    Fix some epydoc syntax errors in cli.py and yum/__init__.py

diff --git a/cli.py b/cli.py
index 07a93c5..497f3d6 100644
--- a/cli.py
+++ b/cli.py
@@ -254,12 +254,15 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
 
 
     def doCommands(self):
-        """calls the base command passes the extended commands/args out to be
-        parsed. (most notably package globs). returns a numeric result code and
-        an optional string
-           0 = we're done, exit
-           1 = we've errored, exit with error string
-           2 = we've got work yet to do, onto the next stage"""
+        """
+        Calls the base command passes the extended commands/args out to be
+        parsed (most notably package globs).
+        
+        Returns a numeric result code and an optional string
+           - 0 = we're done, exit
+           - 1 = we've errored, exit with error string
+           - 2 = we've got work yet to do, onto the next stage
+        """
         
         # at this point we know the args are valid - we don't know their meaning
         # but we know we're not being sent garbage
diff --git a/yum/__init__.py b/yum/__init__.py
index 3d48a70..f738e3e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -975,12 +975,14 @@ class YumBase(depsolve.Depsolve):
             return
 
     def sigCheckPkg(self, po):
-        '''Take a package object and attempt to verify GPG signature if required
+        '''
+        Take a package object and attempt to verify GPG signature if required
 
-        Returns (result, error_string) where result is
-            0 - GPG signature verifies ok or verification is not required
-            1 - GPG verification failed but installation of the right GPG key might help
-            2 - Fatal GPG verifcation error, give up
+        Returns (result, error_string) where result is:
+            - 0 - GPG signature verifies ok or verification is not required.
+            - 1 - GPG verification failed but installation of the right GPG key
+                  might help.
+            - 2 - Fatal GPG verifcation error, give up.
         '''
         if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
             check = self.conf.gpgcheck
@@ -1224,11 +1226,13 @@ class YumBase(depsolve.Depsolve):
 
         
     def findDeps(self, pkgs):
-        """Return the dependencies for a given package object list, as well
-           possible solutions for those dependencies.
+        """
+        Return the dependencies for a given package object list, as well
+        possible solutions for those dependencies.
            
-           Returns the deps as a dict of dicts:
-             packageobject = [reqs] = [list of satisfying pkgs]"""
+        Returns the deps as a dict of dicts::
+            packageobject = [reqs] = [list of satisfying pkgs]
+        """
         
         results = {}
 
@@ -2122,14 +2126,17 @@ class YumBase(depsolve.Depsolve):
         return returndict
 
     def getKeyForPackage(self, po, askcb = None, fullaskcb = None):
-        """Retrieve a key for a package.  If needed, prompt for if the
-        key should be imported using askcb.
-        @po: Package object to retrieve the key of.
-        @askcb: Callback function to use for asking for verification.  Takes
-                arguments of the po, the userid for the key, and the keyid.
-        @fullaskcb: Callback function to use for asking for verification
-                of a key.  Differs from askcb in that it gets passed a
-                dictionary so that we can expand the values passed.
+        """
+        Retrieve a key for a package. If needed, prompt for if the key should
+        be imported using askcb.
+        
+        @param po: Package object to retrieve the key of.
+        @param askcb: Callback function to use for asking for verification.
+                      Takes arguments of the po, the userid for the key, and
+                      the keyid.
+        @param fullaskcb: Callback function to use for asking for verification
+                          of a key. Differs from askcb in that it gets passed
+                          a dictionary so that we can expand the values passed.
         """
         
         repo = self.repos.getRepo(po.repoid)



More information about the Yum-cvs-commits mailing list