Ñò
ýÉªWc           @   s²   d  d k  Z  d  d k Z d  d k l Z d  d k l Z d  d k l Z d  d k l Z d  d k l Z d  d k l	 Z	 d  d k
 l
 Z
 d  d	 k l Z d
 e
 f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   InstallComponent(   t   InstallConfigItemPathResolver(   t   InstallConfigFileDirResolver(   t   InstallScriptsPathResolver(   t#   InstallDataPatchSqlFilePathResolver(   t   ComponentPathBuilder(   t   Common(   t   CMSVersionDeploymentPolicyt   InstallConfigObjectConstructorc           B   sh   e  Z d  Z d Z d „  Z d „  Z d d „ Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z RS(   s   config.jsons   remove.jsonc         C   s‹   t  i |  ƒ | i ƒ  |  _ | i |  i ƒ |  _ | i |  i ƒ |  _ | i |  i ƒ |  _ | o | i | ƒ |  _ n t i	 ƒ  |  _ d  S(   N(
   R   t   __init__t   resolveLeavest   fullInstallComponentst   installedComponentst   componentsToDeletet   componentsToInstallt   availableUpgradeComponentsR    t   createEmptyInstallComponent(   t   selfR   R   R   R   R   (    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR	      s    c         C   s   t  } t  } t  } |  i i ƒ  p |  i i ƒ  o
 t } n9 |  i i ƒ  i |  i ƒ } | i	 ƒ  o
 t } n t } | | | f S(   N(
   t   FalseR   t   hasSubComponentExceptBaseR   t   TrueR   t   copyt	   intersectR   t   hasSubComponent(   R   t   isInstallNewOrRemovet   isUpgradeOnlyt   isInvolveNothingt   componentsToUpgrade(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyt   getInstallStatus   s     

c         C   s%   |  i  ƒ  } |  i | i ƒ  | | ƒ S(   N(   t   mergeAllComponentsToHandlet   mergeComponentConfigRecursivelyt   getSubComponents(   R   t
   pathPrefixt   upgradePatht   allComponentsToHandle(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyt   constructFinalJsonObj)   s    c         C   s‰   |  i  i ƒ  i |  i ƒ } |  i  i ƒ  i |  i ƒ i |  i ƒ } | i ƒ  i |  i ƒ i |  i ƒ } |  i | |  i  |  i | | ƒ | S(   N(	   R   R   R   R   t	   substractR   t   mergeR   t   resolveKeywordOfComponent(   R   R   t   newCurrentInstalledComponentsR"   (    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR   -   s
    '$c         C   s,  | i  d j oK | o6 | o | i ƒ  qW | o | o | i ƒ  qW q[ | i ƒ  n | i ƒ  oÀ x½ | i ƒ  D]« } d  } | o | i | i  ƒ } n d  } | o | i | i  ƒ } n d  }	 | o | i | i  ƒ }	 n d  }
 | o | i | i  ƒ }
 n |  i | | | |	 |
 ƒ qu Wn d  S(   Nt   ROOT(	   t   componentNamet   setAsUpgradet   setAsInstallt   setAsDeleteR   R   t   Nonet   getInstallComponentByNameR&   (   R   t   compontsToHandleR   t   componentToInstallt   componentToUpgradet   newInstalledComponentt   subComponentt   subInstalledComponentst   subComponentToInstallt   subComponentToUpgradet   subNewInstalledComponent(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR&   6   s.     c         C   s    h  } x“ | D]‹ } | i  ƒ  o+ |  i | |  i | i ƒ  | | ƒ ƒ } n |  i | | | ƒ } x5 |  i | ƒ D]$ } |  i | |  i | | ƒ ƒ } qp Wq W| S(   N(   R   t   mergeConfigR   R   t   getActualConfigLocationt!   getVersionSpecifiedConfigLocationt   getAndModifyConfigs(   R   t   installComponentsR    R!   t   baset	   componentt
   actualPatht
   configPath(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR   S   s     + &c         C   sä   | i  p h  Sd } | i ƒ  o | |  i } n | |  i } h  } t i i | ƒ ok d | GHt | ƒ } t i	 | ƒ } | i
 ƒ  t ƒ  i | | ƒ t ƒ  i | | ƒ t ƒ  i | | ƒ n t ƒ  i | | | i ƒ  ƒ | S(   Nt    s   merging file: (   t   keyWordt   isDeletet   REMOVE_CONFIG_JSONt   CONFIG_JSONt   ost   patht   existst   opent   jsont   loadt   closeR   t   resolvePathsR   t   resolveScriptPathsR   t   resolveSqlFilePathsR   t   resolveConfigFileDir(   R   R?   R>   t   jsonPatht   componentConfigt	   json_data(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR;   ^   s"    
	
c         C   sé   t  i ƒ  } | g } | d j  oV | d t i } | i | ƒ | d t | ƒ i d d ƒ t i } | i | ƒ nd | d j oV | d t i } | i | ƒ | d t | ƒ i d d ƒ t i } | i | ƒ n | i ƒ  | S(   Ng      @t	   CMS_3_0_1t   CMS_t   .t   _gÍÌÌÌÌÌ@t   CMS_4_X(   R   t   getCMSVersionRF   t   sept   appendt   strt   replacet   reverse(   R   RG   t   currentVersiont
   searchPatht	   commonDirt   specifiedDir(    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR:   w   s    	''
c         C   s@   | i  ƒ  o t i ƒ  o
 d } n t i | | ƒ | i ƒ  S(   NRA   (   t	   isUpgradeR   t   isPatchModeR   t   getComponentsPathPrefixt   getConfigLocation(   R   R>   R    R!   (    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR9   Œ   s    
N(   t   __name__t
   __module__RE   RD   R	   R   R-   R#   R   R&   R   R;   R:   R9   (    (    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyR      s   								(   RF   RJ   R    t   InstallConfigItemResolverR   R   R   R   t   InstallComponentCollectorR   R   R   R   (    (    (    sx   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/InstallConfigObjectConstructor.pyt   <module>   s   