KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/lib/python2.4/site-packages/rpmUtils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/lib/python2.4/site-packages/rpmUtils/updates.pyo
m
Pc@s;dkZdkZdkZdZdfdYZdS(NcCstii||S(N(trpmUtilst	miscutilst
compareEVRttup1ttup2(RR((t4/usr/lib/python2.4/site-packages/rpmUtils/updates.pyt_vertup_cmpstUpdatescBstZdZdZdZdZdZdZdZdZ	dZ
d	Zd
dZdZ
d
ZdZdZeedZeedZeedZdeedZdeedZdeedZdedZeedZdZRS(sM
    This class computes and keeps track of updates and obsoletes.
    initialize, add installed packages, add available packages (both as
    unique lists of name, epoch, ver, rel, arch 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||_||_h|_d|_h|_h|_	d|_
tdddddddg|_t
ii|_|i|id|_|i|id|_h|_h|_d	|_h|_dS(
Nitkernels
kernel-smptglibcskernel-hugememskernel-enterprises
kernel-bigmemskernel-BOOTi(tinstlisttselft	installedt	availlistt	availabletrawobsoletestNonet_obsoletes_by_nametobsoleted_dicttobsoleting_dictt	exactarchtsett
exactarchlistRtarcht	canonArchtmyarcht
makeNADicttinstalldictt	availdicttupdatesdictt
updating_dicttdebugt	obsoletes(RR
R
((Rt__init__ s							$			cCs\xU|D]M}|i|pqnt|i||||<||p||=qqWdS(N(tkeystkeytdict_thas_keytfiltertvaluet__ne__(RR$R"R'R#((Rt_delFromDict?scCs|\}}}}}|i||foUt|||fi	|||f|||f<|||fp|||f=qn|i|dfoUt|||fi	||df||df<||dfp||df=qndS(N(tpkgtuptntatetvtrR$R%R&R(R(RR$R*R,R-R+R.R/((Rt_delFromNADictGs//cCsE||ijodSn|ii||i|i||i|i|ii	|g||i|i|ii	|g||i
i|o_|ioQx@|i
|D]1\}}}|i|i|g|||fqW|i
|=qn|i|i|ii	|g||i|i|ii	|g|dS(s3remove available pkgtup that is no longer availableN(R*RRtremoveR0RR)RRtgetRR%RtnametflagtversionRR(RR*R4R3R5((Rt
delPackageRs%%
&%cCs|io	|GHndS(N(RRtmsg(RR7((Rt
debugprintes
c	Csh}x|D]\}}}}}|i||fpg|||f<n|||fi|||f|oQ|i|dfpg||df<n||dfi||||fq
q
W|S(sreturn 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(t
returndicttpkglistR+R,R-R.R/R%tappendt	NonelistsR(	RR:R<R,R+R/R9R.R-((RRis +c	Cst|djotidnt|djo|dSn|d\}}}xe|dD]Y\}}}ti
i|||f|||f}|djo|}|}|}q`q`W|||fS(s;takes a list of (e, v, r) tuples and returns the newest oneis%Zero Length List in returnNewest calliN(
tlentevrlistRt
RpmUtilsErrortnew_etnew_vtnew_rR-R.R/RRtrc(	RR>RARBRCR@R.R-R/((RtreturnNewest|s'
c
Csg}d}x|D]}|\}
}}}	}||
joq||jod||	|f}|djpt
||djo|}g}n||jo|i|qqqW|S(sreturns 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(t
returnlistRthigh_vertupR:R*R+R,R-R.R/R3tarchlisttvertupRR;(
RR3RGR:R,R-R/R*RHR.R+RERF((Rt"returnHighestVerFromAllArchsByNames#

cCs\xU|iD]J}t|i|djo*|i|}tii||i|<q
q
WdS(s+remove any accidental duplicates in updatesiN(RRttupR=tmylistRRtunique(RRJRK((RtcondenseUpdatess

icCs|idjolh|_x`|iiD]K\}}x<|D]4\}}}|ii
|gi|||fq<Wq)Wnh}|i
|d}x|D]}|\}}}
}}
x|ii|gD]v\}}	}|ddgjo||djoqntii|||	f|o|i
|gi|qqWqW|i}|o|i|}nh}xR|D]J}xA||D]5}|i"|pg||<n||i|qWq}W|S(saccept a list of packages to check to see if anything obsoletes them
           return an obsoleted_dict in the format of makeObsoletedDictiiN(#RRRRt	iteritemsR*R R3R4R5t
setdefaultR;tobsdictRR:tpkgdictRtepochtvertrelR2tobs_flagtobs_versiont
obsoletingRRt
rangeCheckR"tobslisttnewestt_reduceListNewestByNameArchR9tnewtoldR%(RR:RZR5R]RURSRQRWRVRRR*R RTR\R4R9RRPRYR3((RtcheckForObsoletes>	1$%c
Cs`h}h}xO|iD]D\}}}}}|i	|pg||<n||i
|qWx|iD]}|\}}}}}
x|i|D]\}}\}
}}|ii	|dfox||i|dfD]c\}}}	}|ddgjp7tii|||
||ff||||	|fod}|ii	|dfosxp|i|dfD]W\}}}}|||
f}|||f}|i&||f|jod}PqeqeWn||jo|||jo
d}n|oB|i	|pg||<n||i
||||	|fq9qqWqqWqhW||_'|i(dS(svfigures out what things available obsolete things installed, returns
           them in a dict attribute of the class.iiN()RPt
obs_archesRRR+R,R-R.R/R%R;R*R3RRRRSRTtobs_nR4tobs_etobs_vtobs_rRRtrpm_atrpm_etrpm_vtrpm_rRRRXtwillInstalltins_atins_etins_vtins_rtpkgvertinstalledverRDR tmakeObsoletedDict(RRkRdRSReRRgRRR*RfRTR`RlRaRjR4RiRcRbRPRmR,R_R-R3RnR+R/RhR.((RtdoObsoletessF


1

8	cCsh|_xa|iD]V}xM|i|D]>}|ii|pg|i|<n|i|i|q'WqWh|_xJ|iiD]9\}}x*|D]"}|ii|gi|qWqWdS(screates a dict of obsoleted packages -> [obsoleting package], this
           is to make it easier to look up what package obsoletes what item in 
           the rpmdbN(
RRR R\R]R%R;RRNt	obsoletedtobsoletingsRWRO(RRqR]RrRWR\((RRos	
	c"
Csg}g}h}g}|i}tii|i	}x|iD]\}}|d
jobxX|||fD]F\}}}!}||jo'|||fi|||!|fqmqmWqCn||jo|||f=qCqCqCWx|D]\}}|d
joqn|i|||f\} }}xd|||fD]R\}}!}| ||f||!|fjo$|||fi||!|fq=q=WqWx |D]\}}|d
joqn|ii||fox|i||fD]\}}}
y&|i|||f\}}!}Wntij
o
qqXtii||!|f|||
f}
|
djo>y$|||fi||!|fWqt j
oqXqqWqqWx6|iD](}t"||djo||=qqWx(|D] \}}|d
joqn|ii|d
fog}	g}x1||d
fD]\}}}!}|i%|qPWx4|i|d
fD]\}}}!}|	i%|qWt"|djpt"|	djo"|i&d||i%|q|i&d||i%||fqqWxP|D]H\}}||i'jo%|ii||fo|i|i||f\}}}
|i||fo|i|||f\}}!}tii||!|f|||
f}
|
djoo|i|||||
fpg||||||
f<n||||||
fi%||||!|fq^qbqmq%|i|d
fd\}}}}
|i|d
fox||d
fD]\}}}!}tii||!|f|||
f}
|
djoo|i|||||
fpg||||||
f<n||||||
fi%||||!|fqqWq%q%Wg}tii*d|i	otii+i|i	o|i	g}n|i	tii-|i	g}|i%dtii.|i	d}tii|}t1|t1|g}nt1|g}xK|D]C}x:|D]2}g}xC|i|d
fD].\}}}!}|i%||||!|fqlW|i4|||}|i6|d}||i'jog}x@||d
fD].\}}}!}|i%||||!|fqW|i4|||}|i6|d}x6|D]\}}|i||fo|i&d||f|||fd\}}}
|||fd\}}!}tii||!|f|||
f}
|
djoo|i|||||
fpg||||||
f<n||||||
fi%||||!|fqf	qLqLWqL|i&d|g}x!|D]\}}|i%|q	Wtii;|d	|i	}|d
joqLng}x@||d
fD].\}}}!}|i%||||!|fq	W|i4|||}|i6|d}g}x!|D]\}}|i%|qU
Wtii;|d	|i	}|d
joqLn|||fd\}}}
|||fd\}}!}tii||!|f|||
f}
|
djoo|i|||||
fpg||||||
f<n||||||
fi%||||!|fqLqLWq?W||_<|i=d
S(scheck for key lists as populated then commit acts of evil to
           determine what is updated and/or obsoleted, populate self.updatesdict
        iisputting %s in complex updatesputting %s in simple updateRtnoarchsprocessing %s.%ss
processing %sRN(>tsimpleupdatet
complexupdatet
updatedicttnewpkgsRRRRtgetArchListRRGR"R+R,RR-R.R/R1RDR@RARBRR%ReRfRgR?RRRCt
ValueErrortnakeyR=tinstallarchst
availarchsR;R8RRdt	archliststisMultiLibArchtmultilibArchestbiarchestarchestgetMultiArchInfotmulticompatt
multiarchlistRtthisarchlistttmplistRIthighestinstalledpkgsRthipdictthighestavailablepkgsthapdictt	instarchstgetBestArchFromListRtmakeUpdatingDict("RRGRzRuRRdReRwRR{RgR/RfRCRARRRRvRRRBRR}RR,RR-RtR+RR|R@R.((Rt	doUpdatess<	


+


",
&'
$

&%"'
?#'
?
 	 	'
?
 	
'
;	cCsqh|_xa|iD]V}xM|i|D]>}|ii|pg|i|<n|i|i|q'WqWdS(screates 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(RRRR]R\R%R;(RR\R]((RRs	
c
Csg}	|p|ox|D]\}}}}}|o4||jo#|	i	|||||fqqkn|o4||jo#|	i	|||||fqqqqWn|}	|	S(s?returns a set of pkg naevr tuples reduced based on name or archN(
RER3RR:R+R,R-R.R/R;(
RR:R3RR,R-R+R/R.RE((RtreduceListByNameArchs

c
CsOg}x<|iD]1}
x(|i|
D]}|i||
fq$WqWg}|o]xZ|D]N\\}}}}}	}
||jo&|i|||||	f|
fqYqYWn|o]xZ|D]N\\}}}}}	}
||jo&|i|||||	f|
fqqWnx5|D]-}y|i|Wqtj
oqXqW|S(s`returns updates for packages in a list of tuples of:
          (updating naevr, installed naevr)N(RERRtoldtuptnewtupR;RR3R+R,R-R.R/RtitemR1Ry(
RR3RR,R-RR+RRR/RR.RE((RtgetUpdatesTupless2

.
.	cCsXg}x6|iD]+}x"|i|D]}|i|q$WqW|i|||}|S(s5returns updating packages in a list of (naevr) tuplesN(	RERRRRR;RR3R(RR3RRRRE((RtgetUpdatesList,s
icCs5g}|ii}
|o|i|
}
nx9|
D]1}x(|i|D]}|i	||fqJWq6Wg}|p|ox|D]\}\}}}}
}	|o:||jo)|i	|||||
|	ffqqn|o:||jo)|i	|||||
|	ffqq#qqWn|}|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 somethingN(RRR R"RYRZR[tobstuptrpmtupR;RER3RR+R,R-R.R/(RRZR3RR,RRR+RR/R.R-RERY((RtgetObsoletesTuples:s0
"
"cCs5g}	|ii}|o|i|}nx9|D]1}x(|i|D]}|	i	||fqJWq6Wg}
|p|ox|	D]\\}}}}}
}|o:||jo)|
i	|||||
f|fqqn|o:||jo)|
i	|||||
f|fqq#qqWn|	}
|
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 somethingN(RRR R"RYRZR[RRR;RER3RR+R,R-R.R/tinsttup(RRZR3RR,RRRR+RR/R.R-RERY((RtgetObsoletersTuples]s0
"
"cCsB|ii}|o|i|}n|i|||}|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 somethingN(
RR R"RRZR[RR3RRE(RRZR3RRER((RtgetObsoletesListscCslg}	x_|iD]T}xK|i|D]<}|\}}}
}}||jo|	i|q$q$q$WqW|	S(s:returns a list of pkgtuples obsoleting the package in nameN(RERR R\RR+R,R-R.R/R3R;(RRZR3R,RR+R/R.R\RER-((RtgetObsoletedLists


cCsh}h}g}x|iD]}d||<qWx|iD]}d||<q=WxD|iD]9}|i|o"|i|o|i	|q[q[W|i
|||}|S(sreturns a naevr tuple of the packages that are neither installed
           nor an update - this may include something that obsoletes an installed
           packageiN(tupdatestinstRRRR*RRR%R;RR3RRE(RR3RRERR*RR((Rt
getOthersLists 


"cCsh}
x|D]}	|	\}}}}
}|
i||fp|	|
||f<q
|
||f}|\}}}}}tii||
|f|||f}|djo|	|
||f<q
q
W|
iS(sreturn 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 comparediN(thighdictt	tuplelistR*R+R,R-R.R/R%tpkgtup2tn2ta2te2tv2tr2RRRRCtvalues(RRR,RR-RRCR+RR*R.RR/RRR((RR[s'
(t__name__t
__module__t__doc__R!R)R0R6R8RRDRIRMR^RpRoRRRRRRRRRRRR[(((RRs0										!	.			##
(RtrpmUtils.miscutilst
rpmUtils.archRR(RRR((Rt?s				

Anon7 - 2021