ó
È”Mc           @   s‘   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z m Z m	 Z	 d  d l
 Td  d l Z d  d l Z d e f d „  ƒ  YZ d	 „  Z d S(
   iÿÿÿÿ(   t   SlackSiteLoader(   t   getFileDigest(   t   PackageChannel(   t	   SUCCEEDEDt   FAILEDt   NEVER(   t   *Nt   SlackSiteChannelc           B   s2   e  Z d Z d  „  Z d „  Z d „  Z d „  Z RS(   c         G   so   t  t |  ƒ j | Œ  | |  _ | |  _ | rb d j g  | D] } | j ƒ  s; | ^ q; ƒ |  _ n	 d  |  _ d  S(   Nt    (	   t   superR   t   __init__t   _baseurlt   _compressedt   joint   isspacet   _fingerprintt   None(   t   selft   baseurlt
   compressedt   fingerprintt   argst   x(    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyR
   $   s    		!c         C   s   t  j |  j d ƒ g S(   Ns   PACKAGES.TXT(   t	   posixpathR   R   (   R   (    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyt   getCacheCompareURLs.   s    c         C   s   |  j  r d Sd Sd  S(   Ni   i   (   R   (   R   (    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyt   getFetchSteps1   s    	c         C   sp  | j  ƒ  |  j r" d } d } n d } d } t j |  j | ƒ } | j | d |  j ƒ} | j d | ƒ | j ƒ  t k r| j	 ƒ  } t
 | ƒ } | |  j k r¨ t S| j  ƒ  t j |  j | ƒ } | j | d |  j ƒ} |  j rt j |  j | d ƒ }	 | j |	 ƒ }
 n  | j d | ƒ | j ƒ  t k rD| j	 ƒ  } n d  } |  j rÍ|
 j ƒ  t k rÍyt j d |
 j	 ƒ  | j	 ƒ  f ƒ \ } } t } t } d  } xƒ | j ƒ  D]u } | j d	 ƒ r²| d
 j ƒ  } | d } | d k rú| d } q'| d k rt } q'| d k r't } q'q²q²W| rGt t d ƒ |  ‚ n  | s]| |  j k rst t d ƒ |  ‚ n  WqÊt k
 rÆ} | j |  j ƒ  d ƒ | j ƒ  | j ƒ  t k r¿‚  qÇt SqÊXqÍn  |  j ƒ  t | | |  j ƒ } | j |  ƒ |  j j  | ƒ nW | j ƒ  t k r_t d ƒ |  d | j! ƒ  | j" ƒ  f g } t d j | ƒ ‚ n t S| |  _ t S(   Ns   PACKAGES.TXT.gzs   CHECKSUMS.md5.gzs   PACKAGES.TXTs   CHECKSUMS.md5t   uncompt   progresss   .ascs<   gpg --batch --no-secmem-warning --status-fd 1 --verify %s %ss   [GNUPG:]i   i    t   VALIDSIGi   t   GOODSIGt   BADSIGs   Channel '%s' has bad signatures$   Channel '%s' signed with unknown keyi   s&   Failed acquiring information for '%s':u   %s: %ss   
(#   t   resetR   R   R   R   t   enqueuet   runt	   getStatusR   t   getTargetPathR   t   _digestt   TrueR   R   t   commandst   getstatusoutputt   Falset
   splitlinest
   startswitht   splitt   Errort   _t   addR   t   showt
   getCachingR   t   removeLoadersR    t
   setChannelt   _loaderst   appendt   getURLt   getFailedReason(   R   t   fetcherR   t   PACKAGES_TXTt   CHECKSUMS_md5t   urlt   itemt	   localpatht   digestt   gpgurlt   gpgitemt   checksumpatht   statust   outputt   badsigt   goodsigt   validsigt   linet   tokenst   firstt   et   loadert   lines(    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyt   fetch7   s„    
		
			
	

	N(   t   __name__t
   __module__R   R   R
   R   R   RL   (    (    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyR      s
   	
		c         C   sB   t  | d | d | d | d |  | d | d | d | d ƒ	 S(	   NR   R   R   t   typet   namet   manualt	   removablet   priority(   R   (   t   aliast   data(    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyt   create†   s    
(   t   smart.backends.slack.loaderR    t   smart.util.filetoolsR   t   smart.channelR   t   smart.constR   R   R   t   smartR   R&   R   RV   (    (    (    s=   /usr/lib/python2.7/dist-packages/smart/channels/slack_site.pyt   <module>   s   
h