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/yum/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/lib/python2.4/site-packages/yum/packageSack.pyo
m
Pc@sdZdklZdkZdkZdkZdkZdklZde	fdYZ
de
fdYZde
fd	YZd
Z
dZdefd
YZdS(s;
Classes for manipulating and querying groups of packages.
(sPackageSackErrorN(s
parsePackagestPackageSackBasecBstZdZdZdZdZdZdZdZdZ	e
e
e
e
e
dZgd	Zd
Z
dZe
e
e
e
e
e
dZe
e
e
e
fd
Ze
e
e
e
fdZdZdZdZdZedZdZdZdZdZe
e
edZe
e
edZe
e
edZe
edZdZ dZ!dZ"dZ#d Z$e
d!Z%RS("s8Base class that provides the interface for PackageSacks.cCs
h|_dS(N(tselftadded(R((t3/usr/lib/python2.4/site-packages/yum/packageSack.pyt__init__scCst|iS(N(tlenRtreturnPackages(R((Rt__len__!scCs8|i}t|do|iSnt|SdS(Nt__iter__(RRtretthasattrRtiter(RR	((RR$scCs|djodSnt|i}t|i}t|t|jot|t|SnxGtt	|t	|D]*\}}t||}|o|SqqWdS(Nii(tothertNonetlistRRts_reposto_reposRtziptsortedts_repoto_repotcmpR	(RRRRRR	R((Rt__cmp__+s
cCs
tdS(N(tNotImplementedError(RtcompatArchs((RtsetCompatArchs9scCs
tdS(N(R(Rtrepotmdtypetcallbackt	cacheOnly((Rtpopulate<scCs#tidtdd|i|S(s5return a list of package objects by (n,a,e,v,r) tuples;packagesByTuple() will go away in a future version of Yum.
t
stackleveliN(twarningstwarntDeprecationWarningRtsearchPkgTupletpkgtup(RR$((RtpackagesByTuple?s	
cCs
tdS(s6return list of pkgobjects matching the nevra requestedN(R(Rtnametepochtvertreltarch((RtsearchNevraGscCs
tdS(N(R(Rtnames((RtsearchNamesKscCs7|id|id|id|id|id|iS(srreturn list of package objects matching the name, epoch, ver, rel,
           arch of the package object passed inR&R'R(R)R*N(RR+tpoR&R'R(R)R*(RR.((RtsearchPONs!cCs=|\}}}}}|id|d|d|d|d|S(s7return list of pkgobject matching the (n,a,e,v,r) tupleR&R*R'R(R)N(R$tntatetvtrRR+(RR$R1R2R0R3R4((RR#UscCsf|o1|i}|i}|i}|i}|i}nt|i
d|d|d|d|d|S(spreturn if there are any packages in the sack that match the given NAEVR 
           or the NAEVR of the given poR&R*R'R(R)N(R.R&R*R'tversionR(treleaseR)tboolRR+(RR&R*R'R(R)R.((RtcontainsZs				
cCs
tdS(s5return dict { packages -> list of matching provides }N(R(RR&tflagsR5((RtgetProvidesescCs
tdS(s5return dict { packages -> list of matching requires }N(R(RR&R9R5((RtgetRequiresiscCs
tdS(s<return list of package requiring the name (any evr and flag)N(R(RR&((RtsearchRequiresmscCs
tdS(s<return list of package providing the name (any evr and flag)N(R(RR&((RtsearchProvidesqscCs
tdS(sCreturn list of package conflicting with the name (any evr and flag)N(R(RR&((RtsearchConflictsuscCs
tdS(s=return list of package obsoleting the name (any evr and flag)N(R(RR&((RtsearchObsoletesyscCs
tdS(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]N(R(Rtnewest((RtreturnObsoletes}scCs
tdS(s#return list of packages by filenameN(R(RR&((RtsearchFilesscCs
tdS(s"add a pkgobject to the packageSackN(R(Rtobj((Rt
addPackagescCs
tdS(sbuilds the useful indexes for searching/querying the packageSack
           This should be called after all the necessary packages have been
           added/deletedN(R(R((RtbuildIndexesscCs
tdS(sdelete a pkgobjectN(R(RRC((Rt
delPackagescCs
tdS(sreturn list of all packagesN(R(Rtrepoidtpatternstignore_case((RRscCs
tdS(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 comparedN(R(RtnaTupRHRI((RtreturnNewestByNameArchscCs
tdS(sreturn list of newest packages based on name matching
           this means(in name.arch form): foo.i386 and foo.noarch will
           be compared to each other for highest versionN(R(RR&RHRI((RtreturnNewestByNamescCs
tdS(s,returns a list of pkg tuples (n, a, e, v, r)N(R(RRHRI((Rt
simplePkgListscCs
tdS(N(R(R((Rt
printPackagesscCs
tdS(sDexclude incompatible arches. archlist is a list of compatible archesN(R(Rtarchlist((RtexcludeArchsscCs
tdS(N(R(Rtfieldstcriteria_reR((RtsearchPackagesscCs
tdS(N(R(Rtargt
query_type((Rt	searchAllscCsg}g}t|}h}xN|D]F}ti|o&t	i
|}ti
|||<q%|||<q%WxS|iD]E}|\}
}	}}}t|
d|
|	fd|
|||	fd|
|fd|
||fd||
|||	fd|
||||	ff}x|iD]\}
}|
|jo<||jo+|i|i|d|i|
qqxI|D]A}
|i|
o+|i|i|d|i|
qxqxWqWq|Wti|ti|t|fS(	s{take a list strings and match the packages in the sack against it
           this will match against:
           name
           name.arch
           name-ver-rel.arch
           name-ver
           name-ver-rel
           epoch:name-ver-rel.arch
           name-epoch:ver-rel.arch
           
           return [exact matches], [glob matches], [unmatch search terms]
           s%s.%ss%s-%s-%s.%ss%s-%ss%s-%s-%ss%s:%s-%s-%s.%ss%s-%s:%s-%s.%siN( tmatchedt
exactmatchtsettpkgspecst	unmatchedtspecstptmisctre_globtfnmatcht	translatetrestringtretcompileRRMR$R0R1R2R3R4R,titemsttermtquerytappendR#tdiscardtmatchtuniqueR(RRZR,RgR\R[R$RbRWR1RfR2RXR0R]R4R3((RtmatchPackageNamess6
x



c
Cs2d}h}g}xq|id|D]]}|ipq(nxC|iD]8}|i	|pt
||<n||i|qIWq(Wx|id|D]}d}	xa||D]S}|i	|o=||}t|djp
||jo|	d7}	PqqqW|	djo|i|qqW|S(sjreturns a list of package objects that are not required by
           any other package in this repositoryccsdx|iD]
}|Vq
Wx|iD]
}|Vq"Wx|iD]
}|Vq:Wx|iD]
}|VqRWdS(s& Return all the provides, via. yield. N(R.tprovides_namestprovtfilelisttdirlistt	ghostlist(R.Rn((Rt_return_all_providess



RGiiN(RrtreqtorphansRRRGR.trequires_namesR4thas_keyRYtaddtpreqR]tsRRh(
RRGRrRtRsR]RyR4R.Rx((RtreturnLeafNodess4	



 


(&t__name__t
__module__t__doc__RRRRRRR%R
R+R-R/R#R8R:R;R<R=R>R?tFalseRARBRDRERFRRKRLRMRNRPRSRVRlRz(((RRsD																						2tMetaSackcBsytZdZdZdZdZdZdZdZdZ	e
e
e
e
e
dZgd	Ze
e
e
e
fd
Z
e
e
e
e
fdZdZd
ZdZdZedZdZdZdZdZe
e
edZe
e
edZe
e
edZe
edZdZdZdZdZ dZ!dZ"dZ#RS( sqRepresents the aggregate of multiple package sacks, such that they can
       all be treated as one unified sack.cCs#ti|h|_d|_dS(N(RRRtsacksR
tcompatarchs(R((RRs
	cCs:d}x-t|iiD]}|t|7}qW|S(Ni(R	RRRtvaluestsackR(RRR	((RRs
cCs<x5|iiD]$}t|do|iqqWdS(NtdropCachedData(RRRRR
R(RR((RR%scCs!||i|<|i|idS(s1Adds a repository's packageSack to this MetaSack.N(RRRRGRR(RRGR((RtaddSack*s
cCs$|i|ii||||dS(N(RRRtidRRRR(RRRRR((RR1scCs+x$|iiD]}|i|qWdS(N(RRRRRR(RRR((RR4scCs&tidtdd|id|S(s5return a list of package objects by (n,a,e,v,r) tuples;packagesByTuple() will go away in a future version of Yum.
RiR%N(R R!R"Rt_computeAggregateListResultR$(RR$((RR%8s	
cCs|id|||||S(s6return list of pkgobjects matching the nevra requestedR+N(RRR&R'R(R)R*(RR&R'R(R)R*((RR+>scCs|id|S(NR-(RRR,(RR,((RR-BscCs|id|||S(s5return dict { packages -> list of matching provides }R:N(Rt_computeAggregateDictResultR&R9R5(RR&R9R5((RR:EscCs|id|||S(s5return dict { packages -> list of matching requires }R;N(RRR&R9R5(RR&R9R5((RR;IscCs|id|S(s<return list of package requiring the name (any evr and flag)R<N(RRR&(RR&((RR<MscCs|id|S(s<return list of package providing the name (any evr and flag)R=N(RRR&(RR&((RR=QscCs|id|S(sCreturn list of package conflicting with the name (any evr and flag)R>N(RRR&(RR&((RR>UscCs|id|S(s=return list of package obsoleting the name (any evr and flag)R?N(RRR&(RR&((RR?YscCs|p|idSn|id}td|iD}g}x,|D]$}||jo|i	|qPqPWx|D]
}||=qW|S(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]RAccsx|]
}|iVqWdS(N(t[outmost-iterable]tpkgR$(RR((Rt<generator expression>fsN(
R@RRtobsdictRYRLtnewest_tupsttogotobstupRh(RR@RRRR((RRA]s
cCs|id|S(s#return list of packages by filenameRBN(RRR&(RR&((RRBsscCsdS(saAdd a pkgobject to the packageSack.  This is a meaningless operation
           for the MetaSack.N((RRC((RRDwscCs(x!|iiD]}|iqWdS(sbuilds the useful indexes for searching/querying the packageSack
           This should be called after all the necessary packages have been
           added/deletedN(RRRRRE(RR((RRE|scCs|iii|dS(s2Delete a pkgobject if it exists in every sub-sack.N(RCRRRF(RRC((RRFscCs>|p|idd||Sn|i|id|d|S(s2return list of all packages, takes optional repoidRRHRIN(RGRRR
RHRIRR(RRGRHRI((RRs	cCsk|i}|d|||}t|}|o5|p|o'di|pg}t
d|n|S(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 comparedRKs, sNo Package Matching %sN(RRtcalrRJRHRItpkgstpackagesNewestByNameArchtjointui_patstPackageSackError(RRJRHRIRRR((RRKs	cCsv|id|||}t|}|oF|p|o8|o
|}ndi|pg}t	d|n|S(sreturn list of newest packages based on name matching
           this means(in name.arch form): foo.i386 and foo.noarch will
           be compared to each other for highest versionRLs, sNo Package Matching %sN(
RRR&RHRIRtpackagesNewestByNameRRR(RR&RHRIRR((RRLs
cCs|id||S(s,returns a list of pkg tuples (n, a, e, v, r)RMN(RRRHRI(RRHRI((RRMs	cCs(x!|iiD]}|iqWdS(N(RRRRRN(RR((RRNscCs+x$|iiD]}|i|qWdS(sDexclude incompatible arches. archlist is a list of compatible archesN(RRRRRPRO(RROR((RRPscCs|id|||S(NRS(RRRQRRR(RRQRRR((RRSscCs|id||S(NRV(RRRTRU(RRTRU((RRVsc	Cs#g}g}d}x|iiD]}t|doggg}}}y|i|\}}}Wntj
o
q"nX|i||i||djot|}q|it|}q"q"Wti|}ti|}|djo
g}n
t|}|||fS(NRl(RWRXR
R[RRRRR
R2tmtuRlRZRtextendRYtintersectionR^RkR(	RRZRR2RR[RRXRW((RRls,




cGsg}xt|iiD]m}t||oWt||}yt
||}Wnt
j
o
qnX|o|i|qqqW|S(N(tresultRRRRRR
t
methodNametgetattrtmethodtapplytargst
sackResultRR(RRRRRRR((RRscGsh}xt|iiD]m}t||oWt||}yt
||}Wnt
j
o
qnX|o|i|qqqW|S(N(RRRRRRR
RRRRRRRtupdate(RRRRRRR((RRs($R{R|R}RRRRRRR%R
R+R-R:R;R<R=R>R?R~RARBRDRERFRRKRLRMRNRPRSRVRlRR(((RRs@																					tPackageSackcBsgtZdZdZdZddZdZdZeeeeedZ	eeeefdZ
eeeefd	Zd
ZdZ
dZd
ZedZdZdZdZdZdZdZdZdZdZeeedZeeedZeeedZeedZdZdZ dZ!RS(s*represents sets (sacks) of Package ObjectscCs^h|_h|_h|_h|_h|_h|_h|_h|_d|_
d|_dS(Ni(Rtnevrat	obsoletestrequirestprovidest	conflictst	filenamest
pkgsByRepotpkgsByIDR
RtindexesBuilt(R((RRs									cCs5d}x(|iD]}|t|i|7}qW|S(Ni(R	RRRR(RRR	((RR
s

terrorcCsG|ip9|djo
tdqC|djo|iqCndS(scheck to see if the indexes are built, if not do what failure demands
           either error out or build the indexes, default is to error outRs$Indexes not yet built, cannot searchtbuildN(RRtfailureRRE(RR((Rt
_checkIndexess



cCsdS(s* Do nothing, mainly for the testing code. N((R((RRscCs
||_dS(N(RR(RR((RR"sc
CsT|idd|ii|||||fo|i|||||fSnc|dj	o(|ii
|ddddfg}n.g}x$|ii
D]}|i|qWg}	x|D]}|o||ijp\|o||ijpE|o||ijp.|o||ijp|o||ijoqn|	i|qW|	S(s6return list of pkgobjects matching the nevra requestedRRN(RRRRvR&R'R(R)R*R
tgetRRt
itervaluest
pkgsbyRepoRRR.Rh(
RR&R'R(R)R*RRR.R((RR+&s""
(scCs|iddh}xM|ii|gD]6}|id|||f}|o|||<q,q,W|ddjoF|ddf}x4|i
|D]}|i|gi|qWn|S(s5return dict { packages -> list of matching provides }RRRit/N(NNN(RRRRRR&R.t
matchingPrcosR9R5thitsR
thitRBt
setdefaultRh(RR&R9R5RRRR.((RR:=s!cCsj|iddh}xM|ii|gD]6}|id|||f}|o|||<q,q,W|S(s5return dict { packages -> list of matching requires }RRRN(RRRRRR&R.RR9R5R(RR&R9R5RRR.((RR;KscCs:|idd|ii|o|i|SngSdS(s<return list of package requiring the name (any evr and flag)RRN(RRRRvR&(RR&((RR<Us
cCsp|iddg}|ddjo|i|i|n|ii|o|i|i|n|S(s<return list of package providing the name (any evr and flag)RRiRN(RRt
returnListR&RRBRRv(RR&R((RR=]scCs:|idd|ii|o|i|SngSdS(sCreturn list of package conflicting with the name (any evr and flag)RRN(RRRRvR&(RR&((RR>is
cCs:|idd|ii|o|i|SngSdS(s=return list of package obsoleting the name (any evr and flag)RRN(RRRRvR&(RR&((RR?qs
cCsh}xP|iD]B}t|idjoqn|i|igi|iqW|p|Snt
d|iD}g}x,|D]$}||jo|i|qqWx|D]
}||=qW|S(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]iccsx|]
}|iVqWdS(N(RRR$(RR((RRsN(tobsRRR.RRRR$RR@RYRLRRRRh(RR@RRR.RR((RRAys&
#
cCs:|idd|ii|o|i|SngSdS(sqreturn list of packages by filename
           FIXME - need to add regex match against keys in file list
        RRN(RRRRvR&(RR&((RRBs
cCs3|i|pg||<n||i|dS(N(tdictRvtkeyRhtdata(RRRR((Rt_addToDictAsListscCsi|i|pdSny||i|Wntj
onXt||djo||=ndS(Ni(RRvRtremoveRt
ValueErrorR(RRRR((Rt_delFromListOfDictscCs|i}|i\}}}}}|i	o1|i	i
|o|i|i||qrn|i|i|||i
o|i|ndS(s"add a pkgobject to the packageSackN(RCRGR$R&R*R'R(R)RRRvRRRt_addPackageToIndex(RRCR&R'R)R(R*RG((RRDs	

cCsP|ix6|iD]+}x"|i|D]}|i|q(WqWd|_dS(sbuilds the useful indexes for searching/querying the packageSack
           This should be called after all the necessary packages have been 
           added/deletediN(RtclearIndexesRRGRCRR(RRCRG((RREs

cCsLh|_h|_h|_h|_h|_h|_h|_d|_dS(Ni(	RRRRRRRRR(R((RRs							cCsx?|idD].\}}\}}
}|i|i	||qWx?|idD].\}}\}}
}|i|i
||qRWx?|idD].\}}\}}
}|i|i||qWx?|idD].\}}\}}
}|i|i||qWxD|i
D]6}x-|i|D]}	|i|i|	|q+WqW|i|i|i||i\}}}}
}|i|i|||
||f||i|i|ddddf|dS(NRRRR(RCt
returnPrcoR0tflR2R3R4RRRRRRtreturnFileTypestftypetreturnFileEntriestfileRRRR$R&R*R'R(R)RR
(RRCRR)R&R*R0R'R4RR3R2RR(((RRs*
%cCsx?|idD].\}}\}}
}|i|i	||qWx?|idD].\}}\}}
}|i|i
||qRWx?|idD].\}}\}}
}|i|i||qWx?|idD].\}}\}}
}|i|i||qWxD|i
D]6}x-|i|D]}	|i|i|	|q+WqW|i|i|i||i\}}}}
}|i|i|||
||f||i|i|ddddf|dS(NRRRR(RCRR0RR2R3R4RRRRRRRRRRRRRR$R&R*R'R(R)RR
(RRCRR)R&R*R0R'R4RR3R2RR(((Rt_delPackageFromIndexs*
%cCs8|i|i|i||io|i|ndS(sdelete a pkgobjectN(RRRRCRGRR(RRC((RRFs
cCsg}|djo,xP|iD]}|i|i|qWn(y|i|}Wntj
onX|o/t	|||dd}|d|d}n|S(s2return list of all packages, takes optional repoidRksrepo-pkgkeyiiN(RRGR
RRRRtKeyErrorRHt
parsePackagesRI(RRGRHRIRR((RRs


cCs>h}|oQ|idd|ii|dddddf}|ptd|qvn|i	d|d|}x|D]|}|i
|i|ifp|||i|if<q}||i|if}|i|o|||i|if<q}q}W|o0|i
|o||gSq4td|n|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 comparedRRisNo Package Matching %s.%sRHRIN(thighdictRJRRRRR
twhereRRRHRIRRvR&R*tpkg2tverGTR(RRJRHRIRRRR((RRKs*%c
Cs1h}x|id|d|D]}|i|ip%g||i<||ii|q||id}|i
|o|g||i<n|i|o||ii|qqW|o-|i|o||Sqtd|ng}x2|iD]$}x|D]}	|i|	qWqW|S(sreturn list of newest packages based on name matching
           this means(in name.arch form): foo.i386 and foo.noarch will
           be compared to each other for highest versionRHRIisNo Package Matching  %sN(RRRRHRIRRvR&RhRRtverEQRt
returnlistRtpolstR.(
RR&RHRIRRRRRR.((RRL6s0


cCs4g}|id|dtD]}||iq~S(sLreturns a list of pkg tuples (n, a, e, v, r) optionally from a single repoidRHRIN(t_[1]RRRHR~RR$(RRHRIRR((RRMUscCs x|iD]}|GHq
WdS(N(RRR(RR((RRN\s
cCs<x5|iD]'}|i|jo|i|q
q
WdS(sDexclude incompatible arches. archlist is a list of compatible archesN(RRRR*RORF(RROR((RRP`s

c	Csh}x|iD]}g}xE|D]=}t||}|o!|i
|o|i|q&q&Wt|djo&|o|||n|||<qqW|S(Ni(tmatchesRRR.t	tmpvaluesRQtfieldRtvalueRRtsearchRhRR(	RRQRRRRRRRR.((RRSgs
("R{R|R}RRRRRR
R+R:R;R<R=R>R?R~RARBRRRDRERRRRFRRKRLRMRNRPRS(((RRs<		
		
					
				
				"		cCsh}x|D]}}|i}d}||jo|i||d}n|djo|g||<q
|djo||i|q
q
Wg}x!|i	D]}|i|qW|S(s3 Does the same as PackageSack.returnNewestByName() iiN(R@RRR&RtcvaltverCMPRhR	RtvalsR(RR@R	RRRR((RRws"	



cCseh}xR|D]J}|i|if}||jo|i||oq
n|||<q
W|iS(s7 Does the same as PackageSack.returnNewestByNameArch() N(R@RRR&R*RtverLER(RR@RR((RRs!tListPackageSackcBs#tZdZedZdZRS(sDerived class from PackageSack to build new Sack from list of
       pkgObjects - like one returned from self.returnNewestByNameArch()
       or self.returnNewestByName()cCs/ti||dj	o|i|ndS(N(RRRtObjlistR
taddList(RR((RRs

cCs"x|D]}|i|qWdS(N(tObjListtpkgobjRRD(RRR((RRs(R{R|R}R
RR(((RRs(R}tErrorsRR RcR`R^tpackagesRtobjectRRRRRR(R`R RR^RRRcRRRRR((Rt?s
				
}		

Anon7 - 2021