ó
È”Mc           @   s˜   d  d l  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 e d „ Z d S(   iÿÿÿÿ(   t   checkPackages(   t   OptionParser(   t   Package(   t   *Ns#   smart check [options] [package] ...s0  
This command will check relations between packages. If no
packages are explicitly given, all packages in the selected
channels will be checked. Relations of the checked packages
will only match packages inside the selected channels.

Use the 'fix' command to fix broken relations of
installed packages.
s†   
smart check
smart check pkgname
smart check '*kgna*'
smart check pkgname-1.0
smart check pkgname-1.0-1
smart check 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 d d t d ƒ ƒ|  S(   Nt   usaget   descriptiont   exampless   --allt   actiont
   store_truet   helps   check packages in all channelss   --installedsD   check packages which are in at least one installed channel (default)s   --availables>   check packages which are in at least one non-installed channels
   --channelst   storet   metavart   ALIASESsL   check packages which are inside the given channels (comma separated aliases)(   R   t   USAGEt   DESCRIPTIONt   EXAMPLESt
   add_optiont   _(   t   parser(    (    s8   /usr/lib/python2.7/dist-packages/smart/commands/check.pyt   option_parser2   s    	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s8   /usr/lib/python2.7/dist-packages/smart/commands/check.pyt   parse_optionsC   s    		c         C   sÜ  t  j d ƒ rA d d l m } | j g  ƒ } | j |  | ƒ n | rT |  j ƒ  n  |  j ƒ  } | j r„ t	 j
 | j ƒ  t ƒ } nèi  } | j rñ x[ | j ƒ  D]J } | j s¼ t | | <q  x+ | j D]  } | j ƒ  sÆ t | | <PqÆ qÆ Wq  Wn  | j r| j j d ƒ }	 g  }
 g  } t  j d d ƒ } xM |	 D]E } | | k rS|
 j | ƒ q1| | j d ƒ r1| j | ƒ q1q1W|
 rŸt t d ƒ d j |
 ƒ ‚ n) | rÈt j t d	 ƒ d j | ƒ ƒ n  xT | j ƒ  D]C } x: | j D]/ } | j ƒ  j ƒ  | j k råt | | <PqåqåWqÕWn  | j s<| j rl| j rlx- | j ƒ  D] } | j rIt | | <qIqIWn  | j r¿i  } xG| j D]3} |  j | ƒ \ } } } | s\| rF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 ‚ q\t t d ƒ | ‚ n  i  } xF | D]> } t | t ƒ r‹t | | <qi| j t	 j
 | j t ƒ ƒ qiW| j | ƒ q…Wn | } t! | | | d t ƒS(   Ns   auto-updateiÿÿÿÿ(   t   updatet   ,t   channelst   disableds   Channels not found: %ss   , s   Channels are disabled: %ss)   '%s' matches no packages. Suggestions:
%ss   
s       s   '%s' matches no packagest   report(    ("   t   sysconft   gett   smart.commandsR   R   t   maint   reloadChannelst   getCachet   allt   dictt   fromkeyst   getPackagest   Truet	   availablet	   installedt   loaderst   getInstalledR   t   splitt   appendt   ErrorR   t   joint   ifacet   warningt
   getChannelt   getAliasR   t   searcht
   isinstanceR   t   packagest   strR    (   t   ctrlR   t   reloadchannelsR   t
   updateoptst   cachet	   relatesett   pkgt   loadert   aliasest   notfoundR   R   t   aliast   checksett   argt   ratiot   resultst   suggestionst   dctt   rt   objt   x(    (    s8   /usr/lib/python2.7/dist-packages/smart/commands/check.pyR!   I   s€    			
	
		 6 (   t   smart.transactionR    t   smart.optionR   t   smart.cacheR   t   smartt   stringt   reR   R   R   R   R   R   R(   R!   (    (    (    s8   /usr/lib/python2.7/dist-packages/smart/commands/check.pyt   <module>   s   
				