
N_c           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z d d l m	 Z	 d d l
 Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d	 l m Z m  Z  d
   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d   Z' d   Z( d   Z) d   Z* g  d  Z+ d f  d     YZ, d e, f d     YZ- d e, f d     YZ. d e, f d     YZ/ d d  Z0 d   Z1 d    Z2 d! e, f d"     YZ3 d# e3 f d$     YZ4 d% e, f d&     YZ5 d' e, f d(     YZ6 d) e, f d*     YZ7 d+ e, f d,     YZ8 d- e, f d.     YZ9 d/ e, f d0     YZ: d1 e, f d2     YZ; d3 e, f d4     YZ< d5 e, f d6     YZ= d7 e, f d8     YZ> d9 e, f d:     YZ? d; e, f d<     YZ@ d= e, f d>     YZA d? e, f d@     YZB dA e, f dB     YZC dC e, f dD     YZD dE e, f dF     YZE dG e, f dH     YZF dI e, f dJ     YZG dK e, f dL     YZH dM e, f dN     YZI dO e, f dP     YZJ e ZK dQ e, f dR     YZL dS e, f dT     YZM dU e, f dV     YZN dW e, f dX     YZO d S(Y   s<   
Classes for subcommands of the yum command line interface.
iN(   t   logginglevels(   t   _t   P_(   t   misc(   t
   utf8_widtht   utf8_width_fillt
   to_unicodet   exception2msg(   t
   updateinfo(   t   parsePackages(   t   LibLVMErrort
   lvmerr2strc         C   sj   | |  j  k r |  j   d  S|  j  | } |  j  d j |  } |  j j t d   |  j j |  d  S(   Nt   helps    Mini usage:
(   t   yum_cli_commandst   usaget   _makeOutputt   loggert   criticalR   (   t   baset   basecmdt   cmdt   txt(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _err_mini_usage/   s    
c         C   s8   |  j  j d k r4 |  j j t d   t j  n  d S(   s   Verify that the program is being run by the root user.

    :param base: a :class:`yum.Yumbase` object.
    :raises: :class:`cli.CliError`
    i    s,   You need to be root to perform this command.N(   t   conft   uidR   R   R   t   clit   CliError(   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkRootUID8   s    c         C   s   |  j  r d S|  j   s xw |  j j   D]c } | j sA | j r) | j r) t d  } |  j j	 |  |  j j	 t d  |  t
 j  q) q) Wn  d S(   s   Verify that there are gpg keys for the enabled repositories in the
    rpm database.

    :param base: a :class:`yum.Yumbase` object.
    :raises: :class:`cli.CliError`
    Ns  
You have enabled checking of packages via GPG keys. This is a good thing. 
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key


Alternatively you can specify the url to the key you would like to use
for a repository in the 'gpgkey' option in a repository section and yum 
will install it for you.

For more information contact your distribution or package provider.
s   Problem repository: %s(   t   _override_sigcheckst   gpgKeyCheckt   repost   listEnabledt   gpgcheckt   repo_gpgcheckt   gpgkeyR   R   R   R   R   (   R   t   repot   msg(    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkGPGKeyB   s    		c         C   sI   t  |  d k rE |  j j t d  |  t |  |  t j  n  d S(   s/  Verify that *extcmds* contains the name of at least one package for
    *basecmd* to act on.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i    s(   Error: Need to pass a list of pkgs to %sN(   t   lenR   R   R   R   R   R   (   R   R   t   extcmds(    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkPackageArg`   s
    		c         C   sd   d } d | k r d } n  t  |  | k  r` |  j j t d  |  t |  |  t j  n  d S(   s0  Verify that *extcmds* contains the name of at least two packages for
    *basecmd* to act on.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i   s   --i   s'   Error: Need at least two packages to %sN(   R&   R   R   R   R   R   R   (   R   R   R'   t   min_args(    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkSwapPackageArgo   s    			c         C   s  t  |  d k  rE |  j j t d  |  t |  |  t j  n  |  j j | d d t	 d t	 } | s |  j j t d  |  t |  |  t j  n  t  |  d k r g  | D] } | j
   r | ^ q } n  t  |  d k rJd j g  | D] } | j ^ q  } |  j j t d	  | | f  t |  |  t j  n  | d j
   s|  j j | d j  |  j j t d
  | d j  n  d S(   s/  Verify that *extcmds* contains the name of at least one package for
    *basecmd* to act on.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i   s/   Error: Need to pass a repoid. and command to %si    t
   name_matcht   ignore_cases0   Error: Need to pass a single valid repoid. to %si   s   , sA   Error: Need to pass only a single valid repoid. to %s, passed: %ss'   Repo %s has been automatically enabled.N(   R&   R   R   R   R   R   R   R   t	   findRepost   Truet	   isEnabledt   joint   ui_idt
   enableRepot   idt   verbose_loggert   info(   R   R   R'   R   t   r(    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkRepoPackageArg   s.    		"	(%		c         C   sE   t  |  d k rA |  j j t d   t |  |  t j  n  d S(   s  Verify that *extcmds* contains the name of at least one item for
    *basecmd* to act on.  Generally, the items are command-line
    arguments that are not the name of a package, such as a file name
    passed to provides.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i    s   Error: Need an item to matchN(   R&   R   R   R   R   R   R   (   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkItemArg   s    c         C   sE   t  |  d k rA |  j j t d   t |  |  t j  n  d S(   s-  Verify that *extcmds* contains the name of at least one group for
    *basecmd* to act on.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i    s%   Error: Need a group or list of groupsN(   R&   R   R   R   R   R   R   (   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkGroupArg   s    	c         C   s   d } t  |  d	 k rG |  j j t d
  d j |   t j  n  xM | D]E } | | k rN |  j j t d  |  t |  |  t j  qN qN Wd S(   sL  Verify that *extcmds* contains at least one argument, and that all
    arguments in *extcmds* are valid options for clean.

    :param base: a :class:`yum.Yumbase` object
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    t   headerst   packagest   metadatat   dbcachet   pluginss   expire-cachet   rpmdbt   alli    s#   Error: clean requires an option: %ss   , s!   Error: invalid clean argument: %rN(   R:   s   packagesR<   R=   R>   s   expire-caches   rpmdbs   all(   R&   R   R   R   R0   R   R   R   (   R   R   R'   t
   VALID_ARGSR   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkCleanArg   s    	 c         C   s   t  |  d k r+ |  j j t d   n t  |  d k r |  j j t d  | d  t j j | d  s |  j j t d  | d  |  j	   t
 j  q n) |  j j t d   |  j	   t
 j  d S(   sv  Verify that the arguments given to 'yum shell' are valid.  yum
    shell can be given either no argument, or exactly one argument,
    which is the name of a file.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`
    i    s   No argument to shelli   s   Filename passed to shell: %ss2   File %s given as argument to shell does not exist.s5   Error: more than one file given as argument to shell.N(   R&   R4   t   debugR   t   ost   patht   isfileR   R   R   R   R   (   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkShellArg   s    
		
	
c         C   s   |  j  j   r d SxE | D]= } | j d  r t j j |  sS t j j |  r d Sq W|  j	 |  j  j   ru d St
 d  } |  j j |  t j  d S(   s  Verify that there is at least one enabled repo.

    :param base: a :class:`yum.Yumbase` object.
    :param basecmd: the name of the command being checked for
    :param extcmds: a list of arguments passed to *basecmd*
    :raises: :class:`cli.CliError`:
    Ns   .rpms   There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>(   R   R   t   endswitht   yumR   t   re_remote_urlRD   RE   t   existst   pkgSackR   R   R   R   R   (   R   t   possible_local_filest   lfileR$   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   checkEnabledRepo   s    !t
   YumCommandc           B   s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   s   An abstract base class that defines the methods needed by the cli
    to execute a specific command.  Subclasses must override at least
    :func:`getUsage` and :func:`getSummary`.
    c         C   s   t  |  _ t  |  _ d  S(   N(   t   Falset   done_command_oncet   hidden(   t   self(    (    s!   /usr/share/yum-cli/yumcommands.pyt   __init__  s    	c         G   s2   |  j  s% | j j t j | |  n  t |  _  d S(   sm   Output *msg* the first time that this method is called, and do
        nothing on subsequent calls.  This is to prevent duplicate
        messages from being printed for the same command.

        :param base: a :class:`yum.Yumbase` object
        :param msg: the message to be output
        :param *args: additional arguments associated with the message
        N(   RR   R4   R5   R    t   INFO_2R.   (   RT   R   R$   t   args(    (    s!   /usr/share/yum-cli/yumcommands.pyt   doneCommand  s    		c         C   s   g  S(   s   Return a list of strings that are the names of the command.
        The command can be called from the command line by using any
        of these names.

        :return: a list containing the names of the command
        (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   getNames,  s    c         C   s
   t   d S(   su   Return a usage string for the command, including arguments.

        :return: a usage string for the command
        N(   t   NotImplementedError(   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   getUsage5  s    c         C   s
   t   d S(   sz   Return a one line summary of what the command does.

        :return: a one line summary of what the command does
        N(   RZ   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyt
   getSummary<  s    c         C   s   d S(   s  Verify that various conditions are met so that the command
        can run.

        :param base: a :class:`yum.Yumbase` object.
        :param basecmd: the name of the command being checked for
        :param extcmds: a list of arguments passed to *basecmd*
        N(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   doCheckC  s    c         C   s   d t  d  g f S(   s  Execute the command

        :param base: a :class:`yum.Yumbase` object.
        :param basecmd: the name of the command being executed
        :param extcmds: a list of arguments passed to *basecmd*
        :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
        i    s   Nothing to do(   R   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt	   doCommandM  s    c         C   s   t  S(   sE  Return whether a transaction set must be set up before the
        command can run

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   R.   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   needTs]  s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        t   write(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   cacheRequirementy  s    (   t   __name__t
   __module__t   __doc__RU   RX   RY   R[   R\   R]   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRP     s   							
		t   InstallCommandc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sU   A class containing methods needed by the cli to execute the
    install command.
    c         C   s   d d d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of
        these names.

        :return: a list containing the names of this command
        t   installs	   install-ns
   install-nas   install-nevra(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s
   t  d  S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s,   Install a package or packages on your system(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s5   t  |  t |  t | | |  t | |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R(   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    


c         C   s)   |  j  | t d   | j | d | S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Setting up Install ProcessR   (   RX   R   t   installPkgs(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    (   Rb   Rc   Rd   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRe     s   					t   UpdateCommandc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sT   A class containing methods needed by the cli to execute the
    update command.
    c         C   s
   d d g S(   s   Return a list containing the names of this command.  This
        command can by called from the command line by using any of
        these names.

        :return: a list containing the names of this command
        t   updates	   update-to(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s
   t  d  S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [PACKAGE...](   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s+   Update a package or packages on your system(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s%   t  |  t |  t | |  d S(   sv  Verify that conditions are met so that this command can run.
        These include that there are enabled repositories with gpg
        keys, and that this command is being run by the root user.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    	

c         C   sB   |  j  | t d   | j | d | d k } t j |  | S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Setting up Update Processt	   update_tos	   update-to(   RX   R   t
   updatePkgsR   t   remove_txmbrs(   RT   R   R   R'   t   ret(    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    (   Rb   Rc   Rd   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRh     s   					t   DistroSyncCommandc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sZ   A class containing methods needed by the cli to execute the
    distro-synch command.
    c         C   s   d d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        s   distribution-synchronizations   distro-synct   distupgrade(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s
   t  d  S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [PACKAGE...](   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   
  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s?   Synchronize installed packages to the latest available versions(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s%   t  |  t |  t | |  d S(   su  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        and that there are enabled repositories with gpg keys.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    	

c         C   sB   |  j  | t d   d | j _ | j |  } t j |  | S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s/   Setting up Distribution Synchronization Processi   (   RX   R   R   t	   obsoletest   distroSyncPkgsR   Rl   (   RT   R   R   R'   Rm   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   %  s
    (   Rb   Rc   Rd   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRn     s   				t    c         C   s   t  | j  d t  | j  t  |  } t  | j  d t  | j  } t  | j  } | j d k r | t  | j  d 7} n  xW d | f d | f d | f f D]4 \ } } |  | j | d  |  | | c d 7<q Wd S(   sl    Get the length of each pkg's column. Add that to data.
        This "knows" about simpleList and printVer. i   t   0t   nat   vert   ridi    N(   R&   t   namet   archt   versiont   releaset   ui_from_repot   epocht
   setdefault(   t   datat   pkgt   indentRt   Ru   Rv   t   dt   v(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _add_pkg_simple_list_lens9  s    * .c         C   s  i i  d 6i  d 6i  d 6} xJ | j  | j | j | j | j f D]$ } x | D] } t | |  qM Wq@ Wt | j  d k r x: | j D], \ } } t | |  t | | d d q Wn  | d | d | d g } |  j	 | d d	 } | d | d	 | d
 f S(   sA    Work out the dynamic size of the columns to pass to fmtColumns. Rt   Ru   Rv   i    R   t    i   t   remainder_columni   i   s       (
   t	   installedt	   availablet   extrast   updatest   recentR   R&   Rp   t   obsoletesTuplest   calcColumns(   R   t   yplR~   t   lstR   t   npkgt   opkgt   columns(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _list_cmd_calc_columnsE  s    c         C   sU   | s
 |  St  |  |  \ } } } t | |  } g  |  D] } | | k r9 | ^ q9 S(   sE    Do an extra exclude for installed packages that match the cmd line. (   R	   t   set(   t   pkgst   cmdline_excludest   et   mt   ut   excludedt   po(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _cmdline_excludeU  s
    t   InfoCommandc           B   sG   e  Z d  Z d   Z d   Z d   Z d d  Z d   Z d   Z	 RS(   sR   A class containing methods needed by the cli to execute the
    info command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        R5   (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   b  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        sO   [PACKAGE|all|available|installed|updates|distro-extras|extras|obsoletes|recent](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   j  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s4   Display details about a package or group of packages(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   q  s    c          C   s  | r& | d d k r& t  j |  n t  j |  t r| j j d } | d k rt | rt | d d k rt t } n  | j | d | d | } i  } i  } i  }	 d }
 | d	 k r t	 | |  }
 n  | r7| j
 r7x` | j | j | j D]D } | j | j f } | | k s#| j | |  r | | | <q q Wn  | r| j rxR | j D]D } | j | j f } | | k s| j | |  rP| | | <qPqPWn  | r| j rxQ t | j  D]= } | j j d k r| j   r| |	 | j | j f <qqWn  | j j } | j j } | j j } | j j } | j j } | j j rat | j
 | j   | _
 n  | j! | j
 t" d
  | d | d |
 d i | d 6| d 6| d 6| d 6| d 6} | j j# } | j j$ } | j j% } | j j& } | j j' } | j! | j t" d  | d | d |
 d i | d 6| d 6| d 6| d 6| d 6} | j! | j( t" d  | d |
 } | j j) } | j j* } | j! | j t" d  | d |	 d |
 d i | d 6| d 6} t+ | j,  d k r=| d	 k r=d d g } t" d  GHxi t | j- d t. j/ d  D]" } | j0 | d d |
 d | qWn$ | j! | j, t" d  | d |
 } | j! | j1 t" d  | d |
 } t+ |  r| d r| d r| d r| d r| d r| d rd t" d  g f Sd g  f Sd S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i    R   Rp   t   boldR5   R   t   installed_availablet   repoidt   lists   Installed Packagest   highlight_naR   t   highlight_modest   >t   <t   kernt   =s   not ins   Available Packagess   Extra Packagess   Updated PackagesRr   s   Obsoleting Packagest   keys   Recently Added Packagesi   s   No matching Packages to listN(   s   updatess	   obsoletes(2   R   t   exclude_updatest   exclude_allR.   t   termt   MODERQ   t   returnPkgListst   NoneR   R   t   hidden_availablet   reinstall_availablet   old_availableRw   Rx   t   verGTR   t   hidden_installedR   t   sortedR#   R3   t   verifyLocalPkgR   t#   color_list_installed_running_kernelt   color_list_installed_oldert   color_list_installed_newert   color_list_installed_reinstallt   color_list_installed_extrat   query_install_excludesR   R   t   listPkgsR   t#   color_list_available_running_kernelt   color_list_available_upgradet   color_list_available_downgradet   color_list_available_reinstallt   color_list_available_installR   t   color_update_localt   color_update_remoteR&   Rp   R   t   operatort
   itemgettert   updatesObsoletesListR   (    RT   R   R   R'   R   t	   highlightR   t   update_pkgst	   inst_pkgst
   local_pkgsR   R   R   R   R   t   cliot   clint   clirt   cliet   ript   claut   cladt   clart   clait   rapt   rept   cult   curt   rupt   ropt   obtupt   rrap(    (    s!   /usr/share/yum-cli/yumcommands.pyR^   x  s    "		 		!<c         C   s$   t  |  r  | d d k r  t St S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        i    R   (   R&   RQ   R.   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	c         C   sD   t  |  r  | d d k r  d St  |  r@ | d d k r@ d	 Sd
 S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        i    R   Rp   s   read-only:futureR   s   distro-extrasR   R   s   read-only:pasts   read-only:present(   s   updatess	   obsoletes(   s	   installeds   distro-extrass   extrass   recent(   R&   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s
    N(
   Rb   Rc   Rd   RY   R[   R\   R   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR   ]  s   			x	t   ListCommandc           B   s    e  Z d  Z d   Z d   Z RS(   sR   A class containing methods needed by the cli to execute the
    list command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        R   (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s$   List a package or groups of packages(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    (   Rb   Rc   Rd   RY   R\   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR     s   	t   EraseCommandc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   sS   A class containing methods needed by the cli to execute the
    erase command.
    c         C   s(   d d d d d d d d d	 d
 d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   eraset   removet
   autoremoves   erase-ns   erase-nas   erase-nevras   autoremove-ns   autoremove-nas   autoremove-nevras   remove-ns	   remove-nas   remove-nevra(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   )  s    			c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   4  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s-   Remove a package or packages from your system(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   ;  s    c         C   s.   t  |  | d k r d St | | |  d S(   s  Verify that conditions are met so that this command can
        run.  These include that the program is being run by the root
        user, and that this command is called with appropriate
        arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        R   N(   R   R(   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   B  s    

c         C   s   t  } | j d  r t | j _ | t d  } | s t } g  } xZ t | j j    D]@ } d | j	 k rt qY n  | j	 j
 d k r qY n  | j |  qY Wq n  |  j | t d   | j | d | d | } | S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        R   t   autot   reasont   deps   Setting up Remove Processt   posR   (   RQ   t
   startswithR.   R   t   clean_requirements_on_removeR&   R   R?   t   returnLeafNodest
   yumdb_infoR   t   appendRX   R   t	   erasePkgs(   RT   R   R   R'   R   R   Rm   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   Q  s     c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   w  s    	c         C   s   t  S(   sd  Return whether a transaction set for removal only must be
        set up before this command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a remove-only transaction set is needed, False otherwise
        (   R.   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   needTsRemove  s    	(
   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   R   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR   #  s   					&	t   GroupsCommandc           B   s   e  Z d  Z i d d 6d d 6d d 6d d 6d d	 6d
 d 6Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z RS(   s;    Single sub-command interface for most groups interaction. R   t	   grouplistRf   t   groupinstallRi   t   groupupdateR   t   groupremovet
   grouperaseR5   t	   groupinfoc         C   s   d d g |  j  j   S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   groupst   group(   t   direct_commandst   keys(   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s7   [list|info|summary|install|upgrade|remove|mark] [GROUP](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s'   Display, or use, the groups information(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s}   |  j  | t d   | j d d  y | j   WnB t j j k
 r] d t d  g f St j j k
 rx }   n Xd  S(   Ns   Setting up Group Processt   dosacki    i   s!   No Groups on which to run command(   RX   R   t   doRepoSetupt   doGroupSetupRI   t   Errorst   GroupsErrort   YumBaseError(   RT   R   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _grp_setup_doCommand  s    c         C   s   | |  j  k r |  j  | } n# | r< | d } | d } n d } | d k ru | ru d | | d f } | d } n  i d d 6d	 d
 6d d 6} | j | |  } | | f S(   Ni    i   t   summaryt   markt   unmarks   %s-%st   upgradeRi   R   R   s   mark-removes
   mark-erase(   s   markR   (   R   t   get(   RT   R   R'   R   t   remap(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _grp_cmd  s    


c         C   sY  |  j  | |  \ } } t |  g  } g  } | j j d k rO d } d  } n  | d! k sg | | k rz t | | |  n  | d" k s | | k r t |  n  | d# k r t |  n  t d$  } | j j d k r | j |  n  | | k r | j	 j
 t d  d j |   t j  n  | j j d k r5n t j j t j j | j j   s| j	 j
 t d   | j	 j
 t d   n t j t j j | j j  t j  s| j	 j
 t d   t j  n t j j | j j  s| j	 j
 t d   | j	 j
 t d   n= t j | j j t j  sU| j	 j
 t d   t j  n  d S(%   sY  Verify that conditions are met so that this command can run.
        The exact conditions checked will vary depending on the
        subcommand that is being called.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        t   objectss   mark-installs   mark-removes   mark-blacklists   mark-packagess   mark-packages-forces   unmark-packagess   mark-packages-syncs   mark-packages-sync-forces   mark-groupss   mark-groups-forces   unmark-groupss   mark-groups-syncs   mark-groups-sync-forces   mark-converts   mark-convert-whitelists   mark-convert-blacklistRf   R   R5   R   R   R   s$   Invalid groups sub-command, use: %s.s   , s"   There is no installed groups file.s0   Maybe run: yum groups mark convert (see man yum)s(   You don't have access to the groups DBs.s'   You don't have access to the groups DB.N(   s   mark-installs   mark-removes   mark-blacklists   mark-packagess   mark-packages-forces   unmark-packagess   mark-packages-syncs   mark-packages-sync-forces   mark-groupss   mark-groups-forces   unmark-groupss   mark-groups-syncs   mark-groups-sync-force(   s   mark-installs   mark-removes   mark-converts   mark-convert-whitelists   mark-convert-blacklists   mark-blacklists   mark-packagess   mark-packages-forces   unmark-packagess   mark-packages-syncs   mark-packages-sync-forces   mark-groupss   mark-groups-forces   unmark-groupss   mark-groups-syncs   mark-groups-sync-force(   s   installs   removes   info(   s   installs   removes   upgrade(   s   installs   upgrade(   s   lists   infos   removes   installs   upgrades   summary(   R  RO   R   t   group_commandR9   R   R%   R   Ri   R   R   R   R0   R   R   RD   RE   RK   t   dirnamet   igroupst   filenamet   accesst   R_OK(   RT   R   R   R'   R   t	   ocmds_allt	   ocmds_argt   cmds(    (    s!   /usr/share/yum-cli/yumcommands.pyR]     sb    	
               	$'c            s2
  |  j  | |  \  } |  j     d k r>   j |  S d k rW   j |  St r.
 d k rv   j |  S d k r   j |  S d k r   j | d t } t j    | S d k r   j	 |  S d k r  j
 | d t } | \ } } } }	 x' |	 D] }
   j j |
 j |
 j  qWx] | D]U } t   } x-   j j | j  D] } | j | j  qcW  j j | j |  q>W  j j   d	 d
 d j |  g f S d k r  j
 | d t } | \ } } } }	 xN | D]F }   j j | j  }
 |
 sqn  t   j _ | j j | j   qWxN | D]F }   j j! | j"  } | spqIn  t   j _ | j# j | j  qIW  j j   d	 d d j |  g f S d3 k rt$ |  d k  rd d g f S  j
 | d	 g d t } | \ } } } }	 | d2 k s1t$ |  d k r>d d g f S| d	 }  d k } xk   j j& d | d  D]P } | rd | j' k rqnn  | j" | j' _( | j# j | j  t   j _ qnW  j j   d	 d d j | d  g f S d k rNx8   j j& d |  D]! } d | j' k r| j' `( qqWd	 d d j |  g f S d4 k r9  j
 | d t } | \ } } } }	 | sd d g f S d k } xY | D]Q } xH   j j | j#  D]1 } | rd | j' k rqn  | j" | j' _( qWqW| rd	 d d j |  g f Sd	 d d j |  g f Sn   d5 k r~t$ |  d k  rdd d g f S  j
 | d	 g d t } | \ } } } }	 | d2 k st$ |  d k rd d  g f S| d	 }
  d k }   j
 | d d t } x. | d D]" } |  j j | j | j |  qW| rSx- | d	 D] } |
 j | _) t   j _ q.Wn    j j   d	 d! d j | d  g f S d" k r  j
 | d	 g d t } | \ } } } }	 | d2 k rd d# g f Sx# | D] } d2 | _) t   j _ qW  j j   d	 d$ d j |  g f S d6 k r4  j
 | d t } | \ } } } }	 | sdd d  g f S d& k } xw | D]o }
 d j t* |
 j   } xN   j j+ |  D]: } | r| j) d2 k	 rqn  |
 j | _) t   j _ qWqwW  j j   | rd	 d' d j |  g f Sd	 d( d j |  g f Sn   d7 k r	   f d,   } x*   j j  j,   D] }   j j- |  qeWx,   j D]! } d | j' k r| j' `( qqW  j j.   j j/    d- t f d. t f f } xT | D]L \ } }   j j! |  } | d2 k r	qn  | r(	t | _0 n  | |  qWx6   j j1   D]% } | j | k ra	qF	n  | |  qF	W  j j   d	 d/ g f S d0 k r.
  j
 | d t } | \ } } } }	 x! | D] }
   j j2 |
 j  q	Wx! | D] }   j j- | j"  q	W  j j   d	 d1 d j |  g f Sn  d2 S(8   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        R   R   R5   Rf   R   R   s   mark-installR,   i    s   Marked install: t   ,s   mark-blacklists   Marked upgrade blacklist: s   mark-packagess   mark-packages-forcei   i   s   No group or package givens   No group matchedt   patternst   group_members   Marked packages: s   unmark-packagess   UnMarked packages: s   mark-packages-syncs   mark-packages-sync-forces   Marked packages-sync-force: s   Marked packages-sync: s   mark-groupss   mark-groups-forces   No environment or group givens   No environment matcheds   Marked groups: s   unmark-groupss   No groups matcheds   UnMarked groups: s   mark-groups-syncs   mark-groups-sync-forces   Marked groups-sync-force: s   Marked groups-sync: s   mark-converts   mark-convert-whitelists   mark-convert-blacklistc            s   |  j  s d  Sg  } xQ   j j |  j  D]: } d | j k rD q) n  |  j | j _ | j | j  q) W d k r   j	 j
 |  j |  n   j	 j
 |  j |  j  d  S(   NR  s   mark-convert-whitelist(   R   R?   t   searchNamesR;   R   t   groupidR  R   Rw   R  t	   add_group(   t   grpt	   pkg_namesR   (   R   R   (    s!   /usr/share/yum-cli/yumcommands.pyt   _convert_grp  s    	t   coreR   s&   Converted old style groups to objects.s   mark-removes   Marked remove: N(   s   mark-packagess   mark-packages-force(   s   mark-packages-syncs   mark-packages-sync-force(   s   mark-groupss   mark-groups-force(   s   mark-groups-syncs   mark-groups-sync-force(   s   mark-converts   mark-convert-whitelists   mark-convert-blacklist(3   R  R   t   returnGroupSummaryt   returnGroupListsR.   t   returnGroupInfot   installGroupsR   Rl   t   removeGroupst   _groupReturnGroupsRQ   R  t   add_environmentt   environmentidt	   allgroupsR   R?   R  R;   t   addRw   R  R  t   saveR0   t   compst   return_environmentt   evgidt   changedt	   grp_namesRi   R   t   return_groupt   gidR  R&   R   t   returnPackagesR   R  t   environmentR   t   return_groupsR   t	   del_groupt   compilet   simplePkgListR   t
   get_groupst   del_environment(   RT   R   R   R'   Rm   t   gRGt   igrpst   grpst   ievgrpst   evgrpst   evgrpR  R  R   t   ievgrpt   igrpt   forceR'  R  R)  t   special_gidst   force_installed(    (   R   R   s!   /usr/share/yum-cli/yumcommands.pyR^     sJ   		
 	
				c         C   sN   |  j  | |  \ } } | d k r( t S| j d  sF | j d  rJ t St S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        R   R5   R   R   R   R   (   s   lists   infos   removes   summary(   R  RQ   R   R.   (   RT   R   R   R'   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	c         C   s,   |  j  | |  \ } } | d k r( t St S(   sd  Return whether a transaction set for removal only must be
        set up before this command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a remove-only transaction set is needed, False otherwise
        R   (   s   remove(   R  R.   RQ   (   RT   R   R   R'   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyR     s    	c         C   sN   |  j  | |  \ } } | d k r( d S| j d  sF | j d  rJ d Sd S(	   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        R   R5   R   s   read-only:pastR   R   R`   (   s   lists   infos   summary(   R  R   (   RT   R   R   R'   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (   Rb   Rc   Rd   R   RY   R[   R\   R   R  R]   R^   R_   R   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR     s"   

						C			t   MakeCacheCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sW   A class containing methods needed by the cli to execute the
    makecache command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t	   makecache(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   ,  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        Rr   (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   4  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Generate the metadata cache(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   ;  s    c         C   s   t  |  d S(   s$  Verify that conditions are met so that this command can
        run; namely that there is an enabled repository.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   B  s    c      	   C   s  | j  j t d   | j  j t d   t } | rQ | d d k rQ t } n  t rx2 | j j   D]! } d | _ | sg d | _ qg qg W| j	 d d  | j j
   | r | j j d d d	 d
  n | j j d d d	 d
  i d d 6d d 6d d 6d d 6} x | j j   D]{ } xr | j j   D]a } | | k rDq,n  | | j k s,| j | rgq,n  t j | j |  | | d | j q,WqWn  d t d  g f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s*   Making cache files for all metadata files.s=   This may take a while depending on the speed of this computeri    t   fasts	   group:allR   t   mdtypeR<   t	   cacheonlyi   R@   s
   groups.xmlt   group_gzs   pkgtags.sqlitet   pkgtagss   updateinfo.xmlR   s   prestodelta.xmlt   prestodeltat   cacheds   Metadata Cache Created(   R   RC   R   RQ   R.   R   t   sortt   metadata_expiret   mdpolicyR   t   doSetupt   populateSackR   t   repoXMLt	   fileTypest	   retrievedR   t   repo_gen_decompresst
   retrieveMDt   cache(   RT   R   R   R'   R?  R#   t	   fname_mapt   MD(    (    s!   /usr/share/yum-cli/yumcommands.pyR^   L  s:    		


c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	(	   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR=  '  s   				
	;t   CleanCommandc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   sS   A class containing methods needed by the cli to execute the
    clean command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   clean(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s<   [headers|packages|metadata|dbcache|plugins|expire-cache|all](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Remove cached data(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   t  | | |  t |  d S(   sy  Verify that conditions are met so that this command can run.
        These include that there is at least one enabled repository,
        and that this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   RB   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    	c         C   s   d | j  _ | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i   (   R   RP  t   cleanCli(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (
   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRS    s   						t   ProvidesCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sV   A class containing methods needed by the cli to execute the
    provides command.
    c         C   s
   d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   providest   whatprovides(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        t   SOME_STRING(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s*   Find what package provides the given value(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   t  | | |  d S(   s7  Verify that conditions are met so that this command can
        run; namely that this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R8   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    c         C   s*   | j  j d  t j |  | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Searching Packages: (   R   RC   R   R   RW  (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (	   Rb   Rc   Rd   RY   R[   R\   R]   R^   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRV    s   				
	t   CheckUpdateCommandc           B   sG   e  Z d  Z d   Z d   Z d   Z d   Z d d  Z d   Z	 RS(   sZ   A class containing methods needed by the cli to execute the
    check-update command.
    c         C   s   d d d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        s   check-updates   check-updatess   check-upgrades   check-upgrades(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   '  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [PACKAGE...](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   0  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s#   Check for available package updates(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   7  s    c         C   s   t  |  d S(   s.  Verify that conditions are met so that this command can
        run; namely that there is at least one enabled repository.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   >  s    c            sT  t  j    d g | }   j j d d  d } t rJ  j | d | }   j j so   j j	 t
 j  r   j | d | } | j | _ | j | _ n  t   |  }	 t | j  d k ri  }
   j j d } | r3xQ t | j  D]= } | j j d k r | j   r | |
 | j | j f <q q Wn    j j }   j j }   j | j d d d	 d
 |
 d |	 d i | d 6| d 6d } n  t | j  d k rt d  GHxB t | j d t j d  D]" }   j | d d |	 d | qWd } n    j j rJt  j    j! j"    rJ  f d   } t  j#     j$ |  qJn  | g  f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        Rp   i    R   R   R   R   Rr   t
   outputTypeR   R   R   R   R   s   not inid   s   Obsoleting PackagesR   c            s     j  j d |   d  S(   Ns   %s(   R4   R5   (   t   x(   R   (    s!   /usr/share/yum-cli/yumcommands.pyt   _msg~  s    (%   R   R   R'   t   insertR.   R   R   Rp   R4   t   isEnabledForR    t   DEBUG_3R   R   R&   R   R   R   R   R#   R3   R   Rw   Rx   R   R   R   R   R   R   R   t   autocheck_running_kernelt   _repos_downloadedR   R   t   _check_running_kernelt   upinfo(   RT   R   R   R'   R   t   obscmdst   resultR   t   typlR   R   R   R   R   R   R   R]  (    (   R   s!   /usr/share/yum-cli/yumcommands.pyR^   H  sJ     		c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:future(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    N(
   Rb   Rc   Rd   RY   R[   R\   R]   R   R^   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRZ  "  s   					
;t   SearchCommandc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   sT   A class containing methods needed by the cli to execute the
    search command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   search(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        RY  (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s+   Search package details for the given string(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   t  | | |  d S(   s7  Verify that conditions are met so that this command can
        run; namely that this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R8   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    c         C   s0   | j  j t d   t j |  | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Searching Packages: (   R   RC   R   R   R   Ri  (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:present(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (
   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRh    s   				
		t   UpgradeCommandc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sU   A class containing methods needed by the cli to execute the
    upgrade command.
    c         C   s
   d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        R   s
   upgrade-to(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s-   Update packages taking obsoletes into account(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s%   t  |  t |  t | |  d S(   ss  Verify that conditions are met so that this command can
         run.  These include that the program is being run by the root
         user, and that there are enabled repositories with gpg.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    	

c         C   sN   d | j  _ |  j | t d   | j | d | d k } t j |  | S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i   s   Setting up Upgrade ProcessRj   s
   upgrade-to(   R   Rp   RX   R   Rk   R   Rl   (   RT   R   R   R'   Rm   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s
    (   Rb   Rc   Rd   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRj    s   				t   LocalInstallCommandc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   sZ   A class containing methods needed by the cli to execute the
    localinstall command.
    c         C   s   t  j |   t |  _ d  S(   N(   RP   RU   R.   RS   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRU     s    c         C   s
   d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   localinstallt   localupdate(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY      s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        t   FILE(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   (  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Install a local RPM(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   /  s    c         C   s(   t  |  t |  t | | |  d S(   s  Verify that conditions are met so that this command can
        run.  These include that there are enabled repositories with
        gpg keys, and that this command is called with appropriate
        arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R(   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   6  s    


c         C   s8   |  j  | t d   | d k } | j d | d |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s    Setting up Local Package ProcessRm  t   filelistt
   updateonly(   RX   R   t   localInstall(   RT   R   R   R'   Rp  (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   D  s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   W  s    	(
   Rb   Rc   Rd   RU   RY   R[   R\   R]   R^   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRk    s   						t   ResolveDepCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sX   A class containing methods needed by the cli to execute the
    resolvedep command.
    c         C   s   t  j |   t |  _ d  S(   N(   RP   RU   R.   RS   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRU   g  s    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t
   resolvedep(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   k  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        t
   DEPENDENCY(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   s  s    c         C   s   d S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        sH   repoquery --pkgnarrow=all --whatprovides --qf '%{envra} %{ui_from_repo}'(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   z  s    c         C   s0   | j  j t d   t j |  | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s"   Searching Packages for Dependency:(   R   RC   R   R   R   t   resolveDepCli(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (	   Rb   Rc   Rd   RU   RY   R[   R\   R^   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRr  b  s   					t   ShellCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sS   A class containing methods needed by the cli to execute the
    shell command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   shell(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   [FILENAME](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Run an interactive yum shell(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   t  | | |  d S(   s7  Verify that conditions are met so that this command can
        run; namely that this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   RG   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    c         C   s    |  j  | t d   | j   S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Setting up Yum Shell(   RX   R   t   doShell(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	(	   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRv    s   				
	t   DepListCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sU   A class containing methods needed by the cli to execute the
    deplist command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   deplist(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   List a package's dependencies(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   t  | | |  d S(   s?  Verify that conditions are met so that this command can
        run; namely that this command is called with appropriate
        arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R(   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    	c         C   s0   |  j  | t d   t j |  | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Finding dependencies: (   RX   R   R   R   Rz  (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (	   Rb   Rc   Rd   RY   R[   R\   R]   R^   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRy    s   					t   RepoListCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sV   A class containing methods needed by the cli to execute the
    repolist command.
    c         C   s   d S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   repolistt   repoinfo(   R|  R}  (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   (  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [all|enabled|disabled](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   0  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s,   Display the configured software repositories(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   7  s    c   1         s    f d   }   f d   } d   } t  |  d k r` | d d> k r` | d } | d } n d } t d	   |  } | d
 k r t } n   j j t j  } | d k s | r@y   j j     j	 Wq@t
 j j k
 r<| r   n  xL   j j   D]7 }	 y   j j |	 j  Wq t
 j j k
 r4q Xq Wq@Xn    j j j   }
 |
 j     j j   }   j j d   j j d }   j j d }   j j d } d } g  } x|
 D]x}	 t  |  r| |	 |  rqn  d? \ } } } d } d } d } d } t } | d k s;|	 j | k s;|	 j | k rXt } | | | } } } n  |	 | k rt } | d k rt } n | d k r| rqn  | s| r| t d  | } t t d   } | s| d 7} | d 7} qn  | r| |	  } n  | d k s| r2| s,  j j s,|	 j rDt  |	 j j    } n t  |	 j  } | |  } |	 j j } t  g  | D] \ } } | |	 k ru| ^ qu } | r| |  } | s| d | 7} qn  | | 7} q2nZ t } | d k rt } n | d k r| rqn  | t d  | } t t d   } | s|	 j } |	 j d k rt j  j! |	 j"  rt j# |	 j"  j$ }  |  |	 j t% j%   k  rd | } qqn  | r|	 j& r|	 j' j( j) }! |! |	 j* j) k rd | } qn  | j+ | |	 j | | f | f  q| r|	 j* }" n d@ }"   j- t d  |	 j    j- t d  |	 j  g }# | se| r|#   j- t d  |  g 7}# n  |" r|" j. d@ k	 r|#   j- t d  |" j.  g 7}# n  |" r|" j/ d r|" j/ d }$ |#   j- t d  d j0 t1 |$    g 7}# n  |" r|" j/ d rxg t1 |" j/ d  D]O }% |" j/ d |% }$ |#   j- t d  d |% d j0 t1 |$   f  g 7}# q9Wn  |" r|#   j- t d  t% j2 |" j)     j- t d   |    j- t d!  |  g 7}# n  t3 |	 d"  r|	 j4 }& n	 |	 j5 }& |& rB|#   j- t d#  d j0 |&   g 7}# n  | rR|	 j6 n  |	 j& r|#   j- t d$  |	 j&  g 7}# | r|	 j' j( j) }' |#   j- t d%  t% j2 |'   g 7}# qn. |	 j7 r|#   j- t d&  |	 j7  g 7}# n  | rf|	 j6 rf|& rf|	 j6 d }( t  |	 j6  d k rD|( d' t  |	 j6  d 7}( n  |#   j- t d#  |(  g 7}# n  t j  j! |	 j"  st d(  }  n$ t j# |	 j"  j$ }  t% j2 |   }  |	 j d) k rt d*  |  } nA |	 j st d+  |  } n% | |	 j  } t d,  | |  f } |#   j- t d-  |    j- t d.  |	 j8  g 7}# |	 j r	|#   j- t d/  d j0 |	 j   g 7}# n  |	 j9 r	|#   j- t d0  d j0 |	 j9   g 7}# n  | r	|#   j- t d1  |  g 7}# n  |	 j: r
|#   j- t d2  |	 j:  g 7}# n    j j; d3 d4 j0 t t< j= |#    qW| r| rt t d5   }) d }* d }+ d }, x | D] \ } }- \ } } } |) t |  k  r
t |  }) n  |* t |-  k  r
t |-  }* n  |+ | t  |  k  r
| t  |  }+ n  |, t  |  k  rp
t  |  }, qp
qp
W| d k r;  j j> |) d }. nW t t d6   |+ k rz  j j> |) t t d6   d }. n   j j> |) |+ d }. |. |* k  r|. }* n* |. |* 8}. |) |. d 7}) |* |. |. d 7}* t? t d5  |)  }/ t? t d7  |* |*  }0 | d k r#  j j; d8 |/ |0  n   j j; d9 |/ |0 t d6   x | D] \ } }- \ } } } | d k r  j j; d8 t? | |)  t? |- |* |*   qIn  | rt? | |, d: t } n    j j; d; t? | |)  t? |- |* |*  | |  qIWn  d d< t= t@ jA d= | t   g f S(A   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        c            s:   d } x$ |  j  j   D] } | | j 7} q W  j |  S(   Ni    (   t   sackR*  t   packagesizet   format_number(   R#   Rm   R   (   R   (    s!   /usr/share/yum-cli/yumcommands.pyt
   _repo_sizeL  s    c            s=   x6 | D]. } |    j  j | d t d t k r t Sq Wt S(   NR+   R,   (   R   R-   R.   RQ   (   R#   R  t   pat(   R   (    s!   /usr/share/yum-cli/yumcommands.pyt   _repo_matchR  s
    c         S   s   t  t j d |  t   S(   Ns   %d(   R   t   localet   formatR.   (   t   num(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _num2ui_numY  s    i   i    R@   t   disabledt   enabledc         S   s
   |  j    S(   N(   t   lower(   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   <lambda>a  s    R}  t   greenR   t   redt   normalRr   s   : i   s   +%st   !t   *s   Repo-id      : s   Repo-name    : s   Repo-status  : s   Repo-revision: t   contents   Repo-tags    : s   , t   distros   Repo-distro-tags: s   [%s]: %ss   Repo-updated : s   Repo-pkgs    : s   Repo-size    : t   _orig_baseurls   Repo-baseurl : s   Repo-metalink: s     Updated    : s   Repo-mirrors : s
    (%d more)t   Unknownis   Never (last: %s)s   Instant (last: %s)s   %s second(s) (last: %s)s   Repo-expire  : s     Filter     : s   Repo-exclude : s   Repo-include : s   Repo-excluded: s   Repo-filename: s   %s
s   
s   repo idt   statuss	   repo names   %s %ss   %s %s %st   lefts
   %s %s %s%ss
   repolist: s   %d(   s   allR  s   enabled(   Rr   Rr   Rr   N(B   R&   t   mapR.   R4   R_  R    R`  R   RJ  RL   RI   R   t	   RepoErrorR   R3   t   valuesRF  R   t   FG_COLORR   RQ   Rw   R   R   R   t   excludeR~  R/  t	   _excludesR1   RG  RD   RE   RK   t   metadata_cookiet   statt   st_mtimet   timet   metalinkt   metalink_datat   repomdt	   timestampRK  R   R   t   fmtKeyValFillt   revisiont   tagsR0   R   t   ctimet   hasattrR  t   baseurlt   urlst
   mirrorlistt   metadata_expire_filtert   includepkgst   repofileR5   R   R   R   R   R  R  (1   RT   R   R   R'   R  R  R  t   argt   verboseR#   R   t   enabled_repost	   on_ehibegt	   on_dhibegt   on_hiendt   tot_numt   colst   ehibegt   dhibegt   hiendt
   ui_enabledt   ui_endis_widt   ui_numt   ui_excludes_numt
   force_showR  t   ui_sizeR  t   excludesR6   t   pidRv   t   lastt   mdtst   mdt   outR  R  t   baseurlst   tst   urlt   id_lent   nm_lent   st_lent   ui_lent   rnameR  t   txt_ridt   txt_rnam(    (   R   s!   /usr/share/yum-cli/yumcommands.pyR^   >  s   	"
	
*	
1		'	
		"				 '	
	
c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   X	  s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa   c	  s    (	   Rb   Rc   Rd   RY   R[   R\   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR{  #  s   				 	t   HelpCommandc           B   sS   e  Z d  Z d   Z d   Z d   Z d   Z e d    Z d   Z	 d   Z
 RS(   sR   A class containing methods needed by the cli to execute the
    help command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        R   (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   t	  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        t   COMMAND(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   |	  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Display a helpful usage message(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   	  s    c         C   sg   t  |  d k r( | j   t j  n; t  |  d k sM | d | j k rc | j   t j  n  d S(   s?  Verify that conditions are met so that this command can
        run; namely that this command is called with appropriate
        arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        i    i   N(   R&   R   R   R   R   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   	  s    	
%
c         C   sX  |  j    d } y |  j   } Wn t t f k
 r? d  } n Xy |  j   } Wn t t f k
 ro d  } n Xd } | d  k	 r | d | | f 7} n  | d  k	 r | d | 7} n  | d  k r | d  k r t d  | } n  |  j    } t |  d k rTt |  d k r$| t d  7} n | t d	  7} | d
 j |  j    d  7} n  | S(   Ni    Rr   s   %s %ss   

%ss   No help available for %si   i   s   

aliases: s	   

alias: s   , (	   RY   R[   t   AttributeErrorRZ   R   R\   R   R&   R0   (   t   commandt   canonical_nameR   R   t   help_outputt   command_names(    (    s!   /usr/share/yum-cli/yumcommands.pyR   	  s.    

 c         C   sJ   | d | j  k r@ | j  | d } | j j |  j |   n  d g  f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i    (   R   R4   R5   R   (   RT   R   R   R'   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   	  s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   	  s    	(   Rb   Rc   Rd   RY   R[   R\   R]   t   staticmethodR   R^   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  n	  s   				$	t   ReInstallCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sW   A class containing methods needed by the cli to execute the
    reinstall command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t	   reinstall(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   	  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   	  s    c         C   s5   t  |  t |  t | | |  t | |  d S(   s  Verify that conditions are met so that this command can
        run.  These include that the program is being run by the root
        user, that there are enabled repositories with gpg keys, and
        that this command is called with appropriate arguments.


        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R(   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   	  s    

c         C   s#   |  j  | t d   | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Setting up Reinstall Process(   RX   R   t   reinstallPkgs(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^    
  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   reinstall a package(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   
  s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   
  s    	(	   Rb   Rc   Rd   RY   R[   R]   R^   R\   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  	  s   					t   DowngradeCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sW   A class containing methods needed by the cli to execute the
    downgrade command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t	   downgrade(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   (
  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s
   PACKAGE...(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   0
  s    c         C   s5   t  |  t |  t | | |  t | |  d S(   s  Verify that conditions are met so that this command can
        run.  These include that the program is being run by the root
        user, that there are enabled repositories with gpg keys, and
        that this command is called with appropriate arguments.


        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R(   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   7
  s    

c         C   s#   |  j  | t d   | j |  S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   Setting up Downgrade Process(   RX   R   t   downgradePkgs(   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   G
  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   downgrade a package(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   X
  s    c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   _
  s    	(	   Rb   Rc   Rd   RY   R[   R]   R^   R\   R_   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  #
  s   					t   VersionCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sU   A class containing methods needed by the cli to execute the
    version command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        Ry   (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   p
  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [all|installed|available](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   x
  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s9   Display a version for the machine and/or available repos.(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   
  s    c         C   s!  d } | r | d } n  | d. k r2 | d } n d } d   } | j  j t j  } i  } | d/ k r g  } | d k r d } q | t d  } n t j j   } xI | D]A }	 t | |	 j	  | |	 <| |	 j
 r | |	 j | j  q q W| d k r5t d  GHx t |  D] }	 d G|	 GHqWd d g f S| d k rJx | D] }	 |	 | k r`qHn  t d  G|	 GHt d  GH| sx t | |	  D] }
 d G|
 GHqWqHi i  d 6i  d 6} | |	 } | j |  } | j | | |  | d | d g } | j |  } | d | d f } | j | t | d | qHWd d g f S| j d  rt| rtx| D]} d | k rd | k rt   | d <n  | d j |  qgt j j |  s| j j t d  |  qgt |  j   } t d   | D  } t j j |  } | | k rcxC t d d  D]/ } | t |  } | | k rUq-n  | } Pq-Wn  | | | <qgWn  | j  j! d  } | j  j! d! } g  } | d0 k rt r| j" j# | d" | } | j$ j%   } | d1 k	 r| j' } n  | d1 k	 r!| d | k r!| j( d# | d1 k	  n  | d2 k rq| j) d$ t d%  | | f t | d  f  | | | d  n  | rx t | d&  D]s } | j d  r| r| | k rqn  | j) d' t d(  | f t | d& |  f  | | | d) |  qWqqn  | d3 k r,t r,| j* j# | d" | } | d4 k r| j) d$ t d*  | | f t | d  f  | r| | | d  qn  | r)x t | d&  D]| } | j d  r| r| | k rqn  | j) d' t d+  | f t | d& |  f  | r| | | d) |  qqWq)q,n  i i  d 6i  d, 6} xq | D]i \ } } xZ d t |  f d, t |  f f D]4 \ } } | | j+ | d  | | | c d 7<qxWqGW| d | d, g } | j |  } | d | d f } x% | D] } | j, t- | |   GHqWd d- g f S(5   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        R   i    R   R   t   nogroupss   nogroups-installeds   nogroups-availables   nogroups-allR@   s   group-installeds	   group-allR   s   group-availablei   c         S   s   x t  |  D] } | | } g  } d  } xW t  |  D]I } | d  k rN q6 n  | | } | j d | | f t | |  f  q6 Wd  | k r | s | d  | k r |  j d | t | d   f  n  |  j |  q Wd  S(   Ns	       %s/%ss       %s(   R   R   R   t   strt   extend(   R  t	   repo_dataR   R   t   ncolst   last_revt   rev(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _append_repos
  s    

+#$s	   nogroups-s    Yum version groups:s      s   version grouplists
    Group   :s
    Packages:t   envraRv   R   s   version groupinfos   group-t   /s
   <cmd line>s    File doesn't exist: %sc         s   s   |  ] } | j    Vq d  S(   N(   t   strip(   t   .0t   n(    (    s!   /usr/share/yum-cli/yumcommands.pys	   <genexpr>
  s    id   t
   releasevert   basearchR   t   warns   %s %s/%ss
   Installed:i   s   %s %ss   Group-Installed:i   s
   Available:s   Group-Available:Ru   Ry   (   s	   grouplists	   groupinfoR  s   nogroups-installeds   nogroups-availables   nogroups-alls	   installeds   alls   group-installeds	   group-alls	   availables   alls   group-availables	   group-all(   R  s   nogroups-installeds   nogroups-availables   nogroups-all(   s	   installeds   alls   group-installeds	   group-allN(   s   group-installeds	   group-all(   s	   availables   alls   group-availables	   group-all(   s   group-availables	   group-all(.   R4   R_  R    R`  R&   RI   t   configt   readVersionGroupsConfigR   t   pkglistt   run_with_packagesRi   t   run_with_package_namesR   R   t   _group_names2aipkgst   _calcDataPkgColumnsR   t   _displayPkgsFromNamesR.   R   R!  RD   RE   RK   R   R  t   opent	   readlinest   basenamet   rangeR  R   t   yumvarR?   t   simpleVersiont   historyR  R   t   end_rpmdbversiont   _rpmdb_warn_checksR   RL   R}   t
   fmtColumnst   zip(   RT   R   R   R'   t   vcmdR  R  R   t   gconfR   t   pkgnameR~   R  t   pkg_names2pkgsR   t   dgrpR  t   ndgrpt   relt   baR  t   lastdbvR  Rv   Ru   R   R   t   line(    (    s!   /usr/share/yum-cli/yumcommands.pyR^   
  s       				
"%1c         C   sN   d } | r | d } n  | j  j t j  } | d k rD | rD t S| d k S(	   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        R   i    R   R   R@   s   group-availables	   group-all(   s	   availables   alls   group-availables	   group-all(   R4   R_  R    R`  R.   (   RT   R   R   R'   R  R  (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   ,  s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:present(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa   =  s    (	   Rb   Rc   Rd   RY   R[   R\   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  k
  s   					t   HistoryCommandc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z RS(   sU   A class containing methods needed by the cli to execute the
    history command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        R  (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   M  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        sC   [info|list|packages-list|summary|addon-info|redo|undo|rollback|new](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   U  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s(   Display, or use, the transaction history(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   \  s    c   
      C   sY  i t  d 6t  d 6} i d d 6d d 6d d 6d d 6} x t |  d k r t  } x\ | d j d d	  j d	  D]; } | | k r qq n  t } | | d } | | | | <qq W| s Pn  | d
 g | d } q9 W| j |  } | d  k r d d g f St j | j	  }	 d | j
 |	 f GH| j |  | j | |  rUd d | j
 f g f Sd  S(   Nt   force_reinstallt   force_changed_removalR  s   force-reinstallR   s   force-removei   R   R  i    i   s   Failed history redos!   Repeating transaction %u, from %ss   Repeating transaction %u(   RQ   R&   t   replacet   splitR.   t   _history_get_transactionR   R  R  t   beg_timestampt   tidt   historyInfoCmdPkgsAlteredt   history_redo(
   RT   R   R'   t   kwargst
   kwargs_mapt   doneR  R   t   oldt   tm(    (    s!   /usr/share/yum-cli/yumcommands.pyt
   _hcmd_redoc  s2    



&c         C   s   | j  |  } | d  k r( d d g f St j | j  } d | j | f GH| j |  | j |  r d d | j f g f Sd  S(   Ni   s   Failed history undos   Undoing transaction %u, from %si   s   Undoing transaction %u(   R  R   R  R  R  R  R  t   history_undo(   RT   R   R'   R  R  (    (    s!   /usr/share/yum-cli/yumcommands.pyt
   _hcmd_undo  s    c   
      C   s  t  } t |  d k rE | d d k rE t } | } | j d  n  | j |  } | d  k rm d d g f S| j j   } | d  k r d d g f S| j | j k r d d g f Sd  } x | j j	 t
 | j d | j d   D] } | r9| j s| j r9| j rd } n d } | | j GHd	 GHd d
 g f S| d  k rZt j j |  } q | j |  q Wt j | j  }	 d | j |	 f GH| j d d j d   | j D   GH| j |  | j |  rd d | j f g f Sd  S(   Ni   R:  i    s'   Failed history rollback, no transactions!   Failed history rollback, no last?s"   Rollback to current, nothing to dos-   Transaction history is incomplete, before %u.s,   Transaction history is incomplete, after %u.s5    You can use 'history rollback force', to try anyway.s#   Failed history rollback, incompletes#   Rollback to transaction %u, from %ss&     Undoing the following transactions: s   , c         s   s   |  ] } t  |  Vq d  S(   N(   R  (   R  R\  (    (    s!   /usr/share/yum-cli/yumcommands.pys	   <genexpr>  s    i   s   Rollback to transaction %u(   RQ   R&   R.   t   popR  R   R  R  R  R  R  t   altered_lt_rpmdbt   altered_gt_rpmdbRI   t   YumMergedHistoryTransactiont   mergeR  R  R  R  R0   R  R  (
   RT   R   R'   R:  R  R  t   mobjR  R$   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _hcmd_rollback  s@    "0			c         C   s   | j  j   d  S(   N(   R  t   _create_db_file(   RT   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyt	   _hcmd_new  s    c         C   s  d G| j  j GHt j | j  j  j } d Gt j d | t  GH| j  j   } | d  k rm t
 d  Gd GHd  S| j  j   } | j  j d  d } t
 d  G| j GHt
 d  Gt j | j  GHt
 d  Gt j | j  GHt
 d	  GHt
 d
  Gt j d | d t  GHt
 d  Gt j d | d t  GHt
 d  Gt j d | d t  GHt
 d  Gt j d | d t  GHt
 d  Gt j d | d t  GHt
 d  Gt j d | d t  GHd  S(   Ns   File        :s   Size        :s   %ds   Transactions:i    t   1s   Begin time  :s   End time    :s   Counts      :s
     NEVRAC :s   %6dt   nevracs
     NEVRA  :t   nevras
     NA     :Rt   s
     NEVR   :t   nevrs
     rpm DB :R?   s
     yum DB :t   yumdb(   R  t   _db_fileRD   R  t   st_sizeR  R  R.   R  R   R   t
   _pkg_statsR  R  R  R  R  t   end_timestamp(   RT   R   R'   R  t   trans_Nt   countst   trans_1(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _hcmd_stats  s&    """""c         C   s   | d } | s d  } n  xr t | j j d |   D]U } | j j | d t d  k r_ q5 n  d G| Gd G| j j |  r d GHq5 d GHq5 Wd  S(   Ni   R  t   creates   Syncing rpm/yum DB data for:s   ...s   Done.s   FAILED.(   R   R   R?   R*  R  t   pkg2pidRQ   t
   sync_alldb(   RT   R   R'   t   ipkg(    (    s!   /usr/share/yum-cli/yumcommands.pyt
   _hcmd_sync  s    
	"c         C   s   d } | rJ | d | k rJ | j  j t d  d j |   t j  n  | rw | d d  k rw t |  t |  nI | j j	 o t
 j | j j	 t
 j  s | j  j t d   t j  n  d S(!   sZ  Verify that conditions are met so that this command can
        run.  The exact conditions checked will vary depending on the
        subcommand that is being called.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        R   R5   R   t   repeatt   redot   undot   newt   rollbackt   addons
   addon-infot   statst
   statisticst   synct   synchronizepkgR   s   pkg-lists	   pkgs-listt   packages   package-listR;   s   packages-lists   pkg-infos	   pkgs-infos   package-infos   packages-infoi    s%   Invalid history sub-command, use: %s.s   , s(   You don't have access to the history DB.N(   s   lists   infos   summarys   repeatR;  R<  s   newR>  R?  s
   addon-infoR@  RA  RB  RC  s   pkgss   pkg-lists	   pkgs-listRD  s   package-lists   packagess   packages-lists   pkg-infos	   pkgs-infos   package-infos   packages-info(   s   repeatR;  R<  R>  s   new(   R   R   R   R0   R   R   R   R%   R  R-  RD   R	  R
  (   RT   R   R   R'   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s"    	      
'c      	   C   s  d } | r | d } n  t  r" nz| d k r@ | j |  } n\| d k r^ | j |  } n>| d k r| | j |  } n | d k r | j |  } n| d k r | j |  } n | d k r |  j | |  } n | d k r |  j | |  } n | d k r|  j | |  } n | d k r<|  j	 | |  } n` | d  k r]|  j
 | |  } n? | d! k r~|  j | |  } n | d" k r| j |  } n  | d# k rd d | f g f S| S($   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        R   i    R5   R   R?  s
   addon-infoR   R   s   pkg-lists	   pkgs-listRD  s   package-listR;   s   packages-listR<  R;  R:  R>  R=  R@  RA  RB  t   synchronizes   pkg-infos	   pkgs-infos   package-infos   packages-infos
   history %s(   s   addons
   addon-info(   s   pkgs   pkgss   pkg-lists	   pkgs-lists   packages   package-lists   packagess   packages-list(   s   redos   repeat(   s   statss
   statistics(   s   syncRE  (   s   pkg-infos	   pkgs-infos   package-infos   packages-infoN(   RQ   t   historyListCmdt   historyInfoCmdt   historySummaryCmdt   historyAddonInfoCmdt   historyPackageListCmdR  R  R%  R'  R4  R9  t   historyPackageInfoCmdR   (   RT   R   R   R'   R  Rm   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     sB     	c         C   s#   d } | r | d } n  | d k S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        R   i    R:  R;  R<  R>  (   s   repeats   redos   undos   rollback(    (   RT   R   R   R'   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   '  s    	c         C   s-   d } | r | d } n  | d	 k r) d Sd S(
   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        R   i    R:  R;  R<  R>  R`   s   read-only:past(   s   repeats   redos   undos   rollback(    (   RT   R   R   R'   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyRa   5  s    (   Rb   Rc   Rd   RY   R[   R\   R  R  R%  R'  R4  R9  R]   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  H  s   				 	
	(					1	t   CheckRpmdbCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sY   A class containing methods needed by the cli to execute the
    check-rpmdb command.
    c         C   s
   d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   checks   check-rpmdb(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   J  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s   [dependencies|duplicates|all](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   R  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s   Check for problems in the rpmdb(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   Y  s    c      	   C   sk   d } | r | } n  d   } d } | j  d | d t d | d d    rT d	 } n  | d
 | | f g f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        R@   c         S   s   t  |  j    GHd  S(   N(   R   t   __str__(   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _outr  s    i    R  R  t   chkcmdt   headerc         S   s   d  S(   N(   R   (   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyR  w  s    i   s   %s %s(   R   RQ   (   RT   R   R   R'   RP  RO  t   rc(    (    s!   /usr/share/yum-cli/yumcommands.pyR^   `  s    			c         C   s   t  S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        (   RQ   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   {  s    	c         C   s   d S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        s   read-only:past(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    (	   Rb   Rc   Rd   RY   R[   R\   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRL  E  s   					t   LoadTransactionCommandc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s^   A class containing methods needed by the cli to execute the
    load-transaction command.
    c         C   s   d d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        s   load-transactions   load-tss   ts-load(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        R  (    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s&   load a saved transaction from filename(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c            s    f d   } d   } | s0 t  j   g } n  | d } t j j |  rI|  j   t d  |  t t j d |   } d } t
 }	 x| D]}
   j |
  } | d d k	 r q n  | d } | d j   } | d k rt   j j d t  d  } n  | | k r t d  } n d	 } yD t | d
 j    } d | } t | | j    } | d 7} Wn
 q n Xi d d 6d d 6} x+ | | D] } | j   } | | |  qWd	 } x7 | | D]+ } | j   } | |  rqn  d } PqWd | | f } |	 st d  } t |  } | d k  r<d } n  t | |  } t d  } t |  } | d k  rxd } n  t | |  } d G| Gd G| Gd Gt d  GHt }	 n  t j d | d t  } d | | f } t j d | d t  } d | | f } d | | | t j j |
  f GHq Wd t d  | t |  f g f S|  j   t d  |    j |  d
 t d  | t   j j    f g f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        c            s   |  j  d  s t Sy |  j d  d j   j d  \ } } t | j    } t | j   j d   } | t j k r   j |  } n% | t j	 k r   j
 |  } n t SWn t SXt S(   Ns   mbr:t   :i   R   R  (   R   R.   R  R  t   intt   tupleRI   t
   TS_INSTALLt   getInstalledPackageObjectt   TS_AVAILABLEt   getPackageObjectRQ   (   t   lt   pkgtupt   current_stateR   (   R   (    s!   /usr/share/yum-cli/yumcommands.pyt
   _pkg_avail  s    (c         S   se   |  j  d  s d  S|  t d  } | d
 k rB | d c d 7<n | d k ra | d	 c d 7<n  d  S(   Ns     ts_state: R   t   odt   udR   i   t   iR   Rf   (   R   R_  R`  (   Ra  R   (   R   R&   (   R[  R2  t   state(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _pkg_counts  s    i    s!   showing transaction files from %ss
   %s/*.yumtxi   t	   main_onlyt   yR   i   i   Rf   R   R  s   %s%st   Installi   t   Removes   ?? |t   |t   Filenames   %ds   %*ss   %s | %s | %s | %ss.   Saved transactions from %s; looked at %u filess   loading transaction from %ss*   Transaction loaded from %s with %s membersN(   t   tempfilet
   gettempdirRD   RE   t   isdirRX   R   R   t   globR   RQ   t   _load_ts_dataR  R  R?   R  R.   RU  t   rstripR   R   R  R  R  R&   t   load_tst   tsInfot
   getMembers(   RT   R   R   R'   R^  Rc  t	   load_filet   yumtxst   currpmvR  t   yumtxR~   t   rpmvt   currentt   numrepost   pkgstartt   numpkgsR2  R[  t   badt	   pkgititlet   pkgilent	   pkgetitlet   pkgelent   numipkgst   numepkgs(    (   R   s!   /usr/share/yum-cli/yumcommands.pyR^     s    		

"
			c         C   s%   | s t  j j | d  r! t St S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        i    (   RD   RE   Rl  RQ   R.   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_   '  s    	c         C   s%   | s t  j j | d  r! d Sd S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        i    s   read-only:pastR`   (   RD   RE   Rl  (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa   5  s    (	   Rb   Rc   Rd   RY   R[   R\   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyRS    s   				{	t   SwapCommandc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sR   A class containing methods needed by the cli to execute the
    swap command.
    c         C   s   d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        t   swap(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   H  s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        s7   [remove|cmd] <pkg|arg(s)> [-- install|cmd] <pkg|arg(s)>(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   P  s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        s3   Simple way to swap packages, instead of using shell(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   W  s    c         C   s5   t  |  t |  t | | |  t | |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R*   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   ^  s    


c         C   si  d | k r6 | j  d  } | |  } | | d } n | d  } | d } | oS | sc d d g f S| d | j k r d g | } n  | d | j k r d g | } n  | j } | j } xy | | f D]k }	 d j |	  | _ |	 | _ | j   | j   }
 |
 d d k r |
 d d	 | d j |	  f g f Sq W| | _ | | _ d d	 | d j |  f g f S(
   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        s   --i   R  i    R   Rf   R   i   s   %s %s(   t   indexR   R  t	   cmdstringR0   t   parseCommandst
   doCommands(   RT   R   R   R'   t   offt   rextcmdst   iextcmdst   ocmdst   olineR  t   cmdret(    (    s!   /usr/share/yum-cli/yumcommands.pyR^   m  s0    


			
(		(   Rb   Rc   Rd   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  C  s   				t   RepoPkgsCommandc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   sR   A class containing methods needed by the cli to execute the
    repo command.
    c         C   s   d d d d g S(   s   Return a list containing the names of this command.  This
        command can be called from the command line by using any of these names.

        :return: a list containing the names of this command
        s	   repo-pkgss   repo-packagess   repository-pkgss   repository-packages(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   sb   Return a usage string for this command.

        :return: a usage string for this command
        sK   <repoid> <list|info|install|remove|upgrade|reinstall*|remove-or-*> [pkg(s)](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   sh   Return a one line summary of this command.

        :return: a one line summary of this command
        sJ   Treat a repo. as a group of packages, so we can install/remove all of them(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s5   t  |  t |  t | | |  t | |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   R7   RO   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    


c         C   s  d   } | d } | d } | d } t  } | sE t } d g } n  d }	 i d d 6d d	 6d
 d 6d
 d 6d
 d 6d
 d 6d
 d 6d d 6d d 6d d 6d d 6d d 6}
 |
 j | |  } t  r n| d k r t   j | | | d | S| d k rt   j | | | d | S| d k r8t   j | | | d | S| d k rxC | D]; } | j d | d |  } | | |  |	 t |  7}	 qKW|	 rd t	 d d |	  f Sn| d k r'xC | D]; } | j
 d | d |  } | | |  |	 t |  7}	 qW|	 rt j |  d t	 d d  |	  f Sns| d k rxI | D]A } | j
 d | d! t d |  } | | |  |	 t |  7}	 q:W|	 rt j |  d t	 d d  |	  f Sn| d6 k rL| r| j j   } n  xI | D]A } | j d | d | d$ |  } | | |  |	 t |  7}	 qW| r-| | _ n  |	 rd t	 d% d& |	  f SnN| d7 k r| rp| j j   } n  xC | D]; } | j d | d$ |  } | | |  |	 t |  7}	 qwW| r| | _ n  |	 rd t	 d* d+ |	  f Sn| d, k r#| r| j j   } n  xj | D]b } y" | j d | d | d$ |  } Wn t j j k
 rVqn X| | |  |	 t |  7}	 qW| r| j   | _ n  |	 rd t	 d% d& |	  f SxC | D]; } | j d | d$ |  } | | |  |	 t |  7}	 qW| r| | _ n  |	 rd t	 d* d+ |	  f Snw| d k rxC | D]; } | j d | d |  } | | |  |	 t |  7}	 q6W|	 rd t	 d- d. |	  f Sn| d k rox | D] } | j d | d |  } xg | D]^ } | j j | j  } x@ t |  D]2 } | j | k rqn  | | j d/ |  7} PqWqW| | |  |	 t |  7}	 qW|	 rd t	 d0 d1 |	  f Sn+| d
 k rx| D]} | j d | d |  } x| D]} | j j | j g  } d8 } x[ t |  D]M } | j | k rqn  | r| j | d  r| j |  q| g } qW| rx0 | D]( } | j | j k rUq7n  | g } Pq7Wt |  d k r| j |  } qn  x | D] } | j \ } } } } } | j | j   r| | j d/ |  7} q| j! | j   r| | j
 d/ |  7} q| j" j | j  | j |  | | j# d/ |  7} qWqW| | |  |	 t |  7}	 qW|	 rd t	 d2 d3 |	  f Sn d t$ d4  | g f Sd t$ d5  g f S(9   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        c         S   s   x |  D] } | | _  q Wd  S(   N(   t   repopkg(   t   txmbrsR   t   txmbr(    (    s!   /usr/share/yum-cli/yumcommands.pyt   _add_repopkg2txmbrs  s    i    i   i   R  R   R   s   remove-or-reinstalls   erase-or-reinstalls   remove-or-syncs   erase-or-syncs   erase-or-distro-syncs   remove-or-distro-syncs%   erase-or-distribution-synchronizations&   remove-or-distribution-synchronizationRi   R   s	   update-tos
   upgrade-tos   check-updates   check-upgrades   check-upgradess   check-updatesR   R   R5   Rf   t   patterns   %d package to installs   %d packages to installs   %d package to updates   %d packages to updateRj   s   reinstall-olds   reinstall-installedt   repoid_installs   %d package to reinstalls   %d packages to reinstalls   reinstall-news   reinstall-availables   move-tos   %d package to move tos   %d packages to move toR  s   %d package to removes   %d packages to removeR   s   %d package to remove/reinstalls   %d packages to remove/reinstalls   %d package to remove/syncs   %d packages to remove/syncs   Not a valid sub-command of %ss   Nothing to do(   s   reinstall-olds   reinstall-installed(   s   reinstall-news   reinstall-availables   move-toN(%   RQ   R.   R  R   R^   R   RZ  Rf   R&   R   Ri   R   Rl   t   _not_found_at   copyR  RI   R   t   ReinstallRemoveErrorR   RL   t   searchPkgTupleR\  R   R   R  Rw   R   t   verEQR   Rx   t   bestPackagesFromListR   R   Rq  R  R   (   RT   R   R   R'   R  R   R   RW   t   noargsR  R  R  R  t   onot_found_aR  R   R   t   apkgst   toinstR  t   aR   R   R6   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^     sJ   	




 								c         C   sO   d } t  |  d k r% | d } n  | d k rK t   j | | | d  St S(   sG  Return whether a transaction set must be set up before this
        command can run.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: True if a transaction set is needed, False otherwise
        Rf   i   R5   R   i   (   s   infos   list(   R&   R   R_   R.   (   RT   R   R   R'   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyR_     s    	c         C   su   d } t  |  d k r% | d } n  | d k rK t   j | | | d  S| d k rq t   j | | | d  Sd
 S(   sA  Return the cache requirements for the remote repos.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: a list of arguments passed to *basecmd*
        :return: Type of requirement: read-only:past, read-only:present, read-only:future, write
        Rf   i   R5   R   i   s   check-updates   check-upgrades   check-updatess   check-upgradesR`   (   s   infos   list(   s   check-updates   check-upgrades   check-updatess   check-upgrades(   R&   R   Ra   RZ  (   RT   R   R   R'   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyRa     s    	(
   Rb   Rc   Rd   RY   R[   R\   R]   R^   R_   Ra   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR    s   							t   UpdateinfoCommandc           B   s#  e  Z i d  d 6d  d 6d  d 6d d 6d d 6d d 6d d	 6Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 i d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z x e j D] Z e e e <q Wd   Z d    Z d!   Z d"   Z RS(#   R   s   list-updateinfos   list-securitys   list-secR5   s   info-updateinfos   info-securitys   info-secR   s   summary-updateinfoc         C   s   d g t  |  j j    S(   NR   (   R   t   direct_cmdsR   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   NsB   [info|list|...] [security|...] [installed|available|all] [pkgs|id](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s   d S(   Ns%   Acts on repository update information(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   s   d  S(   N(    (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s    c         C   s]  d } d }	 d }
 x | D] \ } } } t  t | d  |  } | d } | d k rr | d rr | d d } n  t  t |  |
  }
 | r xS t j | d  D]; } | d | k r q n  t  t t | d   |	  }	 q Wq q Wxo| D]g\ } } } d	 } | d
 k rQd } | d | k rQt j | | d |  d k rQd } qQn  | d } | d k r| d r| d d } n  | rt j | |  rx t j | d  D]F } | d | k rqn  | d | |	 t | d  |
 | | f  qWq t | d  r1| j d | j	 | j
 | j   GHq | d | | | d |
 | | f  q Wd  S(   Ni    t	   update_idt   typet   securityt   severitys   /Sec.t
   referencesR3   Rr   R@   s     s   i s   %s %-*s %-*s %sRw   s   %s: s   %s%-*s %-*s %s(   t   maxR&   t   _upit   _ysp_safe_refsR  t   _rpm_tup_vercmpt   _ysp_has_info_mdR  R  Rw   t   _encR   (   RT   R   t   md_infot	   list_typet	   show_typet	   iname2tupR~   R$   t	   n_maxsizet	   r_maxsizet	   t_maxsizet   noticeR\  R   t   tnt   refR   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   list_show_pkgs  sD    
*0
c         C   s  i  } x | D] \ }	 }
 } |	 d | k r2 q n  |	 | |	 d <t  |	 d  r t j j } | j } | j |  r |	 j d g   } q |	 j   } n |	 j   } | d k r |
 d | k r t j	 | |
 d |
  d k r | d } q | d } n  | |  q Wd  S(   NR  t   textt	   skip_dataR@   i    s   
  Installed : trues   
  Installed : false(
   R  RI   R    R`  R4   R_  R  RN  R  R  (   RT   R   R  R  R  R  R~   R$   t   show_pkg_info_doneR  R\  R   t   debug_log_lvlt   vlogt   obj(    (    s!   /usr/share/yum-cli/yumcommands.pyt   info_show_pkgs  s"    	0c      
      s    f d   } i  }	 i  }
 i  } x | D] \ } } } | d | k rM q( n  | | | d <|	 j  | d d  d |	 | d <| d d k r( | d } | d  k r d } n  |
 j  | d  d |
 | <q( q( Wd } xK d D]C } | |	 k r q n  t t |	 |   } | | k  r | } q q W| sM  j j rIt j   | |  n  d  Si d d	 6d d 6d d
 6d d 6} d G| GHx d D] } | |	 k rqn  | | } | d k rt |
  d k r|
 j   d } | d k r| d | } qn  d | |	 | | f GH| d k rt |
  d k rd   } xF t	 |
 d | D]/ } | |
 | | pXd | d f } d | GHq?WqqW  j j rt j   | |  n  i  |  _
 d  S(   Nc            s     j  j d |   d  S(   Ns   %s(   R4   R5   (   R\  (   R   (    s!   /usr/share/yum-cli/yumcommands.pyR]  1  s    R  R  i    i   R  R  Rr   t
   newpackaget   bugfixt   enhancements   New Packaget   Securityt   Bugfixt   Enhancements   Updates Information Summary:R   s       %*u %s notice(s)c         S   s,   i d d 6d d 6d d 6d d 6j  |  |   S(	   Nt   zz1t   Criticalt   zz2t	   Importantt   zz3t   Moderatet   zz4t   Low(   R  (   R   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _sev_sort_key\  s
    

R   t   ?s           %*u %s %s notice(s)(   R  s   securityR  R  (   R  s   securityR  R  (   R  R   R&   R  R   Ra  R  Rc  R   R   R  (   RT   R   R  R  R  R  R~   R$   R]  R2  t
   sev_countsR  R  R\  R   t   sevt   maxsizet   Tt   sizet   outTR  t   snR  RW   (    (   R   s!   /usr/share/yum-cli/yumcommands.pyt   summary_show_pkgs/  s^    "
	!

	
		 c      
   c   s   x | j  D] } | d d k r& q
 n  xa | d D]U } xL | d D]@ } | d | d | d pc d | d	 | d
 f } | | f VqB Wq1 Wq
 Wd  S(   NR  R  R  R;   Rw   Rx   R|   Rs   Ry   Rz   (   t   notices(   RT   R  R  t   upkgR   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _get_new_pkgsl  s    t   bugzillat	   bugzillast   bzst   bzR  t   sect   cvet   cvesR  t   newpackagess   new-packagess   new-packageR=  c      	      s9  | |  j  k r |  j  | } nd | rL | d d k rL | d } | d	 } n7 | rn | d |  j k rn d } n | r} d } n d } | d k r |  j   d
 | |  j  S| d k r |  j   d | |  j  S| d k r |  j   d | |  j  S| d k rEd  } | rt j |  } n  t j	   |  d | d | d g f S| d k rd  } | rot j |  } n  t j
   |  d | d | d g f S| d k rd  } | rt j |  } n  t j   |  d | d | d g f S| d k r5  f d   } t j     j |  d | d | d g f Sd  S(   Ni    R   R5   R   s   remove-pkgs-tss   exclude-updatess   exclude-alls   check-running-kerneli   s   updateinfo lists   updateinfo infos   updateinfo summaryR   s    donec            s     j  j d |   d  S(   Ns   %s(   R4   R5   (   R\  (   R   (    s!   /usr/share/yum-cli/yumcommands.pyR]    s    (   s   lists   infos   summarys   remove-pkgs-tss   exclude-updatess   exclude-alls   check-running-kernel(   R  t	   _cmd2filtt   doCommand_liR  R  R  R   R   t   _args2filtersRl   R   R   Rc  Rd  (   RT   R   R   R'   t
   subcommandt   filtersR]  (    (   R   s!   /usr/share/yum-cli/yumcommands.pyR^     sX      	
		


c      
   C   s  t    } g  }	 x[t |  j |  d d   D];\ }
 } | r` t j | | d |
  r` q. n  | d } | | k r| q. n  t t t | j j | g     } | d k r | r | j	 |  q. n  | d k r | r | j	 |  q. n  | j
 j |  } | sq. n  | d k rB| d j | d  rB| j	 |  q. n  | j	 |  |	 j |
 | | d f  q. W| | | | d  | |	 |  d  S(   NR   c         S   s   |  d d S(   Ni   i    (    (   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyR    s    i    R   R   R   (   s	   installeds   updates(   R   R   R  R  t   _match_sec_cmdR   t   reversedR?   R  R!  RL   R  t   verLER   R   (   RT   R   R  R'   R  R$   t	   show_pkgsR  t	   done_pkgsR~   R  R\  R  t   ipkgsR   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   doCommand_li_new  s2    	 
'#c         C   s   d  } d  } t |  d k rw d  } | d |  j k rP |  j | j d  } n  | } | rw | t j k rw d  } qw n  | | | f S(   Ni   i    (   R   R&   R  R  R  t   _update_info_types_(   RT   R'   t	   filt_typeR  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _parse_extcmds  s    c      
      s  | j   d   } |  j |  \ } }   d  d  | r | d d k r | j d     d  k r |  j |  \ } }   q n  t j | j |   t j | j   i   t r nx  d k r t j	 |  } t j
 |   nK  d k rt j |  } n-  d k r3t j |  } t j
 |   n    d k ro|  j |  |  | |   d | d g f S       f d	   } g  }	 x t |  D] }
 x | | |
  D] \ } } i  } | \ | d
 <| d <| d <| d <| d <| d d k rd | d <n d | d | d <|	 j | | d | f  qWqW| |   |  |	 |  t j  |  d | d g f S(   Nc         S   s	   |  GHd  S(   N(    (   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyR$     s    R   R   i    R   R@   R  s	    new donec         3   s   |  d } t   j |    } x | D] \ }  }   rQ t j   |  rQ q& n   d k r t j  | |   d k  r q& q n   d k r |  k r t j  | |   d k r q& q n  t j  | |   r& |  | f Vq& q& Wd  S(   Ni    R   R   (   R  t   get_applicable_noticesR  R  R  t   _ysp_should_filter_pkg(   R\  Rw   R  R  (   R  R  R  R  t   optst   used_map(    s!   /usr/share/yum-cli/yumcommands.pyt   _show_pkgtup
  s    
	(	R  R  R   R   R6   Rs   Rr   R|   s   %s:s    %(n)s-%(epoch)s%(v)s-%(r)s.%(a)ss    done(   s   updatess	   availables	   installeds   all(   s	   availables   all(   Rd  R  R  R   R  t   _ysp_gen_optst   updateinfo_filterst   _ysp_gen_used_mapRQ   t   _get_name2allpkgtupt   _get_name2instpkgtupt   _get_name2oldpkgtupt   _get_name2aallpkgtupR  R   R   t   _ysp_chk_used_map(   RT   R   R   R'   R  R$   R  t   name2tupR  R~   R  R\  R  R   (    (   R  R  R  R  R  R  s!   /usr/share/yum-cli/yumcommands.pyR    sP    		 
)(   Rb   Rc   R  RY   R[   R\   R]   R  R  R  R  R  R  R  R  R^   R  R  R  (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR    sB   

					(		=	


	6		t   UpdateMinimalCommandc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C   s
   d d g S(   Ns   update-minimals   upgrade-minimal(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   0  s    c         C   s   d S(   Ns   [PACKAGE-wildcard](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   3  s    c         C   s
   t  d  S(   Nsi   Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   6  s    c         C   s   t  |  t |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   R%   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   9  s    

c         C   sf   t  | j  } t j | |  t  | j  | } | d k rU d | } d | g f Sd d g f Sd S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i    s%   %d packages marked for minimal Updatei   s%   No Packages marked for minimal UpdateN(   R&   Rq  R  t   update_minimal(   RT   R   R   R'   R  R$   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   F  s    
(   Rb   Rc   RY   R[   R\   R]   R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR   /  s
   				t   FSSnapshotCommandc           B   sD   e  Z d    Z d   Z d   Z d   Z e d    Z d   Z RS(   c         C   s
   d d g S(   Nt
   fssnapshott   fssnap(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY   a  s    c         C   s   d S(   Ns   [](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[   d  s    c         C   s
   t  d  S(   NsA   Creates filesystem snapshots, or lists/deletes current snapshots.(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\   g  s    c         C   s   t  |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        N(   R   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]   j  s    
c         C   sx  t  | d d   } t t d   } t t d   } x@ | D]8 } t | t | d   } t | t | d   } q@ Wt } x | D] } | sd t t d  |  t t d  d	 d
 t t t d  d	 d
 t t t d  d	 d
 t t t d  |  t d  f GHt } n  d | | d |  j | d  | d |  j | d  | | d d j	 | d  f GHq Wd  S(   NR   c         S   s   |  d S(   Nt   dev(    (   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyR  x  s    t   Snapshott   OriginR  t   origins   %s %s %s %s %s %st   Sizei   R  t   Usedt   Freet   Tagss   %*s %6s %5.1f%% %6s %*s %sR  t   usedt   freeR  R  (
   R   R   R   R  R&   RQ   R   R.   R  R0   (   R   t   snapst   max_devt   max_oriR~   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyt	   _li_snapsv  s*    !	c         C   s  | r- | d d# k r- | d } | d } n d } | j  j s t d	  } | j j d
 g  sw | d t d  7} n  | j j d g  s | d t d  7} n  | GHd | d | d g f S| d k r8y | j  j   } Wn- t k
 r} d t d  t |  g f SXt d  t |  GH|  j	 | |  n  | d k rt d  } y | j  j   } Wn' t k
 r} d | t |  g f SXg  | D] } | d ^ q}	 t
   } x` |	 D]X }
 |
 | k rqn  x= | D]5 } |
 | k st j |
 |  r| j |
  PqqWqWy | j  j d |  } Wn' t k
 rX} d | t |  g f SXt d  t |  GH|  j	 | |  n  | d$ k r| j j } y | j  j |  } Wn- t k
 r} d t d  t |  g f SX| rt d  GHqt d  GHn  | d k ri d g d 6} | j j } t d  } y | j  j | d | } Wn- t k
 r} | d t |  7} g  } n X| s| GHn  x, | D]! \ } } t d  | | f GHqWn  | d k ry | j  j   } Wn- t k
 r} d t d  t |  g f SX| sAt d  G| j  j GHd | d | d g f Sd } t
   } x- | D]% } | | d  7} | j | d!  qWWt d"  } | t |  | j |  t |  f GHn  d | d | d g f S(%   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i    R   t   deleteR5  R   s
   have-spaces	   has-spacei   sC   Snapshot support not available, please check your lvm installation.t   lvm2R   s   No lvm2 package installed.s   lvm2-python-libss&   No lvm2-python-libs package installed.s    dones   Failed to list snapshots: s   List of %u snapshosts:s   Failed to delete snapshots: R  t   devicess   Deleted %u snapshosts:s3   Could not determine free space on logical volumes: s#   Space available to take a snapshot.sA   Not enough space available on logical volumes to take a snapshot.s   reason=manualR  s   Failed to create snapshotsR  s   : s(   Created snapshot from %s, results is: %ss   No snapshots, LVM version:R  t
   origin_devs3   Have %u snapshots, using %s space, from %u origins.(   s   listR  s   creates   summarys
   have-spaces	   has-space(   s
   have-spaces	   has-space(   R  R   R   R?   R  t   old_snapshotsR
   R   R&   R  R   t   fnmatchR!  t   del_snapshotsR   t   fssnap_percentaget	   has_spacet   snapshotRy   R  (   RT   R   R   R'   R  R$   R  R   R\  t   devsR  t   extcmdt   pcR  R  t   odevt   ndevR  t   dev_orist   snap(    (    s!   /usr/share/yum-cli/yumcommands.pyR^     s    	
	
	*(	   Rb   Rc   RY   R[   R\   R]   R  R  R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR  `  s   				t	   FSCommandc           B   sz   e  Z d    Z d   Z d   Z d   Z e e d  Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z RS(   c         C   s   d g S(   Nt   fs(    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyRY     s    c         C   s   d S(   Ns   [](    (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR[     s    c         C   s
   t  d  S(   Ns]   Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.(   R   (   RT   (    (    s!   /usr/share/yum-cli/yumcommands.pyR\     s    c         C   sN   | r | d d	 k r d St  |  d k r@ | d d
 k r@ d St |  d S(   s  Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        that there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        i    t   duR  t   diffNi   R  t   filter(   R&  s   statusR'  (   s   filterss   filter(   R&   R   (   RT   R   R   R'   (    (    s!   /usr/share/yum-cli/yumcommands.pyR]     s
    
"c            sl   i i  d 6i  d 6i  d 6i  d 6i  d 6   f d   }  f d          f d   } | |  S(	   Nt   normt   modt   ghostt   misst   notc            s   x |  D]{ } x; | j  | j D]) } | j   s9 q n  |   d | <q Wx4 | j D]) } | j   sp qU n  |   d | <qU Wq W  S(   NR)  R+  (   Ro  t   dirlistR   t	   ghostlist(   R   R   t   fname(   t   pfrt   prefix(    s!   /usr/share/yum-cli/yumcommands.pyt   quick_match"  s    c         3   s   x |  D] } t  } x/ | j D]$ } | j    r | Vt } Pq q W| rQ q n  x/ | j D]$ } | j    r[ | Vt } Pq[ q[ W| r q n  x) | j D] } | j    r | VPq q Wq Wd  S(   N(   RQ   R.  R   R.   Ro  R/  (   R   R   t   foundR0  (   R2  (    s!   /usr/share/yum-cli/yumcommands.pyt   _quick_match_iter.  s(    c      
      s+  g       f d   }  d k r3  |   }  n  x |  D] } g    | j  d  d g d t d | d t  } x   d D] } | j | k r |  d	 | j <q| | j d
 k r |  d | j <q| d | j k r |  d | j <q| d | j k r|  d | j <q| |  d | j <q| Wq: W S(   Nc            s     j  |    s g  S|  S(   N(   R   (   t   pfs(   t   _pfst   modified(    s!   /usr/share/yum-cli/yumcommands.pyt	   scoop_pfsG  s    R  R  R  t   fake_problemst   callbackt   failfasti    R*  s   not installedR-  R+  s
   missing okR,  R)  (   t   verifyRQ   R.   R  t   rpmfile_statet   rpmfile_types(   R   R9  R   t   probst   pf(   R5  R8  R1  R2  (   R7  s!   /usr/share/yum-cli/yumcommands.pyt   verify_matchE  s&    (    (   RT   R   R2  R8  R  R3  RB  (    (   R5  R8  R1  R2  s!   /usr/share/yum-cli/yumcommands.pyt   _fs_pkg_walk  s    

c            s  d    d   } i i  d 6i  d 6i  d 6i  d 6i  d 6i  d 6i  d	 6i  d
 6d d 6d d 6d d 6d d 6d d 6d d 6 d     t       f d  } d } | r | d } | d } n  t j j |  s d t d |  g f Sd  | ry t | d   WqqXn   j j t j	  } |  j
  j | d |   j   d } t j j |  r| d 7} | |  n  x} t j |  D]l \ } }	 }
 xZ |
 D]R } | d 7} t j j | d |  } t j j |  rqn  | | d | qWqWd G| |  GHd } |  d 7} |  d 7} |  d 7} |  d 7} |  d 7} |  d 7} d G j |  GH| sd  S d } | s|  d 7} |  d 7} |  d 7} n  d Gd  j |  Gd | d  | GH| rx t d!   d f t d"   d f t d#   d f t d$   d f f D]> \ } } | sYqAn  | Gd  j |  Gd | d  | GHqAWn   d } | s|  d 7} n  t d%  Gd  j |  Gd | d  | GH| r|d& GHt d'  G| t  d   GHt d(  G| t  d   GHt d)  G| t  d   GHt d*  G| t  d   GHt d+  G| t  d   GHn    f d,   } | r!|  d t d-   |  d t d.   |  d t d/   |  d t d0   |  d t d1   |  d t d2   n i  } | j  d  x*  d D] }   | |  d |  qCWx*  d D] }   | |  d |  qpWx*  d D] }   | |  d |  qW| | t d-   d& GH| r d	  n( i    j  d	   j  d
  t  t    } | r?t d3  | GHn  d } x} t  d4  f d5   d6 t  D]Z } | d 7}  | } t d7  t t |   | |  j |  f GH| | k rgPqgqgWd  S(8   Nc         s   s.   x' |  d k r) t  j j |   }  |  Vq Wd  S(   NR  (   RD   RE   R  (   RE   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _dir_prefixesg  s    c         S   s   t  j d t |   t  S(   s5    String of a number in the readable "locale" format. s   %d(   R  R  RU  R.   (   R\  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   loc_numl  s    t	   pkgs_sizet   pkgs_not_sizet   pkgs_ghost_sizet   pkgs_miss_sizet   pkgs_mod_sizet	   pres_sizet	   data_sizet   data_not_sizei    t
   pkgs_countt   pkgs_not_countt   pkgs_ghost_countt   pkgs_miss_countt   pkgs_mod_countt
   data_countc         S   s-   | |  k r d |  | <n  |  | c | 7<d  S(   Ni    (    (   R   R   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyt	   _add_size  s    c            s  t  j j |   } |   d k rQ  d c | 7<   d  d |  |  n|   d k r  d c | 7<   d  d |  |  nX|   d k r  d c | 7<   d	  d |  |  |  d
 |  <n|   d k r d c | 7<   d  d |  |  n |   d k r[ d c | 7<   d  d |  |  n | rt rx?  |   D]1 } | t k rqtn     d t | |  PqtW d c | 7<|  d |  <n  d c | 7<|  d |  <d  S(   NR)  RN  RF  R+  RP  RH  R-  RO  RG  RM  R,  RQ  RI  R*  RR  RJ  RK  RS  RL  (   RD   RE   t   getsizeRQ   t	   pkg_files(   t   fpatht   need_prefixR  t	   fpre_path(   RT  RD  R~   R1  (    s!   /usr/share/yum-cli/yumcommands.pyt   deal_with_file  s6    t   .i   s   No such file or directory: i   R  R  RX  s   Files            :s   Total size       :s          Pkgs size :s   %-5ss	   (%3.0f%%)g      Y@s    Ghost pkgs size :s    Not pkgs size :s    Miss pkgs size :s    Mod. pkgs size :s          Data size :Rr   s   Pkgs       :s   Ghost Pkgs :s   Not Pkgs   :s   Miss. Pkgs :s   Mod. Pkgs  :c            s   t   t     } | r, d GH| | GHn  d } xw t   d   f d   d t D]T } | d 7} t d  t t |   | |  j   |  f GH| | k rT PqT qT Wd  S(   NRr   i    R   c            s     |  S(   N(    (   R\  (   t   p_size(    s!   /usr/share/yum-cli/yumcommands.pyR    s    t   reversei   s   %*d. %60s %-5s(   t   minR&   R   R.   R   R  R  (   R\  R$   t   totR  R   (   R   t   max_show_len(   R\  s!   /usr/share/yum-cli/yumcommands.pyt   _pkgs  s    (
s   Top %d packages:s   Top %d ghost packages:s   Top %d not. packages:s   Top %d miss packages:s   Top %d mod. packages:s   Top %d prefix packages:s   Top %d non-package files:R   c            s     |  S(   N(    (   R\  (   RL  (    s!   /usr/share/yum-cli/yumcommands.pyR  "  s    R]  s   %*d. %60s %-5s(   R.   RD   RE   RK   R   RU  R4   R_  R    R`  RC  R?   t
   closeRpmDBRF   t   walkt   normpatht   islinkR  R&   Ri   R^  R   R  (   RT   R   R'   RE  RZ  R2  R  R  t   roott   dirst   filesR0  RW  R_  t   titleRa  t   tmpR   t   dsznum(    (   RT  RD  R   R~   RL  R`  R1  s!   /usr/share/yum-cli/yumcommands.pyt   _fs_duf  s    		

	





	
	
	
"

c   
   	      sK    f d   } | su   j  j } | s= d t j d  } n  t d  GHt d  Gd   j  j k GHt d  G| GHn| d d% k rbd   j  j k } | d j d  } | | k r | r t d  GHn t d  GHd  S| r t d  GHn t d  GH  j  j } | r| d g } n% g  | D] } | d k r"| ^ q"} d j |    j  _ | d  n | d d& k r4| d j d  st |  d k  sd | k rd }	 n d j | d  }	 |	   j  j k r|	 rt d  |	 GHn t d   GHd  S|	 rt d!  |	 GHn t d"  GH|	   j  _ | d#  n d t d$  g f Sd  S('   Nc      	      s   t  j j } t j j   j j d  sB t j   j j d  n    j j d } t j j |  s   j j d } t j j |  r | } q t	 j
   j j |  n    j } | | d | j | j j | j | j d |  g d  S(   Ns   /etc/yums   /etc/yum/yum.confs   /etc/yum.conft   maint   only(   RI   R  t   _writeRawConfigFileRD   RE   RK   R   t   installroott   makedirst   shutilt   copy2t   config_file_pathR  t   cfgt   optionst	   iteritemst	   optionobj(   t   confkeyt   writeRawConfigFilet   fnt   nfnt   ybc(   R   (    s!   /usr/share/yum-cli/yumcommands.pyt   _save,  s    			s   rpm: s   %_install_langss   File system filters:s	     Nodocs:t   nodocss     Languages:i    t   docst   documentationt   nodocumentationt   nos%   Already enabled documentation filter.s&   Already disabled documentation filter.s   Enabling documentation filter.s   Disabling documentation filter.R   t   tsflagst   langst   nolangst   langt   nolangt	   languagest   nolanguagest   languaget
   nolanguagei   R@   RT  i   s"   Already filtering languages to: %ss!   Already disabled language filter.s   Setting language filter to: %ss   Disabling language filter.t   override_install_langss$   Not a valid sub-command of fs filter(   R  R  R  R  (   R  R  R  R  R  R  R  R  (	   R   R  t   rpmt   expandMacroR   R  R   R0   R&   (
   RT   R   R'   R~  t   oilt   c_ft   n_ft   ntsR\  t   val(    (   R   s!   /usr/share/yum-cli/yumcommands.pyt   _fs_filters+  sV    	% 	1	c   	      C   sv  d | j  j k } | j  j } | s6 t j d  } n  | d k rK d } n' | rr d j t | j d    } n  t } d } x | j	 j
 d |  D] } t r q | | j j d d  k r | j d	 |  } | t |  7} q | d
 | j j d  k k r&| j d	 |  } | t |  7} q t } q W| rLd t d d |  f S| srd t d  d j |  g f Sd  S(   NR  s   %_install_langsR@   Rr   RT  i    R  t   ts_install_langsR   t   truet   tsflag_nodocsi   s   %d package to reinstalls   %d packages to reinstalli   s   No valid packages: %sR   (   R   R  R  R  R  R0   R   R  RQ   R?   R*  R   R  R  R&   R.   R   R   (	   RT   R   R'   R  R  R4  R  R   R  (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _fs_refilter|  s2    	! 

c         C   s   | j  j d |  } | j j t j  } |  j | d d | d t } | j   x t	 | d  D]r } t
 d  G| GHy t j |  Wqc t k
 r } | j t j k r y t j |  Wq q Xq qc qc Xqc Wd  S(   NR  R  R  R8  R-  s	   Removing:(   R?   R*  R4   R_  R    R`  RC  R.   Rb  R   R   RD   t   unlinkt   OSErrort   errnot   EISDIRt   rmdir(   RT   R   R'   R   R  R1  R0  R   (    (    s!   /usr/share/yum-cli/yumcommands.pyt   _fs_refilter_cleanup  s     

c            s~      f d   } t  j j d  s? t j j t d   n  t  j j d  si t j j t d   n  t  j j d  s t j j t d   n  d } | r | d	 } | d
 } n  | j j d |  } | j	 j
 t j  } |  j | | d | d t  | j   i    g  } x*t  d j    D]} | j }	 d |	 k r|	 j | j j k r| j j |	 j  }
 |
 j   s| j j |
 j  qqn  xw | j j | j  D]` } d |	 k rd |	 k r|	 j | j k r|	 j | j k r|   | j <| j |  PqqW| j   k r+t j j t d  |  q+q+W| rt  j!    | j" | d | j# } t$ |  d	 k rd } | t d  7} xI | D]A } t j% j& | |  } x" | D] } | d | | f 7} qWqWt j j |  qn  xm t' j( |  D]\ \ } } } xJ | D]B } t' j) j* | d |  } t' j) j+ |  rRqn  | |  qWqW| rzt, j-   n  d  S(   Nc            s  |   d k r n |   d k r& n |   d k rR t  j t d  I|  IJn |   d k re n |   d k r    d |  j } t  j j   d } |  | j   |  f } t j |  d  |  |  f } | GHt  j j   t j |  n t  j t d	  I|  IJd  S(
   NR)  R+  R-  s   Not installed:R,  R*  s)   cd %s; rpm2cpio %s | cpio --quiet -id .%ss   diff -ru %s %ss   Not packaged?:(	   t   syst   stderrR   R\  t   stdoutt   flusht   localPkgRD   t   system(   RW  R   t   extract_cmdt   diff_cmd(   R  R1  t   tmpdir(    s!   /usr/share/yum-cli/yumcommands.pyRZ    s&    R'  s   Can't find diff commandt   cpios   Can't find cpio commandt   rpm2cpios   Can't find rpm2cpio commandR[  i    i   R  R  R8  R*  t	   from_repot   checksum_typet   checksum_datas   Can't find package: %st   callback_totalRr   s   Error downloading packages:
s	     %s: %s
R  (.   t	   distutilst   spawnt   find_executableRI   R   R   R   R?   R*  R4   R_  R    R`  RC  R.   Rb  R   R  R   R  R   t   getRepoR/   R2   R3   RL   R  R\  R  R  t   pkgIdR   Rj  t   mkdtempt   downloadPkgst   download_callback_total_cbR&   R   t   uniqueRD   Rc  RE   Rd  Re  Rr  t   rmtree(   RT   R   R'   RZ  R2  R   R  t   downloadpkgsR8  t   iyiR#   t   apkgt   problemst	   errstringR   t   errorst   errorRf  Rg  Rh  R0  RW  (    (   R  R1  R  s!   /usr/share/yum-cli/yumcommands.pyt   _fs_diff  sj    

	 c            s     f d   } d } | r2 | d } | d } n  | j  j d |  } | j j t j  } |  j | | d | d t   | j   xm t	 j
 |  D]\ \ } } }	 xJ |	 D]B }
 t	 j j | d |
  } t	 j j |  r q n  | |  q Wq Wd  S(	   Nc            s   |    d k r ny |    d k r& nf |    d k rH t  d  G|  GHnD |    d k r[ n1 |    d k r} t  d  G|  GHn t  d  G|  GHd  S(	   NR)  R+  R-  s   Not installed:R,  R*  s	   Modified:s   Not packaged?:(   R   (   RW  (   R1  (    s!   /usr/share/yum-cli/yumcommands.pyRZ    s    R[  i    i   R  R  R8  R  (   R?   R*  R4   R_  R    R`  RC  R.   Rb  RD   Rc  RE   Rd  Re  (   RT   R   R'   RZ  R2  R   R  Rf  Rg  Rh  R0  RW  (    (   R1  s!   /usr/share/yum-cli/yumcommands.pyt
   _fs_status
  s    

c      
   C   si  | r- | d d k r- | d } | d
 } n d } t  r< n| d k r] |  j | |  } n | d k r~ |  j | |  } n | d k r |  j | |  } n | d k r |  j | |  } n | d k r |  j | |  } n_ | d k r|  j | |  } n> | d	 k r)t   j | d t	  } n d
 t
 d  | g f S| d k	 rP| Sd | d | d g f S(   s  Execute this command.

        :param base: a :class:`yum.Yumbase` object
        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        :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
        i    R  R(  t   refilters   refilter-cleanupR&  R  R'  R#  i   s   fs snaps   Not a valid sub-command of %sR   s    done(   s   filterss   filterR  s   refilter-cleanups   dus   statuss   diffs   snap(   s   filters   filtersN(   RQ   Rl  R  R  R  R  R  R  R^   RW   R   R   (   RT   R   R   R'   R  Rm   (    (    s!   /usr/share/yum-cli/yumcommands.pyR^   .  s4     	
 (   Rb   Rc   RY   R[   R\   R]   RQ   RC  Rl  R  R  R  R  R  R^   (    (    (    s!   /usr/share/yum-cli/yumcommands.pyR$    s   				M		Q			Y	$(P   Rd   RD   R  R   R  RI   R    R   R   R   t
   yum.ErrorsR   R  R  R  t   yum.i18nR   R   R   R   Rj  Rr  t   distutils.spawnR  Rm  R  t
   yum.configR   t   yum.packagesR	   t   yum.fssnapshotsR
   R   R   R   R%   R(   R*   R7   R8   R9   RB   RG   RO   RP   Re   Rh   Rn   R   R   R   R   R   R   R   R=  RS  RV  RZ  Rh  Rj  Rk  Rr  Rv  Ry  R{  R  R  R  R  R  RL  RS  R  R  R  R  R   R  R$  (    (    (    s!   /usr/share/yum-cli/yumcommands.pyt   <module>   s   "			
				&				o=<<		k kNBlM<K<BC LnGHL^ 2 ]1