ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ iB^c@`sddlmZddlmZddlmZddlZddlZddlZddlZddlZddl Z ddl m Z ddl mZmZddlmZdd lmZmZmZmZdd lmZdZd efdYZdeeefdYZdS(i(tprint_function(tdivision(tabsolute_importN(tSafeConfigParser(tABCMetatabstractmethod(ttimei(tINSTALLING_STATUStREMOVING_STATUStCACHE_UPDATING_YUM_STATUStAcquireInterpreterLockError(twith_metaclassiitPkgManagerErrorcB`seZRS((t__name__t __module__(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR stBasePkgManagercB`seZdZdZdZdZdZdZdZ dZ dZ dZ e dZedZedZdZdZedZedZdZed Zed Zddd Zd Zd ZdZdZdZdZ dZ!e"j#dZ$e%dZ&e%dZ'e%dZ(dZ)e%dZ*dZ+e%dZ,RS(s Class responsible for all interactions with Yum, interpreter versions installation/removal and gathering info about already installed versions c C`s7ttjd}tj|d|d|d|dtS(Ntwtstdintstdouttstderrtshell(topentostdevnullt subprocesstPopentTrue(tclstcommandtfnull((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytrun_background6scC`so|jdk r|jSt}y)|jtd|jdd}Wntk rat}nX||_|S(Ns /etc/yum.repos.d/cloudlinux.reposcloudlinux-updates-testingtenabled(t_testing_repo_enabled_cachetNoneRtreadfpRt getbooleant ExceptiontFalse(tselftparsertres((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_testing_enabledAs    cC`s5|jrtjj|jdStjj|jdS(Nsyum_cache.dat.testing_enableds yum_cache.dat(R)Rtpathtjoint _config_dir(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_yum_cache_fileOs c C`s|jdks-|jdks-|jdkr9tn|j}|dkr|jjd|jd|jd|jd|j rdnd}|j |}|j |j dt ndS(Ntyum_cmdt alt_namest cache_filetdisable_testingts(--disablerepo=cloudlinux-updates-testingtstatus(t_cache_lock_fileR!t _mk_cache_cmdt_yum_cmdtNotImplementedErrort_read_yum_statustformatt _alt_namesR-R)Rt_write_yum_statustpidR (R&t ongoing_yumt cmd_stringtp((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytupdate_yum_cacheUs-        cC`sXytj|j}Wntk r*dSXt|jtkrEdSt|jj S(s;Return data from file or None if file is absent or outdatedN( RtstatR-tOSErrorR!Rtst_mtimetMAX_CACHE_AGE_SECRtread(R&RA((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_read_yum_cacheds cC`s/ytj|Wnttfk r*nXdS(s* Silently remove file ignoring all errors N(RtremoveRBtIOError(tf((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_remove_silentpscC`s4|jdkr!|j|_nt|jjS(s Returns list of installed interpreter versions by scanning alt_node_dir and cache result. Cache also can be pre-filled at init time for testing/debugging purposes N(t_versions_infoR!t_scan_interpreter_versionstlisttkeys(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytinstalled_versionsxscC`sM|jdkr!|j|_ny|j|dSWntk rH|SXdS(s Should return full interpreter version for a particular major version or just fallback to given version if info is not available for any reason. This information is taken from the hash map populated during installed_packages scan. :param maj: Major interpreter version :return: Full interpreter version or Major if info is not available t full_versionN(RKR!RLtKeyError(R&tmaj((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytget_full_versions  cC`stjj|jdS(Ns yum.pid.lock(RR*R+R,(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_pid_lock_filescC`stjj|jdS(Nsyum_cache.pid.lock(RR*R+R,(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR4scC`smtjj|js"|jntji|d6t|d6|d6tt d6t |j ddS(s :param pid: pid of Yum process :param version: interpreter version or None for "cache update" case :param status: what yum is currently doing(few predefined statuses) :return: None R<tversionR3RtwbN( RR*texistsR,t_create_config_dirstjsontdumptstrtfloatRRRT(R&R<RUR3((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR;s   cC`s4|j}|dk r0dj|d|dSdS(Ns>{} of version '{}' is in progress. Please, wait till it's doneR3RU(R8R!R9(R&R=((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_check_yum_in_progresss  cC`s|jdkrtnytjt|j}Wn"tk r[|j|jdSXtj |j ds|j|jdSy#t j |dt j \}}Wntk r|SX|dkr|S|j|jdS(s Result "None" - means installing/removing of our packages is not currently in progress. However, it doesn't mean that any other yum instance is not running at the same time, but we ok with this because our yum process will start processing automatically once standard /var/run/yum.pid lock is removed by other process :return: None or dict R<iN(RTR!R7RYtloadRR$RJtpsutilt pid_existstgetRtwaitpidtWNOHANGRB(R&tdataR<t_((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR8s$   #  cC`s|jj|S(s Formatting cmd string for installing package :return: formatted cmd string :param version: version of interpreter for installing :rtype: str (t _install_cmdR9(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt format_cmd_string_for_installingscC`s|jj|S(s Formatting cmd string for removing package :return: formatted cmd string :param version: version of interpreter for removing :rtype: str (t _remove_cmdR9(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytformat_cmd_string_for_removingscC`s|j|}|r|S||jkr5dj|S|j}|dkrQdS||krjdj|S|j|}|j|}|j|j|t dS(sReturn None or Error strings!Version "{}" is already installeds^Updating available versions cache is currently in progress. Please, try again in a few minutessGVersion "{}" is not available. Please, make sure you typed it correctlyN( t_verify_actionROR9tcheckout_availableR!RgRR;R<R(R&RUterrt availableR>R?((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytinstall_versions    cC`s|j|}|r|S||jkr5dj|S|j|rHdS|j|r[dS|j|}|j|}|j|j|t dS(sReturn None or Error stringsVersion "{}" is not installedseThis version is currently in use by another operation. Please, wait until it's complete and try againsPIt's not possible to uninstall version which is currently in use by applicationsN( RjROR9tis_interpreter_lockedt_is_version_in_useRiRR;R<R(R&RURlR>R?((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytremove_versions cC`sS|j}|dk rO|dttfkrOii|dd6dd6|d6SdS(sr Should return version and it's status for versions that is currently installing|removing R3R2tbase_dirRUN(R8R!RR(R&R=((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt in_progresss   cc`s|j|}yt|d}Wntk rAt|nXytj|tjtjBWntk rsnXz dVWd|jXdS(NR( t_get_lock_file_pathRRHR tfcntltflocktLOCK_EXtLOCK_NBtclose(R&tinterpreter_versiont lock_nametlf((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytacquire_interpreter_lock's   cC`s tdS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRk>scC`s tdS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRLBscC`s tdS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRXFscC`s}|j|}tjj|s%tSt|d}z7ytj|tjtj BWnt k rit SXWd|j XtS(NR( RtRR*tisfileR%RRuRvRwRxRHRRy(R&RzR{R|((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRoJs   cC`s tdS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRjWscC`s tdS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRt[scC`s tdS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRp^sN(-R Rt__doc__R!R R,RKR5R6R:t _redirect_logRfRht classmethodRtpropertyR)R-R@RFt staticmethodRJRORSRTR4R;R]R8RgRiRnRqRst contextlibtcontextmanagerR}RRkRLRXRoRjRtRp(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR$sH      %     iQ(t __future__RRRRuRRR_Rt simplejsonRYt ConfigParserRtabcRRRR2RRR R t future.utilsR RDR$R tobjectR(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyts       "