ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/update_md.pyc

�
8M�bc@s.dZddlZddlmZmZmZmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlZddlZddlZddlmZed	�Zd
efd��YZdefd
��YZd�Zdefd��YZd�Ze dkr*e�ndS(s+
Update metadata (updateinfo.xml) parsing.
i����N(tutf8_text_wraptto_utf8t
to_unicodet_(t
YumRepository(tFakeRepository(tto_xmlt
decompresstrepo_gen_decompress(tcElementTree_iterparse(tArchStorageccsvy,x%t|�D]\}}||fVqWWnCtk
rq|r[|jtd�|�qrtjdI|IJnXdS(s@ Works like iterparse, but hides XML errors (prints a warning). s$Updateinfo file is not valid XML: %ss!Updateinfo file is not valid XML:N(t	iterparsetSyntaxErrortcriticalRtsyststderr(tfilenametloggerteventtelem((s1/usr/lib/python2.7/site-packages/yum/update_md.pytsafe_iterparse's
tUpdateNoticeExceptioncBseZdZRS(s0 An exception thrown for bad UpdateNotice data. (t__name__t
__module__t__doc__(((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR2stUpdateNoticecBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�ZRS(s@
    A single update notice (for instance, a security fix).
    cCs�idd6dd6dd6dd6dd6dd6dd6dd	6dd
6dd6dd6dd
6dd6dd6dd6gd6gd6td6|_|r�|j|�n||_||_dS(Nttfromttypettitletreleasetstatustversiont	pushcountt	update_idtissuedtupdatedtdescriptiontrightstseveritytsummarytsolutiont
referencestpkglisttreboot_suggested(tFalset_mdt_parset_repoidt_vlogger(tselfRtrepoidtvlogger((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__init__=s.
	cCsNt|�tkr#t|j�|S|jj|�}|dkrJd}n|S(s: Allows scriptable metadata access (ie: un['update_id']). RN(RtinttsortedR.tgettNone(R2titemtret((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__getitem__Ys	cCs
||jkS(s% Allows quick tests for foo in blah. (R.(R2R:((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__contains__bscCs||j|<dS(N(R.(R2R:tval((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__setitem__fscsd�����fd�}�s5t�d�r9tSxHdD]@}|dkrXq@n�j|�j|kr@||�tSq@Wd}�j|�j|kr�j|dkr�||�tS�j|dkr�||�tSd�j|<d�j|<ntS(NcSs-t|d�r%|jdk	r%|jSdSdS(NR0s	<unknown>(thasattrR0R9(tun((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt_ridmscs��jdkrdStd�}|�jd;}|d���|f7}|d�j|�j|f7}|d���|f7}�jjtj|�dS(s=Log the mismatched data similarly to conflict markers in git.Ns(Duplicate of %s differs in some fields:
R"s<<<<<<< %s:%s
s%r
=======
%r
s
>>>>>>> %s:%s(R1R9RR.tlogt
logginglevelstDEBUG_3(tdatatmsg(RBtotherR2(s1/usr/lib/python2.7/site-packages/yum/update_md.pyt_log_failuress"R.RR"RR&R'RR#R$R R!RRR(R%R)tstablettesting(stypes	update_idsstatussrightssseveritysreleasesissuedsupdatedsversions	pushcountsfromstitlessummarysdescriptionssolution(RJRK(RJRK(R@R-R.tTrue(R2RHRIRF((RBRHR2s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__eq__is0	




cCs||kS(N((R2RH((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__ne__�stfilesR(R&R)cCs�d|j}|jdrL|jd|jdkrL|d|jd7}ntd�|jd�}t|�r�d|kr�d}x@|D]8}|d	|d
d|kr�d|dp�d
f7}q�W||d j�d7}ntd�|jd�}t|�rVd|krVd}x |D]}|d|d
7}qW||d j�d7}n|jdr�d|kr�t|jddddd+�}	|ddj|	�7}n|jdr�d|kr�t|jddddd-�}
|ddj|
�7}n|jdrLd|krLt|jddddd/�}	|ddj|	�7}n|jd r�d |kr�t|jd dddd1�}	|d!dj|	�7}n|jd"r�d"|kr�t|jd"dddd3�}	|d#dj|	�7}nd$|kr|d Sttjj	��}d%}xR|jd&D]C}
x:|
d'D].}|d(|krZq>n|d|d)7}q>Wq-W||d j�7}|S(4Ns,
===============================================================================
  %(title)s
===============================================================================
  Update ID : %(update_id)s
    Release : %(release)s
       Type : %(type)s
     Status : %(status)s
     Issued : %(issued)s
R$R#s    Updated : %scSs|ddkS(NRtbugzilla((tr((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt<lambda>�sR*tbugss
       Bugs :s %s%s
	    :tidRs - %sRi����s
cSs|ddkS(NRtcve((RQ((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRR�stcvess
       CVEs :s
 %s
	    :R(twidthi@tsubsequent_indentt is: s    Summary : %s
R%sDescription : %s
R)s   Solution : %s
R&s     Rights : %s
R's   Severity : %s
ROs
      Files :R+tpackagestarchRs            s            : s            s            : s            s            : s            s            : s            s            : (
R.tfiltertlentrstripRtjointsettrpmUtilsR[tgetArchList(R2t	skip_datatheadtbzstbuglisttbzRVtcvelistRURFtdesctarchestfilelisttpkgtfile((s1/usr/lib/python2.7/site-packages/yum/update_md.pyttext�s^

'

					cCst|j��S(N(RRn(R2((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__str__�scCst|j��S(N(RRn(R2((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt__unicode__�scCs|jS(s Return the metadata dict. (R.(R2((s1/usr/lib/python2.7/site-packages/yum/update_md.pytget_metadata�scCs>|jdkr.x'dD]}|jj|�|j|<qWx�|D]�}|jdkr�|jsmtd��n|j|jd<q@|jd	kr�|j|jd	<q@|jd
kr�|jjd�|jd
<q@|jdkr�|jjd�|jd<q@|jd
kr|j|�q@|jdkr9|j|jd<q@|jdkr[|j|jd<q@|jdkr�|j|j|j<q@|jdkr�|j|jd<q@|jdkr�|j|jd<q@|jdkr�|j|�q@|jdkr|j|jd<q@|jdkr@|j|jd<q@q@Wntd��dS(s�
        Parse an update element::

            <!ELEMENT update (id, synopsis?, issued, updated,
                              references, description, rights?,
                              severity?, summary?, solution?, pkglist)>
                <!ATTLIST update type (errata|security) "errata">
                <!ATTLIST update status (final|testing) "final">
                <!ATTLIST update version CDATA #REQUIRED>
                <!ATTLIST update from CDATA #REQUIRED>
        tupdateRRRR RTsNo id element foundR"R!R#tdateR$R*R%R&R'R(R)R+RRsNo update element foundN(sfromstypesstatussversion(ttagtattribR8R.RnRt_parse_referencest_parse_pkglist(R2RRutchild((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR/�sB

	cCstxm|D]e}|jdkr`i}x$d	D]}|jj|�||<q)W|jdj|�qtd��qWdS(
sv
        Parse the update references::

            <!ELEMENT references (reference*)>
            <!ELEMENT reference>
                <!ATTLIST reference href CDATA #REQUIRED>
                <!ATTLIST reference type (self|other|cve|bugzilla) "self">
                <!ATTLIST reference id CDATA #IMPLIED>
                <!ATTLIST reference title CDATA #IMPLIED>
        t	referenceRTthrefRRR*sNo reference element foundN(sidRzstypestitle(RtRuR8R.tappendR(R2RRyRFt	refattrib((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRv"s

cCs�x�|D]�}igd6}d|jkrB|jjd�|d<nxY|D]Q}|jdkrn|j|d<qI|jdkrI|dj|j|��qIqIW|jdj|�qWdS(s'
        Parse the package list::

            <!ELEMENT pkglist (collection+)>
            <!ELEMENT collection (name?, package+)>
                <!ATTLIST collection short CDATA #IMPLIED>
                <!ATTLIST collection name CDATA #IMPLIED>
            <!ELEMENT name (#PCDATA)>
        RZtshorttnametpackageR+N(RuR8RtRnR{t_parse_packageR.(R2Rt
collectionRFR:((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRw6s



!cCs�i}x$d
D]}|jj|�||<q
W|dsL|dddkrYd|d<nx}|D]u}|jd	kr�|j|d	<q`|jd
kr�|jjd�|jf|d
<q`|jdkr`t|jd<q`q`W|S(s~
        Parse an individual package::

            <!ELEMENT package (filename, sum, reboot_suggested)>
                <!ATTLIST package name CDATA #REQUIRED>
                <!ATTLIST package version CDATA #REQUIRED>
                <!ATTLIST package release CDATA #REQUIRED>
                <!ATTLIST package arch CDATA #REQUIRED>
                <!ATTLIST package epoch CDATA #REQUIRED>
                <!ATTLIST package src CDATA #REQUIRED>
            <!ELEMENT reboot_suggested (#PCDATA)>
            <!ELEMENT filename (#PCDATA)>
            <!ELEMENT sum (#PCDATA)>
                <!ATTLIST sum type (md5|sha1) "sha1">
        R[tepochR~R Rtsrcit
0123456789RtsumRR,(sarchR�snamesversionsreleaseR�N(RuR8R9RtRnRLR.(R2RRtpkgfieldRx((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR�Ks


"cCs�dt|jd�t|jd�t|jd�t|jd�t|jd�t|jd�t|jd�t|jd	d
t�t|jd�f	}|jdr�|d
t|jdd
t�7}n|jdr�|dt|jd�7}n|jdr'|dt|jd�7}n|jdrR|dt|jd�7}n|jdr}|dt|jd�7}n|jdrg|d7}x�|jdD]�}|dr|dt|dd
t�t|dd
t�t|dd
t�t|dd
t�f7}q�|dt|dd
t�t|dd
t�t|dd
t�f7}q�W|d7}n|jdr�|d7}x�|jdD]�}|dt|d d
t�t|d!�f7}x�|d"D]�}|d#t|d$d
t�t|d!d
t�t|dd
t�t|d%d
t�t|dd
t�t|d&pFd'd
t�t|d(�f7}q�W|d)7}q�W|d*7}n|d+7}|S(,s.Generate the xml for this update notice objects�
<update from="%s" status="%s" type="%s" version="%s">
  <id>%s</id>
  <title>%s</title>
  <release>%s</release>
  <issued date="%s"/>
  <description>%s</description>
RRRR R"RRR#RuR%R$s <updated date="%s"/>
R(s  <summary>%s</summary>
R)s  <solution>%s</solution>
R&s  <rights>%s</rights>
R's  <severity>%s</severity>
R*s  <references>
s8    <reference href="%s" id="%s" title="%s" type="%s"/>
RzRTs.    <reference href="%s" id="%s"  type="%s"/>
s  </references>
R+s  <pkglist>
s2    <collection short="%s">
      <name>%s</name>
R}R~RZs�      <package arch="%s" name="%s" release="%s" src="%s" version="%s" epoch="%s">
        <filename>%s</filename>
      </package>
R[R�R�t0Rs    </collection>
s
  </pkglist>
s
</update>
(RR.RL(R2RGtreftcollRl((s1/usr/lib/python2.7/site-packages/yum/update_md.pytxmlms\   
$






&1&




N(sfilesssummarysrightsssolution(RRRR9R5R<R=R?RMRNRnRoRpRqR/RvRwR�R�(((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR7s 					3	K				/			"cCs=tjj|d|d|df|d|d|df�S(s- Compare two "std." tuples, (n, a, e, v, r). iii(Rat	miscutilst
compareEVR(ttup1ttup2((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt_rpm_tup_vercmp�s!tUpdateMetadatacBs}eZdZgddd�Zdd�Zee�Zd�Zd�Z	d�Z
dd�Zd�Zd	�Z
dd
�ZRS(s*
    The root update metadata object.
    cCs�i|_i|_i|_g|_||_||_x9|D]1}y|j|�Wq=tjk
rmq=q=Xq=Wt	�|_
|j
j|_dS(N(t_noticest_cachet	_no_cachet_repost_loggerR1taddtErrorstRepoMDErrorR
tarch_storagetarchlist(R2treposRR4trepo((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR5�s						
cCs9|dkr|jj�S||jkr5|j|p8gS(s Return all notices. N(R9R�tvaluesR�(R2R~((s1/usr/lib/python2.7/site-packages/yum/update_md.pytget_notices�s
cCsLt|�tg�td�fkr6dj|�}n|jj|�pKdS(si
        Retrieve an update notice for a given (name, version, release) string
        or tuple.
        t-(N(RR_R�R8R9(R2tnvr((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt
get_notice�s$c
Cs�|}|d}|d}g}g}t�}x+|j|�D]}x|dD]}	x�|	dD]�}
t}|
d|ks�|
d|kr�||kra|
d|kra|
d|jkrat}q�qan|
d|
d|
dp�d|
d	|
d
f}t||�dkrqan|r1|j||f�qa|j||f�|j|�qaWqPWq?Wx6|D].\}}||krd|j||f�qdqdW|jdtdd
�dt�|S(s
        Retrieve any update notices which are newer than a
        given std. pkgtup (name, arch, epoch, version, release) tuple.
        Returns: list of (pkgtup, notice) that are newer than the given pkgtup,
                 in the order of newest pkgtups first.
        iiR+RZR~R[R�R�R RtcmptkeycSs|dS(Ni((tx((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRRstreverse(	R`R�R-R�RLR�R{R�tsort(R2tpkgtupt	oldpkgtupR~R[R;tother_arch_listtnoticestnoticetupkgRlt
other_arch((s1/usr/lib/python2.7/site-packages/yum/update_md.pytget_applicable_notices�s6

	 /	c
Cs�|s|drtS|d|jkrK|j|d}||krJtSt�}x#|dD]}|j|d�q^WxJ|dD]>}|d|kr�q�n|j|d�|dj|�q�Wt�}x#|dD]}|j|d�q�WxJ|dD]>}|d|krqn|j|d�|dj|�qW|}n||j|d<xv|dD]j}xa|dD]U}||jd|d|d|d	f<|jj|dt��}|j|�qxWqgWtS(
sx Add an UpdateNotice object. This should be fully populated with
            data, esp. update_id and pkglist/packages. R"R*RTR+R~RZs%s-%s-%sR R(	R-R�R`R�R{R�R�t
setdefaultRL(R2RAtountseenR�Rltfiledatatno((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt
add_notices<			&t
updateinfocCsetd�d�}|s!t�nd}t|�td�td�fkrit|�}t|d�}n�t|t�r�|j|j	kr|j}|j	j
|j�|j|�}|s�t��nt|d�}t|d�}qn$t|t
�r	tjd�n|}t}xIt|d|j�D]2\}	}
|
jd	kr+yt|
||j�}Wn^tk
r�}td
�||�}
|jr�|jjtjd|
�q+tj|
IJq+nX|j|�s]td�|d
||�f}
|s%|
td�||d�7}
|
td�7}
nt}|jrJ|jjd|
�qZtj|
IJq]q+q+WdS(sA Parse a metadata from a given YumRepository, file, or filename. s
 (from %s)cSs|s
dS||S(NR((R3tfmt((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRB;sRutrtsupdateinfo.xmlsNo updateinfo for local pkgRRrs'An update notice%s is broken, skipping.s%ss;Update notice %s%s is broken, or a bad duplicate, skipping.R"sA
You should report this problem to the owner of the %srepository.s%s sb
To help pinpoint the issue, please attach the output of "yum updateinfo --verbose" to the report.N(RRR9RRtopent
isinstanceRRTR�R{t
retrieveMDRRR�R�R-RR�RtRR1RCRDtDEBUG_1RRR�RLtwarn(R2tobjtmdtypeRBR3tunfiletinfiletmdthave_dupRRRAteRG((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR�8sN	$	"	
 	cCs.d}x!|jD]}|t|�7}qW|S(Nu(R�tunicode(R2R;R�((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRpmscCst|j��S(N(RRp(R2((s1/usr/lib/python2.7/site-packages/yum/update_md.pyRorscCs�d}|r|j|�nxC|jj�D]2}|rN|j|j��q,||j�7}q,Wd}|r~|j|�n
||7}|r�dS|S(Ns<?xml version="1.0"?>
<updates>s</updates>
(twriteR�R�R�(R2tfileobjRGR�tend((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR�us
N(RRRR9R5R�tpropertyR�R�R�R�R�RpRoR�(((s1/usr/lib/python2.7/site-packages/yum/update_md.pyR��s		%	25		cCs�ddl}|jj�d�}ttj�dkrA|�nyItjdGHt�}x"tjdD]}|j|�qgWt|�GHWn=t	k
r�tj
dtjdtjdfIJ|�nXdS(s update_md test function. i����NcSs)tjdtjdIJtjd�dS(NsUsage: %s <update metadata> ...ii(RRtargvtexit(((s1/usr/lib/python2.7/site-packages/yum/update_md.pytusage�siis%s: No such file:'%s'i(tyum.misctmisctsetup_localeR]RR�R�R�R�tIOErrorR(tyumR�tumtsrcfile((s1/usr/lib/python2.7/site-packages/yum/update_md.pytmain�s
	
	
t__main__(!RRtyum.i18nRRRRtyum.yumRepoRtyum.packagesRR�RRRR	RR�RDtrpmUtils.miscutilsRat
rpmUtils.archR
R9Rt	ExceptionRtobjectRR�R�R�R(((s1/usr/lib/python2.7/site-packages/yum/update_md.pyt<module>s&"�u	�	

Zerion Mini Shell 1.0