ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/lib/python2.7/site-packages/rpmUtils/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/lib/python2.7/site-packages/rpmUtils/updates.pyc

�
8M�bc@sDddlZddlZddlZd�Zddd��YZdS(i����NcCstjj||�S(N(trpmUtilst	miscutilst
compareEVR(ttup1ttup2((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt_vertup_cmpstUpdatescBseZdZd�Zd�Zd�Zd�Zd�Zdd�Z	d�Z
d�Zd	�Zd
d�Z
d�Zd
�Zd�Zd�Zddd�Zddd�Zddd�Zdddd�Zdddd�Zdddd�Zddd�Zddd�Zd�ZRS(sM
    This class computes and keeps track of updates and obsoletes.
    initialize, add installed packages, add available packages (both as
    unique lists of name, arch, ver, rel, epoch tuples), add an optional dict
    of obsoleting packages with obsoletes and what they obsolete ie::
        foo, i386, 0, 1.1, 1: bar >= 1.1.
    cCs||_||_i|_d|_i|_i|_d|_tdddddddg�|_	t
jj|_
t
jj|j
�|_t
jj|j
�|_t
jj|j
�|_|j|jd�|_|j|jd	d
|j�|_i|_i|_d	|_i|_dS(Nitkernels
kernel-smptglibcskernel-hugememskernel-enterprises
kernel-bigmemskernel-BOOTitfilter(t	installedt	availabletrawobsoletestNonet_obsoletes_by_nametobsoleted_dicttobsoleting_dictt	exactarchtsett
exactarchlistRtarcht	canonArchtmyarchtisMultiLibArcht_is_multilibtgetArchListt	_archlisttgetMultiArchInfot_multilib_compat_archest
makeNADicttinstalldictt	availdicttupdatesdictt
updating_dicttdebugt	obsoletes(tselftinstlistt	availlist((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt__init__ s,										cCsUxN|D]F}||krqnt|j||�||<||s||=qqWdS(N(R	t__ne__(R$tdict_tkeystvaluetkey((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt_delFromDictEs

c	Cs�|\}}}}}xx|dfD]j}||f|kr"t|||fj|||f�|||f<|||fs�|||f=q�q"q"WdS(N(R
R	R((	R$R)tpkgtuptntatetvtrtaa((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt_delFromNADictMs/cCs9||jkrdS|jj|�|j|j|�|j|j|jj|g�|�|j|j|jj|g�|�||jkr�|j	r�x@|j|D]1\}}}|j|j	|g|||f�q�W|j|=q�n|j|j
|jj|g�|�|j|j|j
j|g�|�dS(s3remove available pkgtup that is no longer availableN(RtremoveR5RR-R!R tgetRRRR(R$R.tnametflagtversion((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt
delPackageUs%%	&%cCs|jr|GHndS(N(R"(R$tmsg((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt
debugprinths	c
Cs+i}x|D]\}}}}}	|r@|df|kr@q
n||f|kreg|||f<n|||	f|||fkr�q
n|||fj|||	f�|r
|df|kr�g||df<n||||	f||dfkr�q
n||dfj||||	f�q
q
W|S(s�return lists of (e,v,r) tuples as value of a dict keyed on (n, a)
            optionally will return a (n, None) entry with all the a for that
            n in tuples of (a,e,v,r)N(R
tappend(
R$tpkglistt	NonelistsR	t
returndictR/R0R1R2R3((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyRls  "*c	Cs�t|�dkr!tjd�nt|�dkr;|dS|d\}}}xc|dD]W\}}}tjj|||f|||f�}|dkrY|}|}|}qYqYW|||fS(s;takes a list of (e, v, r) tuples and returns the newest oneis%Zero Length List in returnNewest calli(tlenRt
RpmUtilsErrorRR(	R$tevrlisttnew_etnew_vtnew_rR1R2R3trc((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytreturnNewest�s'
c
Cs�g}d}x�|D]�}|\}}}	}
}||kr||kr|	|
|f}|dksvt||�dkr�|}g}n||kr�|j|�q�qqW|S(s�returns a list of package tuples in a list (n, a, e, v, r)
           takes a package name, a list of archs, and a list of pkgs in
           (n, a, e, v, r) form.iN(R
RR>(
R$R8tarchlistR?t
returnlistthigh_vertupR.R/R0R1R2R3tvertup((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt"returnHighestVerFromAllArchsByName�s
	cCsZxS|jD]H}t|j|�dkr
|j|}tjj|�|j|<q
q
WdS(s+remove any accidental duplicates in updatesiN(R RBRRtunique(R$ttuptmylist((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytcondenseUpdates�s
icCs�|jdkrzi|_x_|jj�D]K\}}x<|D]4\}}}|jj|g�j|||f�q;Wq(Wni}x�|D]�}|d}x�|jj|g�D]k\}	}
}|	dkr�||dkr�q�ntjj	||	|
f|�r�|j|g�j|�q�q�Wq�W|s*iS|j
�}|rN|j|�}ni}
xM|D]E}x<||D]0}||
kr�g|
|<n|
|j|�qlWq[W|
S(s�accept a list of packages to check to see if anything obsoletes them
           return an obsoleted_dict in the format of makeObsoletedDictiN(Ni(RR
Rt	iteritemst
setdefaultR>R7RRt
rangeCheckR*t_reduceListNewestByNameArch(R$R?tnewestR.R#R8R9R:tobsdicttobs_flagtobs_versiont
obsoletingtobslistRAtnewtold((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytcheckForObsolete�s4	

%$

cCs<i}i}xJ|jD]?\}}}}}||krDg||<n||j|�qWx�|jD]�}|\}	}
}}}
x�|j|D]�\}}\}}}|df|jkr�xa|j|dfD]I\}}}}|dks!tjj|||||ff|||||f�r�d}|	df|jkr�xm|j|	dfD]U\}}}}|||
f}|||f}|j||f�|krPd}PqPqPWn||
kr�|||	kr�d}n|r||kr�g||<n||j|||||f�qq�q�Wq�q�WqcW||_|j	�dS(svfigures out what things available obsolete things installed, returns
           them in a dict attribute of the class.iiN(Ni(
RR>R
RRRRURIR#tmakeObsoletedDict(R$RXt
obs_archesR/R0R1R2R3R.R8Rtepochtvertreltobs_nR9tobs_etobs_vtobs_rtrpm_atrpm_etrpm_vtrpm_rtwillInstalltins_atins_etins_vtins_rtpkgvertinstalledver((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytdoObsoletes�s<

&&&	
5	cCs�i|_x\|jD]Q}xH|j|D]9}||jkrLg|j|<n|j|j|�q'WqWi|_xJ|jj�D]9\}}x*|D]"}|jj|g�j|�q�Wq�WdS(s�creates a dict of obsoleted packages -> [obsoleting package], this
           is to make it easier to look up what package obsoletes what item in 
           the rpmdbN(RR#R>RRSRT(R$R]R^t	obsoletedtobsoletingsR[((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyR`s		
c"
s�
g}g}i}|j}|j}x9|j�D]+\}}||kr1|||f=q1q1q1Wx�|D]�\}}|j|||f�\}}	}
xc|||fD]P\}}}
||	|
f|||
fkr�|||fj|||
f�q�q�WqgWx|D]�\}}||f|jkrx�|j||fD]�\}}}y&|j|||f�\}}}
Wntjk
r�q;q;Xtjj	|||
f|||f�}|dkr;y$|||fj|||
f�Wq�t
k
r�q�Xq;q;WqqWxS|j�D]E�t�fd�|��}|j�dd
fg�j|�qWx4|j�D]&}t||�dkrf||=qfqfWx|D]\}}|d
kr�q�n|d
f|jkr�g}g}x1||d
fD]\}}}}
|j|�q�Wx4|j|d
fD]\}}}}
|j|�qWt|�dkset|�dkr�|jd|�|j|�q�|jd|�|j||f�q�q�Wx1|D])\}}||jkr�||f|jkr�|j|j||f�\}}}||f|kr�|j|||f�\}}}
tjj	|||
f|||f�}|dkr�|||||f|kr�g||||||f<n||||||fj|||||
f�q�q�q�q�|j|d
fd\}}}}|d
f|kr�x�||d
fD]�\}}}}
tjj	|||
f|||f�}|dkr,|||||f|kr�g||||||f<n||||||fj|||||
f�q,q,Wq�q�Wg}|jr{|jtjjkr|jg}n|jtjj|jg}|jd�|jd}tjj|�}t|�t|�g}nt|�g}x2|D]*}x!|D]}g}xC|j|d
fD].\}}}}
|j|||||
f�q�W|j|||�}|j|d�}||jkr�g}x@||d
fD].\}}}}
|j|||||
f�q=W|j|||�}|j|d�} x|D]\}}||f| kr�|jd||f�|||fd\}}}| ||fd\}}}
tjj	|||
f|||f�}|dkr�|||||f|krvg||||||f<n||||||fj|||||
f�q�q�q�Wq�|jd|�g}!x!|D]\}}|!j|�q�Wtjj|!d	|j�}|d
kr	q�ng}x@||d
fD].\}}}}
|j|||||
f�q1	W|j|||�}|j|d�} g}x!| D]\}}|j|�q�	Wtjj|d	|j�}|d
kr�	q�n|||fd\}}}| ||fd\}}}
tjj	|||
f|||f�}|dkr�|||||f|kr�
g||||||f<n||||||fj|||||
f�q�q�Wq�W||_|j�d
S(s�check for key lists as populated then commit acts of evil to
           determine what is updated and/or obsoleted, populate self.updatesdict
        ics �d|d|d|dfS(Niii((tx(tna(s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt<lambda>Qsisputting %s in complex updatesputting %s in simple updatetnoarchsprocessing %s.%ss
processing %sRN( RRR*RIR6RRRCRRt
ValueErrortmapRTR
textendRBR>R=RRRRtmultilibArchestarchesRRRRNRtgetBestArchFromListR tmakeUpdatingDict("R$tsimpleupdatet
complexupdatet
updatedicttnewpkgsRJR/R0RERFRGR1R2R3RjRkRlRHt
all_archestnakeytinstallarchst
availarchsRit	archliststbiarchestmulticompatt
multiarchlisttthisarchlistttmplistthighestinstalledpkgsthipdictthighestavailablepkgsthapdictt	instarchs((Rxs4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt	doUpdatess		

"!+#&'$
'#&$%"';##'=	



& 	# 	'<# 	':	cCsli|_x\|jD]Q}xH|j|D]9}||jkrLg|j|<n|j|j|�q'WqWdS(s�creates a dict of available packages -> [installed package], this
           is to make it easier to look up what package  will be updating what
           in the rpmdbN(R!R R>(R$R^R]((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyR��s	c
Cs�g}|s|r�x�|D]�\}}}}}	|re||kre|j|||||	f�qqen|r||kr�|j|||||	f�qq�qqWn|}|S(s?returns a set of pkg naevr tuples reduced based on name or arch(R>(
R$R?R8RRKR/R0R1R2R3((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytreduceListByNameArch�s	c
CsEg}x<|jD]1}x(|j|D]}|j||f�q$WqWg}|r�xW|D]L\\}}}	}
}}||krX|j|||	|
|f|f�qXqXWn|rxW|D]L\\}}}	}
}}||kr�|j|||	|
|f|f�q�q�Wnx3|D]+}y|j|�Wqtk
r<qXqW|S(s`returns updates for packages in a list of tuples of:
          (updating naevr, installed naevr)(R R>R6R{(
R$R8RRKtoldtuptnewtupR�R/R0R1R2R3titem((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetUpdatesTupless&",",

cCsXg}x6|jD]+}x"|j|D]}|j|�q$WqW|j|||�}|S(s5returns updating packages in a list of (naevr) tuples(R R>R�(R$R8RRKR�R�((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetUpdatesList,sic	Cs(g}|jj�}|r-|j|�}nx9|D]1}x(|j|D]}|j||f�qHWq4Wg}|s{|rx�|D]�\}\}	}
}}}
|r�||	kr�|j||	|
|||
ff�q�q�n|r�||
kr|j||	|
|||
ff�q�qq�q�Wn|}|S(sAreturns obsoletes for packages in a list of tuples of:
           (obsoleting naevr, installed naevr). You can specify name and/or
           arch of the installed package to narrow the results.
           You can also specify newest=1 to get the set of newest pkgs (name, arch)
           sorted, that obsolete something(R#R*RVR>(R$RWR8RR�R\tobstuptrpmtupRKR/R0R1R2R3((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetObsoletesTuples:s(
""	"cCs(g}|jj�}|r-|j|�}nx9|D]1}x(|j|D]}|j||f�qHWq4Wg}|s{|rx�|D]�\\}	}
}}}
}|r�||	kr�|j|	|
|||
f|f�q�q�n|r�||
kr|j|	|
|||
f|f�q�qq�q�Wn|}|S(sBreturns obsoletes for packages in a list of tuples of:
           (obsoleting naevr, installed naevr). You can specify name and/or
           arch of the obsoleting package to narrow the results.
           You can also specify newest=1 to get the set of newest pkgs (name, arch)
           sorted, that obsolete something(R#R*RVR>(R$RWR8RR�R\R�R�RKR/R0R1R2R3tinsttup((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetObsoletersTuples]s(
""	"cCs@|jj�}|r'|j|�}n|j|||�}|S(s^returns obsoleting packages in a list of naevr tuples of just the
           packages that obsolete something that is installed. You can specify
           name and/or arch of the obsoleting packaging to narrow the results.
           You can also specify newest=1 to get the set of newest pkgs (name, arch)
           sorted, that obsolete something(R#R*RVR�(R$RWR8RR�RK((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetObsoletesList�s
cCsjg}x]|jD]R}xI|j|D]:}|\}}}}	}
||kr$|j|�q$q$q$WqW|S(s:returns a list of pkgtuples obsoleting the package in name(R#R>(R$RWR8RKR]R�R/R0R1R2R3((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pytgetObsoletedList�s
cCs�i}i}g}x|j�D]}d||<qWx|jD]}d||<q=Wx9|jD].}||kr[||kr[|j|�q[q[W|j|||�}|S(s�returns a naevr tuple of the packages that are neither installed
           nor an update - this may include something that obsoletes an installed
           packagei(R�R
RR>R�(R$R8RtupdatestinstR�R.RK((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt
getOthersList�scCs�i}t}x�|D]�}|\}}}}}	||f|krS||||f<q|||f}
t}|
\}}}
}}tjj|||	f|
||f�}|dkr||||f<qqW|s�|S|j�S(s�return list of newest packages based on name, arch matching
           this means(in name.arch form): foo.i386 and foo.noarch are not 
           compared to each other for highest version only foo.i386 and 
           foo.i386 will be comparedi(tFalsetTrueRRRtvalues(R$t	tuplelistthighdicttdoneR.R/R0R1R2R3tpkgtup2tn2ta2te2tv2tr2RH((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyRV�s
'N(t__name__t
__module__t__doc__R'R-R5R;R=R
RRIRNRRR_RtR`R�R�R�R�R�R�R�R�R�R�RV(((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyRs0	%								#	.		�	##
((RtrpmUtils.miscutilst
rpmUtils.archRR(((s4/usr/lib/python2.7/site-packages/rpmUtils/updates.pyt<module>s	

Zerion Mini Shell 1.0