ó
È”Mc           @   s·   d  d l  m Z m Z m Z d  d l  m Z m Z d  d l m Z d  d l m	 Z	 d  d l
 Td  d l Z d  d l Z e d ƒ Z e d ƒ Z e d	 ƒ Z d
 „  Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   Transactiont   PolicyInstallt   sortUpgrades(   t   INSTALLt	   REINSTALL(   t   OptionParser(   t   Package(   t   *Ns%   smart reinstall [options] package ...s]   
This command will reinstall one or more packages which
are already installed in the system.
s   
smart reinstall pkgname
smart reinstall '*kgnam*'
smart reinstall pkgname-1.0
smart reinstall pkgname-1.0-1
smart reinstall pkgname1 pkgname2
c          C   sÜ   t  d t d t d t ƒ }  |  j d d d d t d ƒ ƒ|  j d	 d d d t d
 ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d d t d ƒ ƒ|  S(   Nt   usaget   descriptiont   exampless	   --steppedt   actiont
   store_truet   helps   split operation in stepss   --urlss+   dump needed urls and don't commit operations
   --metalinks,   dump metalink xml and don't commit operations
   --downloads,   download packages and don't commit operations	   --explains:   include additional information about changes,when possibles   -ys   --yess   do not ask for confirmation(   R   t   USAGEt   DESCRIPTIONt   EXAMPLESt
   add_optiont   _(   t   parser(    (    s<   /usr/lib/python2.7/dist-packages/smart/commands/reinstall.pyt   option_parser-   s     	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s<   /usr/lib/python2.7/dist-packages/smart/commands/reinstall.pyt   parse_options@   s    		c      
   C   s_  | j  r" t j d t d t ƒn  t j d ƒ rc d d l m } | j g  ƒ } | j |  | ƒ n
 |  j	 ƒ  |  j
 ƒ  } t | t ƒ } x| j D]} |  j | ƒ \ } } }	 | s™|	 r;i  }
 xf |	 D]^ \ } } t | t ƒ rý | j r't |
 | <q'qÉ x' | j D] } | j rt |
 | <qqWqÉ W|
 s;|	 2q;n  |	 rƒt t d ƒ | d j g  |
 D] } d t | ƒ ^ q]ƒ f ‚ q™t t d	 ƒ | ‚ n  g  } x- | D]% } t | t ƒ r¦| j | ƒ q¦q¦W| s
x2 | D]' } x | j D] } | j | ƒ qìWqÜWn  t } xg | D]_ } | j rt } | j | t ƒ x7 | j D] } | j ƒ  sFPqFqFWt t d
 ƒ | ‚ qqW| s’ t j t d ƒ | ƒ q’ q’ Wt j t d ƒ ƒ | j  ƒ  t j! ƒ  | r[| j" } | j# rî|  j$ | ƒ q[| j% r|  j& | ƒ q[| j' r&|  j( | d | ƒq[| j) rE|  j* | d | ƒq[|  j+ | d | ƒn  d  S(   Ns   explain-changesetst   softs   auto-updateiÿÿÿÿ(   t   updates)   '%s' matches no packages. Suggestions:
%ss   
s       s   '%s' matches no packagess(   '%s' is not available for reinstallations"   '%s' matches no installed packagess   Computing transaction...t   confirm(,   t   explaint   sysconft   sett   Truet   gett   smart.commandsR   R   t   maint   reloadChannelst   getCacheR    R   R   t   searcht
   isinstanceR   t	   installedt   packagest   ErrorR   t   joint   strt   appendt   Falset   enqueueR   t   loaderst   getInstalledt   ifacet   warningt
   showStatust   runt
   hideStatust   yest   urlst   dumpTransactionURLst   metalinkt   dumpTransactionMetalinkt   downloadt   downloadTransactiont   steppedt   commitTransactionSteppedt   commitTransaction(   t   ctrlR   R   t
   updateoptst   cachet   transt   argt   ratiot   resultst   suggestionst   dctt   rt   objt   pkgt   xt   pkgst   foundt   loaderR   (    (    s<   /usr/lib/python2.7/dist-packages/smart/commands/reinstall.pyR#   F   sz    	
		
6	


				(   t   smart.transactionR    R   R   R   R   t   smart.optionR   t   smart.cacheR   t   smartt   stringt   reR   R   R   R   R   R   R#   (    (    (    s<   /usr/lib/python2.7/dist-packages/smart/commands/reinstall.pyt   <module>   s   
				