[Yum-devel] [PATCH] Adds documentation for the cli module.

Nick Jacek njacek at redhat.com
Fri Jul 15 14:17:54 UTC 2011


---
 cli.py |  467 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 372 insertions(+), 95 deletions(-)
 mode change 100644 => 100755 cli.py

diff --git a/cli.py b/cli.py
old mode 100644
new mode 100755
index 6056d38..29f1551
--- a/cli.py
+++ b/cli.py
@@ -51,23 +51,24 @@ from yum.i18n import to_unicode, to_utf8
 from yum.packages import parsePackages
 
 def sigquit(signum, frame):
-    """ SIGQUIT handler for the yum cli. """
+    """SIGQUIT handler for the yum cli.  This function will print an
+    error message and exit the program.
+    
+    :param signum: unused
+    :param frame: unused
+    """
     print >> sys.stderr, "Quit signal sent - exiting immediately"
     sys.exit(1)
 
 class CliError(yum.Errors.YumBaseError):
-
-    """
-    Command line interface related Exception.
-    """
+    """Command line interface related Exception."""
 
     def __init__(self, args=''):
         yum.Errors.YumBaseError.__init__(self)
         self.args = args
 
 class YumBaseCli(yum.YumBase, output.YumOutput):
-    """This is the base class for yum cli.
-       Inherits from yum.YumBase and output.YumOutput """
+    """This is the base class for yum cli."""
        
     def __init__(self):
         # handle sigquit early on
@@ -106,15 +107,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         self.registerCommand(yumcommands.LoadTransactionCommand())
 
     def registerCommand(self, command):
+        """Register a :class:`yumcommands.YumCommand` so that it can be called by
+        any of the names returned by its
+        :func:`yumcommands.YumCommand.getNames` method.
+        
+        :param command: the :class:`yumcommands.YumCommand` to register
+        """
         for name in command.getNames():
             if name in self.yum_cli_commands:
                 raise yum.Errors.ConfigError(_('Command "%s" already defined') % name)
             self.yum_cli_commands[name] = command
             
     def doRepoSetup(self, thisrepo=None, dosack=1):
-        """grabs the repomd.xml for each enabled repository 
-           and sets up the basics of the repository"""
-        
+        """Grab the repomd.xml for each enabled and set up the basics
+        of the repository.
+
+        :param thisrepo: the repository to set up
+        :param dosack: whether to get the repo sack
+        """
         if self._repos and thisrepo is None:
             return self._repos
             
@@ -183,10 +193,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         
         
     def getOptionsConfig(self, args):
-        """parses command line arguments, takes cli args:
-        sets up self.conf and self.cmds as well as logger objects 
-        in base instance"""
-       
+        """Parse command line arguments, and set up :attr:`self.conf` and
+        :attr:`self.cmds`, as well as logger objects in base instance.
+
+        :param args: a list of command line arguments
+        """
         self.optparser = YumOptionParser(base=self, usage=self._makeUsage())
         
         # Parse only command line options that affect basic yum setup
@@ -318,9 +329,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         time.sleep(sleeptime)
         
     def parseCommands(self):
-        """reads self.cmds and parses them out to make sure that the requested 
-        base command + argument makes any sense at all""" 
-
+        """Read :attr:`self.cmds` and parse them out to make sure that
+        the requested base command and argument makes any sense at
+        all.  This function will also set :attr:`self.basecmd` and
+        :attr:`self.extcmds`.
+        """
         self.verbose_logger.debug('Yum Version: %s', yum.__version__)
         self.verbose_logger.log(yum.logginglevels.DEBUG_4,
                                 'COMMAND: %s', self.cmdstring)
@@ -365,7 +378,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         self.history.write_addon_data('shell-cmds', data)
 
     def doShell(self):
-        """do a shell-like interface for yum commands"""
+        """Run a shell-like interface for yum commands.
+
+        :return: a tuple containing the shell result number, and the
+           shell result messages
+        """
 
         yumshell = shell.YumShell(base=self)
 
@@ -382,8 +399,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return yumshell.result, yumshell.resultmsgs
 
     def errorSummary(self, errstring):
-        """ parse the error string for 'interesting' errors which can
-            be grouped, such as disk space issues """
+        """Parse the error string for 'interesting' errors which can
+        be grouped, such as disk space issues.
+
+        :param errstring: the error string
+        :return: a string containing a summary of the errors
+        """
         summary = ''
         # do disk space report first
         p = re.compile('needs (\d+)MB on the (\S+) filesystem')
@@ -408,16 +429,17 @@ 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
-        """
-        
+        """Call the base command, and pass it the extended commands or
+           arguments.
+
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
         
@@ -440,9 +462,13 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
 
     def doTransaction(self):
-        """takes care of package downloading, checking, user confirmation and actually
-           RUNNING the transaction"""
-    
+        """Take care of package downloading, checking, user
+        confirmation and actually running the transaction.
+
+        :return: a numeric return code, and optionally a list of
+           errors.  A negative return code indicates that errors
+           occurred in the pre-transaction checks
+        """
         # just make sure there's not, well, nothing to do
         if len(self.tsInfo) == 0:
             self.verbose_logger.info(_('Trying to run the transaction but nothing to do. Exiting.'))
@@ -609,12 +635,14 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return resultobject.return_code
         
     def gpgsigcheck(self, pkgs):
-        '''Perform GPG signature verification on the given packages, installing
-        keys if possible
+        """Perform GPG signature verification on the given packages,
+        installing keys if possible.
 
-        Returns non-zero if execution should stop (user abort).
-        Will raise YumBaseError if there's a problem
-        '''
+        :param pkgs: a list of package objects to verify the GPG
+           signatures of
+        :return: non-zero if execution should stop due to an error
+        :raises: Will raise :class:`YumBaseError` if there's a problem
+        """
         for po in pkgs:
             result, errmsg = self.sigCheckPkg(po)
 
@@ -692,11 +720,22 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             self.verbose_logger.log(yum.logginglevels.INFO_2, msg)
 
     def installPkgs(self, userlist):
-        """Attempts to take the user specified list of packages/wildcards
-           and install them, or if they are installed, update them to a newer
-           version. If a complete version number if specified, attempt to 
-           upgrade (or downgrade if they have been removed) them to the
-           specified version"""
+        """Attempt to take the user specified list of packages or
+        wildcards and install them, or if they are installed, update
+        them to a newer version. If a complete version number is
+        specified, attempt to upgrade (or downgrade if they have been
+        removed) them to the specified version.
+
+        :param userlist: a list of names or wildcards specifying
+           packages to install
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         # get the list of available packages
         # iterate over the user's list
         # add packages to Transaction holding class if they match.
@@ -732,9 +771,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Nothing to do')]
         
     def updatePkgs(self, userlist, quiet=0, update_to=False):
-        """take user commands and populate transaction wrapper with 
-           packages to be updated"""
-        
+        """Take user commands and populate transaction wrapper with
+        packages to be updated.
+
+        :param userlist: a list of names or wildcards specifying
+           packages to update.  If *userlist* is an empty list, yum
+           will perform a global update
+        :param quiet: unused
+        :param update_to: if *update_to* is True, the update will only
+           be run if it will update the given package to the given
+           version.  For example, if the package foo-1-2 is installed,
+           updatePkgs(["foo-1-2], update_to=False) will work
+           identically to updatePkgs(["foo"]), but
+           updatePkgs(["foo-1-2"], update_to=True) will do nothing
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         # if there is no userlist, then do global update below
         # this is probably 90% of the calls
         # if there is a userlist then it's for updating pkgs, not obsoleting
@@ -770,9 +827,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
     #  Note that we aren't in __init__ yet for a couple of reasons, but we 
     # probably will get there for 3.2.28.
     def distroSyncPkgs(self, userlist):
-        """ This does either upgrade/downgrade, depending on if the latest
-            installed version is older or newer. We allow "selection" but not
-            local packages (use tmprepo, or something). """
+        """Upgrade or downgrade packages to match the latest versions
+        available in the enabled repositories.
+
+        :param userlist: list of names or wildcards specifying
+           packages to synchronize with the repositories.  If the
+           first string in *userlist* is "full", packages will also be
+           reinstalled if their checksums do not match the checksums
+           in the repositories.  If *userlist* is an empty list or
+           only contains "full", every installed package will be
+           synchronized
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
 
         level = 'diff'
         if userlist and userlist[0] in ('full', 'diff', 'different'):
@@ -866,9 +938,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             return 0, [_('No Packages marked for Distribution Synchronization')]
 
     def erasePkgs(self, userlist):
-        """take user commands and populate a transaction wrapper with packages
-           to be erased/removed"""
-        
+        """Take user commands and populate a transaction wrapper with
+        packages to be erased.
+
+        :param userlist: a list of names or wildcards specifying
+           packages to erase
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         oldcount = len(self.tsInfo)
 
         all_rms = []
@@ -884,9 +966,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             return 0, [_('No Packages marked for removal')]
     
     def downgradePkgs(self, userlist):
-        """Attempts to take the user specified list of packages/wildcards
-           and downgrade them. If a complete version number if specified,
-           attempt to downgrade them to the specified version"""
+        """Attempt to take the user specified list of packages or
+        wildcards and downgrade them. If a complete version number if
+        specified, attempt to downgrade them to the specified version
+
+        :param userlist: a list of names or wildcards specifying
+           packages to downgrade
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
 
         oldcount = len(self.tsInfo)
         
@@ -911,8 +1004,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Nothing to do')]
         
     def reinstallPkgs(self, userlist):
-        """Attempts to take the user specified list of packages/wildcards
-           and reinstall them. """
+        """Attempt to take the user specified list of packages or
+        wildcards and reinstall them.
+
+        :param userlist: a list of names or wildcards specifying
+           packages to reinstall
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
 
         oldcount = len(self.tsInfo)
 
@@ -946,9 +1050,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Nothing to do')]
 
     def localInstall(self, filelist, updateonly=0):
-        """handles installs/updates of rpms provided on the filesystem in a 
-           local dir (ie: not from a repo)"""
-           
+        """Install or update rpms provided on the file system in a
+        local directory (i.e. not from a repository).
+
+        :param filelist: a list of names specifying local rpms
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """           
         # read in each package into a YumLocalPackage Object
         # append it to self.localPackages
         # check if it can be installed or updated based on nevra versus rpmdb
@@ -972,20 +1085,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Nothing to do')]
 
     def returnPkgLists(self, extcmds, installed_available=False):
-        """Returns packages lists based on arguments on the cli.returns a 
-           GenericHolder instance with the following lists defined:
-           available = list of packageObjects
-           installed = list of packageObjects
-           updates = tuples of packageObjects (updating, installed)
-           extras = list of packageObjects
-           obsoletes = tuples of packageObjects (obsoleting, installed)
-           recent = list of packageObjects
-
-           installed_available = that the available package list is present
-                                 as .hidden_available when doing any of:
-                                 all/available/installed
-           """
-        
+        """Return a :class:`yum.misc.GenericHolder` object containing
+        lists of package objects that match the given names or wildcards.
+
+        :param extcmds: a list of names or wildcards specifying
+           packages to list
+        :param installed_available: whether the available package list
+           is present as .hidden_available when doing all, available,
+           or installed
+
+        :return: a :class:`yum.misc.GenericHolder` instance with the
+           following lists defined::
+
+             available = list of packageObjects
+             installed = list of packageObjects
+             updates = tuples of packageObjects (updating, installed)
+             extras = list of packageObjects
+             obsoletes = tuples of packageObjects (obsoleting, installed)
+             recent = list of packageObjects
+        """
         special = ['available', 'installed', 'all', 'extras', 'updates', 'recent',
                    'obsoletes']
         
@@ -1017,8 +1135,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return ypl
 
     def search(self, args):
-        """cli wrapper method for module search function, searches simple
-           text tags in a package object"""
+        """Search for simple text tags in a package object. This is a
+        cli wrapper method for the module search function.
+
+        :param args: list of names or wildcards to search for.
+           Normally this method will begin by searching the package
+           names and summaries, and will only search urls and
+           descriptions if that fails.  However, if the first string
+           in *args* is "all", this method will always search
+           everything
+        :return: a tuple where the first item is an exit code, and
+           the second item is a generator if the search is a
+           successful, and a list of error messages otherwise
+
+        exit_code is::
+
+            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
+        """
         
         # call the yum module search function with lists of tags to search
         # and what to search for
@@ -1108,9 +1243,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, matching
 
     def deplist(self, args):
-        """cli wrapper method for findDeps method takes a list of packages and 
-            returns a formatted deplist for that package"""
+        """Print out a formatted list of dependencies for a list of
+        packages.  This is a cli wrapper method for
+        :class:`yum.YumBase.findDeps`.
 
+        :param args: a list of names or wildcards specifying packages
+           that should have their dependenices printed
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         pkgs = []
         for arg in args:
             if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
@@ -1131,10 +1277,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, []
 
     def provides(self, args):
-        """use the provides methods in the rpmdb and pkgsack to produce a list 
-           of items matching the provides strings. This is a cli wrapper to the 
-           module"""
-        
+        """Print out a list of packages that provide the given file or
+        feature.  This a cli wrapper to the provides methods in the
+        rpmdb and pkgsack.
+
+        :param args: the name of a file or feature to search for
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         old_sdup = self.conf.showdupesfromrepos
         # For output, as searchPackageProvides() is always in showdups mode
         self.conf.showdupesfromrepos = True
@@ -1163,8 +1318,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, []
     
     def resolveDepCli(self, args):
-        """returns a package (one per user arg) that provide the supplied arg"""
-        
+        """Print information about a package that provides the given
+        dependency.  Only one package will be printed per dependency.
+
+        :param args: a list of strings specifying dependencies to
+           search for
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         for arg in args:
             try:
                 pkg = self.returnPackageByDep(arg)
@@ -1177,6 +1343,34 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, []
     
     def cleanCli(self, userlist):
+        """Remove data from the yum cache directory.  What data is
+        removed depends on the options supplied by the user.
+
+        :param userlist: a list of options.  The following are valid
+           options::
+
+             expire-cache = Eliminate the local data saying when the
+               metadata and mirror lists were downloaded for each
+               repository.
+             packages = Eliminate any cached packages
+             headers = Eliminate the header files, which old versions
+               of yum used for dependency resolution
+             metadata = Eliminate all of the files which yum uses to
+               determine the remote availability of packages
+             dbcache = Eliminate the sqlite cache used for faster
+               access to metadata
+             rpmdb = Eliminate any cached datat from the local rpmdb
+             plugins = Tell any enabled plugins to eliminate their
+               cached data
+             all = do all of the above
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         hdrcode = pkgcode = xmlcode = dbcode = expccode = 0
         pkgresults = hdrresults = xmlresults = dbresults = expcresults = []
         msg = self.fmtKeyValFill(_('Cleaning repos: '), 
@@ -1228,7 +1422,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return code, []
 
     def returnGroupLists(self, userlist):
+        """Print out a list of groups that match the given names or
+        wildcards.
+
+        :param extcmds: a list of names or wildcards specifying
+           groups to list
+        :return: (exit_code, [ errors ])
 
+        exit_code is::
+
+            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        
+        """
         uservisible=1
             
         if len(userlist) > 0:
@@ -1283,7 +1489,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Done')]
 
     def returnGroupSummary(self, userlist):
+        """Print a summary of the groups that match the given names or
+        wildcards.
+
+        :param userlist: a list of names or wildcards specifying the
+           groups to summarise. If *userlist* is an empty list, all
+           installed and available packages will be summarised
+        :return: (exit_code, [ errors ])
 
+        exit_code is::
+
+            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
+        """
         uservisible=1
             
         if len(userlist) > 0:
@@ -1327,7 +1546,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, [_('Done')]
     
     def returnGroupInfo(self, userlist):
-        """returns complete information on a list of groups"""
+        """Print complete information about the groups that match the
+        given names or wildcards.
+
+        :param userlist: a list of names or wildcards specifying the
+           groups to print information about
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         for strng in userlist:
             group_matched = False
             for group in self.comps.return_groups(strng):
@@ -1340,8 +1571,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return 0, []
         
     def installGroups(self, grouplist):
-        """for each group requested do 'selectGroup' on them."""
-        
+        """Mark the packages in the given groups for installation.
+
+        :param grouplist: a list of names or wildcards specifying
+           groups to be installed
+        :return: (exit_code, [ errors ])
+
+        exit_code is::
+
+            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
+        """
         pkgs_used = []
         
         for group_string in grouplist:
@@ -1368,8 +1609,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             return 2, [P_('%d package to Install', '%d packages to Install', len(pkgs_used)) % len(pkgs_used)]
 
     def removeGroups(self, grouplist):
-        """Remove only packages of the named group(s). Do not recurse."""
+        """Mark the packages in the given groups for removal.
+
+        :param grouplist: a list of names or wildcards specifying
+           groups to be removed
+        :return: (exit_code, [ errors ])
 
+        exit_code is::
+
+            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
+        """
         pkgs_used = []
         for group_string in grouplist:
             try:
@@ -1408,11 +1659,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return False
 
     def usage(self):
-        ''' Print out command line usage '''
+        """Print out an explanation of command line usage."""
         sys.stdout.write(self.optparser.format_help())
 
     def shellUsage(self):
-        ''' Print out the shell usage '''
+        """Print out an explanation of the shell usage."""
         sys.stdout.write(self.optparser.get_usage())
     
     def _installable(self, pkg, ematch=False):
@@ -1468,9 +1719,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         return False
 
 class YumOptionParser(OptionParser):
-    '''Subclass that makes some minor tweaks to make OptionParser do things the
+    """Subclass that makes some minor tweaks to make OptionParser do things the
     "yum way".
-    '''
+    """
 
     def __init__(self,base, **kwargs):
         # check if this is called with a utils=True/False parameter
@@ -1488,13 +1739,23 @@ class YumOptionParser(OptionParser):
         self._addYumBasicOptions()
 
     def error(self, msg):
-        '''This method is overridden so that error output goes to logger. '''
+        """Output an error message, and exit the program.  This method
+        is overridden so that error output goes to the logger.
+
+        :param msg: the error message to output
+        """
         self.print_usage()
         self.logger.critical(_("Command line error: %s"), msg)
         sys.exit(1)
 
     def firstParse(self,args):
-        # Parse only command line options that affect basic yum setup
+        """Parse only command line options that affect basic yum
+        setup.
+
+        :param args: a list of command line options to parse
+        :return: a dictionary containing the values of command line
+           options
+        """
         try:
             args = _filtercmdline(
                         ('--noplugins','--version','-q', '-v', "--quiet", "--verbose"), 
@@ -1521,7 +1782,15 @@ class YumOptionParser(OptionParser):
         return ret
         
     def setupYumConfig(self, args=None):
-        # Now parse the command line for real
+        """Parse command line options.
+
+        :param args: the command line arguments entered by the user
+        :return: (opts, cmds)  opts is a dictionary containing
+           the values of command line options.  cmds is a list of the
+           command line arguments that were not parsed as options.
+           For example, if args is ["install", "foo", "--verbose"],
+           cmds will be ["install", "foo"].
+        """
         if not args:
             (opts, cmds) = self.parse_args()
         else:
@@ -1640,6 +1909,14 @@ class YumOptionParser(OptionParser):
         sys.exit(1)
 
     def getRoot(self,opts):
+        """Return the root location to use for the yum operation.
+        This location can be changed by using the --installroot
+        option.
+
+        :param opts: a dictionary containing the values of the command
+           line options
+        :return: a string representing the root location
+        """
         self._checkAbsInstallRoot(opts)
         # If the conf file is inside the  installroot - use that.
         # otherwise look for it in the normal root
-- 
1.7.5.4



More information about the Yum-devel mailing list