ó
Ö–Œ]c           @   sû   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 d Z e e f Z	 d Z
 d 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 d „  Z d „  Z d S(   iÿÿÿÿN(   t   PluginYumExitt	   TYPE_COREt   TYPE_INTERACTIVEs   2.3s   /etc/yum/universal-hookst    c         C   s'  |  j  d ƒ |  j  d ƒ t j j |  ƒ s0 d  Sxð t t j |  d ƒ ƒ D]Õ } t j | t j ƒ rt	 | ƒ rÄ t j
 | d | ƒ } | d k r| j d d | d | d t | ƒ ƒ qqt j
 | ƒ } | d k r| j d d	 | d
 t | ƒ ƒ qqJ | j d d	 | d ƒ qJ Wd  S(   Nt   *t   /s   /*t    i    i   s   !!!! "s   " did not exit cleanly: s   !!!! s    did not exit cleanly: s    is not executable(   t   rstript   ost   patht   isdirt   Nonet   sortedt   globt   accesst   X_OKt   lent   systemt   infot   str(   t   dirt   conduitt   argst   scriptt   exit(    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   _run_dir!   s     0(c         C   sÀ  | j  ƒ  } |  d | } i  } x‡ t j | d ƒ D]r } t j j | ƒ r4 t j j t j j | ƒ ƒ } | } | j d d ƒ } t j	 d | d ƒ } | | | <q4 q4 Wi  } t
 j ƒ  }	 i  }
 | j ƒ  } x± t t | ƒ ƒ D] } |
 j | j ƒ rÿ qá n  d |
 | j <| j } |	 j | d ƒ |	 j ƒ  t |  d	 | d
 | | ƒ x. | D]& } | | j | ƒ rTd | | <qTqTWqá Wx- | D]% } t | d
 | | d |	 j ƒ q‰W|	 j ƒ  d  S(   Ns   /multi_pkgs/s   /*t   __WILDCARD__s   .*t   ^t   $i   s   
s   /pkgs/R   s   --pkg_list=(   t	   getTsInfoR   R   R	   R
   t   basenamet   normpatht   replacet   ret   compilet   tempfilet   NamedTemporaryFilet
   getMemberst   listt   sett   has_keyt   namet   writet   flushR   t   searcht   close(   t   base_dirR   t   slott   tst   wc_slot_dirt   wildcard_listR	   t   regxt   wildcard_to_runt   pkgs_file_patht   members_seent   memberst   membert   pkgt   wct   wc_dir(    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   _run_pkg_dirs<   s8    	
#c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   s£   
    Called first as plugins are initialised. Plugins that need to extend Yum's
    configuration files or command line options should do so during this slot.
    t   mainR.   s   /configN(   t
   confStringt   def_base_dirR   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   config_hookn   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sÿ   
    Called immediately after Yum's config object is initialised. Useful for
    extending variables or modifying items in the config, for example the
    $ variables that are used in repo configuration.
    Note: Only available in yum 3.1.7 or later
    R=   R.   s   /postconfigN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   postconfig_hookx   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sj   
    Called early in Yum's initialisation. May be used for general plugin
    related initialisation.
    R=   R.   s   /initN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt	   init_hookƒ   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   s‹   
    Called just before Yum starts downloads of packages. Plugins may access
    information about the packages to be downloaded here.
    R=   R.   s   /predownloadN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   predownload_hookŒ   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sˆ   
    Called just after Yum finishes package downloads. Plugins may access
    error information about the packages just downloaded.
    R=   R.   s   /postdownloadN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   postdownload_hook•   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sH   
    Called just before Yum initialises its repository information.
    R=   R.   s   /prereposetupN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   prereposetup_hookž   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sG   
    Called just after Yum initialises its repository information.
    R=   R.   s   /postreposetupN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   postreposetup_hook¦   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sv   
    Called after package inclusion and exclusions are processed. Plugins
    may modify package exclusions here.
    R=   R.   s   /excludeN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   exclude_hook®   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   s6   
    Called before Yum begins package resolution.
    R=   R.   s   /preresolveN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   preresolve_hook·   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   s<   
    Called just after Yum finishes package resolution.
    R=   R.   s   /postresolveN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   postresolve_hook¿   s    c         C   s:   |  j  d d t ƒ } t | |  d ƒ t | d |  ƒ d S(   s=   
    Called before Yum begins the RPM update transation.
    R=   R.   t   pretranss	   /pretransN(   R>   R?   R<   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   pretrans_hookÇ   s    c         C   s:   |  j  d d t ƒ } t | |  d ƒ t | d |  ƒ d S(   sG   
    Called just after Yum has finished the RPM update transation.
    R=   R.   t	   posttranss
   /posttransN(   R>   R?   R<   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   posttrans_hookÑ   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sl   
    Called as Yum is performing a normal exit. Plugins may wish to
    perform cleanup functions here.
    R=   R.   s   /closeN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt
   close_hookÛ   s    c         C   s*   |  j  d d t ƒ } t | d |  ƒ d S(   sŠ   
    Called during Yum's cleanup.  This slot will be executed when Yum
    is run with the parameters 'clean all' or 'clean plugins'.
    R=   R.   s   /cleanN(   R>   R?   R   (   R   R.   (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt
   clean_hookä   s    (   R   R   R!   R#   t   yum.pluginsR    R   R   t   requires_api_versiont   plugin_typeR?   R   R<   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   RK   RM   RN   RO   (    (    (    s'   /usr/lib/yum-plugins/universal-hooks.pyt   <module>   s(   0	2	
														
	
		