v_c@s]ddlZddlZddlmZmZddlTddlmZddl Z ddl Z ddl Z d"Z d Zd Zd Zd ZdZdZdZdZdZddZdZdZdZdZdZdZdZdZ dZ!dZ"ddZ#ddZ$dd Z%gd!Z&dS(#iN(t_tP_(t*(tINFO_1tsecuritytbugfixt enhancementt recommendedt newpackagecCs=tjj|d|d|df|d|d|dfS(s- Compare two "std." tuples, (n, a, e, v, r). iii(trpmUtilst miscutilst compareEVR(ttup1ttup2((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_rpm_tup_vercmps!cCs|s gS|S(sj Sometimes refs == None, if so return the empty list here. So we don't have to check everywhere. ((trefs((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_ysp_safe_refsscCsx|D]}tj||r#|Stj|d|r=|S|}|jdp^|jdsnd|}nxbt|dD]P}|ddkrqntj|d|r|Stj|d|r|SqWqWdS(Nt update_idsCVE-Rt referencestid(tfnmatcht startswithRtNone(tsec_cmdstpkgnametnoticetitcveitref((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_match_sec_cmd#s    cCsZxSt|D]E}|d|kr)q n|d|kr?q nt|||d<|SWdS(s# Check if the given ID is a match. ttypeRN(RtTrueR(tused_mapRtref_typetref_idsR((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_has_id6scCst|j||}|r-t|d|s(RVtuptgetUpdatesTuplesRf(Rbtoupdates((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_get_name2oldpkgtupscCst||jjS(s) Get the pkgtups for all installed pkgs. (Rftrpmdbt simplePkgList(Rb((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_get_name2instpkgtupscCsFg|jjD]#}|d|ddddf^q}t||S(sa Get the pkgtups for all installed pkgs. and munge that to be the first possible pkgtup. iit0(RmRnRf(Rbtpttofirst((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_get_name2allpkgtups9cCsFg|jjD]#}|d|ddddf^q}t||S(sa Get the pkgtups for all available pkgs. and munge that to be the first possible pkgtup. iiRp(tpkgSackRnRf(RbRqRr((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_get_name2aallpkgtup s9cCsG|d}x6|j|D]%\}}t||||rtSqWtS(sA Do we want to keep this package to satisfy the security limits. i(tget_applicable_noticesR/RR,(R-Retmd_infoR tnameR((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_ysp_should_keep_pkgs  cCs~t}xq|D]i}y|jjd}Wn q nX|jdtjj|jd}tjj|s t }Pq q W|S(Nt updateinfot/i( RtrepoXMLtgetDatatcachedirtostpathtbasenametlocationtexistsR,(trepostdledtrepotdataR((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_repos_downloaded"s $c Cstj|j}|ddkr&dSt}x|j|D]\}}|s<|ddkrdq<nt}|jj|}|sq<n|d}d}|ddkrd|d}nd|d||d |d |d f} |t d ||t d | Pq<WdS(NiRRtiRps%s:s %s-%s%s-%s.%siiis,Security: %s is an installed security updates-Security: %s is the currently running version( R9tget_running_kernel_pkgtupttsRR,RvRRmtsearchPkgTupleR( tybRwR`t kern_pkgtupt found_secReRtipkgtetrpkg((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt_check_running_kernel2s*  csfd}|dkr*j}nt|}t|rFdSj}d}d}t|}jj}t} tt t g} t} x0|D](} | j | kr| j | j qqWt} x|D]} | j | kr |d7}n| j j}|| kst|| ||| rAqn| j | kr]|d7}n| j | j qW|}t}x|r`t}x|D]} | j | krx| jD]G\}}|| kr|| kr|d7}n| j |t}qqWqxV| jD]K\}}|| kr || kr;|d7}n| j | j t}Pq q WqWqWx*|D]"} | j | krh|| qhqhWt|fd|rjjttd||||fnjjttd||||fS( sJ Remove packages from the transaction, using the updateinfo data. cs@jjttd|j|jjfj|jdS(s) Deletes a package within a transaction. s$ --> %s from %s removed (updateinfo)N(tverbose_loggertlogRRtpot ui_from_repotremoveRe(ttspkg(Rbttsinfo(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt ysp_del_pkgQs  iicsjjd|S(Ns%s(Rtwarn(Rg(Rb(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRhssD%d package(s) needed (+%d related) for security, out of %d availables6No packages needed for security; %d packages availableN(iii(RR<R^R4tupinfoR_ttsInfot getMembersRXtTS_INSTALL_STATEStTS_ERASEt output_statetaddRRlRxRyRR,t relatedtoRaRRRR(RbRJRR-RwttottcntR ttspkgst keep_pkgst count_statest count_pkgsRRdRxtscnttmini_depsolve_againRtreason((RbRs2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt remove_txmbrsLsp                           -csdfd}|d kr*j}nt|}t|rFdSj}t|}ttjddj jddj }j j }t }g} xS|D]K} | j} | |kst||| || r| j| jqqqW| rEx6jddd| d tjD]} || q.Wnttjddj jddj } t|fd | rjjttd | |fnjjttd || |fS(sM Exclude all packages to do with updates, using the updateinfo data. Rzcs@jjttd||j|f|jjj|dS(s7 Deletes a package from all trees that yum knows about s --> %s from %s excluded (%s)N(RRRRtrepoidRtsackt delPackage(tpkgR(Rb(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRs  it pkgnarrowtupdatest obsoletest availabletpatternstshowdupscsjjd|S(Ns%s(RR(Rg(Rb(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRhss6%d package(s) needed for security, out of %d availables6No packages needed for security; %d packages availableN(ii(RR<R^R4RR_tlenRXtdoPackageListsRRRttreturnPackagesRlRxRytappendRRRaRRRR(RbRJRR-RwR RtpkgsRdt pkgs_to_delRRxtpR((Rbs2/usr/lib/python2.7/site-packages/yum/updateinfo.pytexclude_updatess:           (&c sOdfd}|dkr*j}nt|}t|rFd Sj}t|}jj}t}d}d} xa|D]Y} |d7}| j } | |kst ||| || r|| qn| d7} qWt |fd| r(j j ttd| |fnj j ttd|| |fS( s: Exclude all packages, using the updateinfo data. Rzcs@jjttd||j|f|jjj|dS(s7 Deletes a package from all trees that yum knows about s --> %s from %s excluded (%s)N(RRRRRRRR(RR(Rb(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRs  iicsjjd|S(Ns%s(RR(Rg(Rb(s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRhss6%d package(s) needed for security, out of %d availables6No packages needed for security; %d packages availableN(ii(RR<R^R4RR_RtRRuRxRyRaRRRR( RbRJRR-RwR RRdRRRRx((Rbs2/usr/lib/python2.7/site-packages/yum/updateinfo.pyt exclude_alls2            &c Cs4g}t|j}t|j}t|}td|jj}xt|D]}|jj |}|r|j nx|D]\} } | d} |rt || |  rqn| rt || | | rqn|j |jd| dd| dd| dd| d d | d PqWqXW|S( sMark the specified items to be updated, in the minimal way. :param extcmds: the user specified arguments :return: a list of transaction members added to the transaction set by this function cSs|dS(Ni((Rg((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pyRhsiRxtarchitepochitversionitreleasei(R_R<R^R4RVRiRjtsortedRRvtreverseRR/textendtupdate( RbtextcmdsttxmbrsR R-tndataRkt oldpkgtupRReRRx((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pytupdate_minimals*   #  (ssecuritysbugfixRRR('tos.pathRROtyum.i18nRRt yum.constantstyum.logginglevelsRtrpmUtils.miscutilsR R9RR0RRRR#R/R3R4R=RNRR^R_RaRfRlRoRsRuRyRRRRRR(((s2/usr/lib/python2.7/site-packages/yum/updateinfo.pytsB             5 "          T 4 .