ó
È”Mc           @   s¡   d  d l  m Z 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   FIX(   t   OptionParser(   t   Package(   t   *Ns!   smart fix [options] [package] ...sî   
This command will try to fix dependencies of installed packages
which are related to the given packages. Notice that the given
packages may be currently installed or not. If no packages are
given, all installed packages will be checked.
sz   
smart fix
smart fix pkgname
smart fix '*kgna*'
smart fix pkgname-1.0
smart fix pkgname-1.0-1
smart fix 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(    (    s6   /usr/lib/python2.7/dist-packages/smart/commands/fix.pyt   option_parser/   s     	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s6   /usr/lib/python2.7/dist-packages/smart/commands/fix.pyt   parse_optionsB   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 ƒ } | j rçi  } x>| j D]3} |  j | ƒ \ } }	 }
 |	 sx|
 rbi  } xL |
 D]D \ } } t | t ƒ r t | | <qØ | j t j | j t ƒ ƒ qØ Wt t d ƒ | d j g  | D] } d t | ƒ ^ q<ƒ f ‚ qxt t d	 ƒ | ‚ n  i  } xF |	 D]> } t | t ƒ r§t | | <q…| j t j | j t ƒ ƒ q…W| j | ƒ q¡ W| j ƒ  } n | j ƒ  } x | D] } | j | t ƒ qúWt j t d
 ƒ ƒ | j ƒ  | sMt j t d ƒ ƒ n— t j ƒ  | j  } | j! rz|  j" | ƒ nj | j# r“|  j$ | ƒ nQ | j% r²|  j& | d | ƒn2 | j' rÑ|  j( | d | ƒn |  j) | d | ƒd  S(   Ns   explain-changesetst   softs   auto-updateiÿÿÿÿ(   t   updates)   '%s' matches no packages. Suggestions:
%ss   
s       s   '%s' matches no packagess   Computing transaction...s   No problems to resolve!t   confirm(*   t   explaint   sysconft   sett   Truet   gett   smart.commandsR   R   t   maint   reloadChannelst   getCacheR    R   R   t   searcht
   isinstanceR   t   dictt   fromkeyst   packagest   ErrorR   t   joint   strt   keyst   getPackagest   enqueueR   t   ifacet
   showStatust   runt
   hideStatust   yest   urlst   dumpTransactionURLst   metalinkt   dumpTransactionMetalinkt   downloadt   downloadTransactiont   steppedt   commitTransactionSteppedt   commitTransaction(   t   ctrlR   R   t
   updateoptst   cachet   transt   pkgst   argt   ratiot   resultst   suggestionst   dctt   rt   objt   xt   pkgR   (    (    s6   /usr/lib/python2.7/dist-packages/smart/commands/fix.pyR!   H   s`    	
	 6 


				(   t   smart.transactionR    R   R   t   smart.optionR   t   smart.cacheR   t   smartt   stringt   reR   R   R   R   R   R   R!   (    (    (    s6   /usr/lib/python2.7/dist-packages/smart/commands/fix.pyt   <module>   s   
				