��
�[c@s�dZddklZddkZddkZddkZddkZddklZddk Z
ddk lZdfd��YZde
fd ��YZd
efd��YZdefd
��YZd�Zd�Zdefd��YZdS(s;
Classes for manipulating and querying groups of packages.
i����(tPackageSackErrorN(t
parsePackages(t
compareEVRtPackageSackVersioncBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs"d|_tidg�|_dS(Nitsha1(t_numtmisct Checksumst_chksum(tself((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__init__s cCsd|i|ii�fS(Ns%u:%s(RRt hexdigest(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__str__#scCs�|djotSt|�td�td�fjot|�|jS|i|ijotS|ii�|ii�jotStS(Ntu(tNonetFalsettypetstrRRtdigesttTrue(R tother((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__eq__&s
%cCs||jS(N((R R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__ne__-scCsb|id7_|iit|��|dj o,|ii|d�|ii|d�ndS(Nii(RRtupdateRR(R tpkgtcsum((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR0s
(t__name__t
__module__R
RRRR(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRs
tPackageSackBasecBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d%d%d%d%d%d�Zged �Z
d
�Zd�Zd%d%d%d%d%d%d�Zd%d&d
�Zd%d'd�Zd�Zd�Zd�Zd�Zed�Zd�Zd�Zd�Zd�Zd�Zd%d%ed�Zd�Zehd�Zd%d%ed�Z d%d%ed�Z!d%ed�Z"d�Z#d �Z$d!�Z%d"�Z&d#�Z'd%d$�Z(RS((s8Base class that provides the interface for PackageSacks.cCs
h|_dS(N(tadded(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR
:scCst|i��S(N(tlentreturnPackages(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__len__=scCs5|i�}t|d�o|i�St|�SdS(Nt__iter__(RthasattrR!titer(R tret((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR!@scCs�|djodSt|i�}t|i�}t|�t|�jot|�t|�SxDtt|�t|��D]'\}}t||�}|o|SqzWdS(Nii(RtlistRRtziptsortedtcmp(R Rts_reposto_reposts_repoto_repoR$((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt__cmp__Gs
cCs
t��dS(N(tNotImplementedError(R tcompatArchs((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsetCompatArchsUscCs
t��dS(N(R.(R trepotmdtypetcallbackt cacheOnly((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytpopulateXscCs#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
stackleveli(twarningstwarntDeprecationWarningtsearchPkgTuple(R tpkgtup((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytpackagesByTuple[s
cCs
t��dS(s6return list of pkgobjects matching the nevra requestedN(R.(R tnametepochtvertreltarch((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchNevracscCs
t��dS(N(R.(R tnamestreturn_pkgtups((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchNamesgscCs7|id|id|id|id|id|i�S(srreturn list of package objects matching the name, epoch, ver, rel,
arch of the package object passed inR=R>R?R@RA(RBR=R>R?R@RA(R tpo((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchPOjs$cCs=|\}}}}}|id|d|d|d|d|�S(s7return list of pkgobject matching the (n,a,e,v,r) tupleR=RAR>R?R@(RB(R R;tntatetvtr((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR:qscCsf|o1|i}|i}|i}|i}|i}nt|id|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=RAR>R?R@(R=RAR>tversiontreleasetboolRB(R R=RAR>R?R@RF((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytcontainsvs
cCs
t��dS(s5return dict { packages -> list of matching provides }N(R.(R R=tflagsRM((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytgetProvides�scCs
t��dS(s5return dict { packages -> list of matching requires }N(R.(R R=RQRM((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytgetRequires�scCs
t��dS(s<return list of package requiring the name (any evr and flag)N(R.(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchRequires�scCs
t��dS(s<return list of package providing the name (any evr and flag)N(R.(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchProvides�scCs
t��dS(sCreturn list of package conflicting with the name (any evr and flag)N(R.(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchConflicts�scCs
t��dS(s=return list of package obsoleting the name (any evr and flag)N(R.(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchObsoletes�scCs
t��dS(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]N(R.(R tnewest((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytreturnObsoletes�scCs
t��dS(sb Is calling pkg.returnFileEntries(primary_only=True) faster than
using searchFiles(). N(R.(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pythave_fastReturnFileEntries�scCs
t��dS(s#return list of packages by filenameN(R.(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchFiles�scCs
t��dS(s"add a pkgobject to the packageSackN(R.(R tobj((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
addPackage�scCs
t��dS(s�builds the useful indexes for searching/querying the packageSack
This should be called after all the necessary packages have been
added/deletedN(R.(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytbuildIndexes�scCs
t��dS(sdelete a pkgobjectN(R.(R R\((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
delPackage�scCs
t��dS(sreturn list of all packagesN(R.(R trepoidtpatternstignore_case((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�scGs
t��dS(s� Add an "excluder" for all packages in the repo/sack. Can basically
do anything based on nevra, changes lots of exclude decisions from
"preload package; test; delPackage" into "load excluder".
Excluderid is used so the caller doesn't have to track
"have I loaded the excluder for this repo.", it's probably only
useful when repoid is None ... if it turns out utterly worthless
then it's still not a huge wart. N(R.(R R`t
excluderidtexcludertargs((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytaddPackageExcluder�sc
Cs`d�}t�}h}h}h}xt|i��D]}|i�} |i|| �xb|D]Z}
|i||
jo@|
|jot�||
<h||
<n||
i|| �q`q`W|oq7n|iii}|||i ||| �xC|D];}
|i||
jo!|||
|i ||| �q�q�Wq7W|o||||gS||gS(s5 Return a simple version for all available packages. cSsq|i|h�}|idt��}|i||�|dj o)|i|t��}|i||�ndS(N(t
setdefaultRRR(tareposR`trevRRtarevstrpsv((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_up_revs�s
(
RR'RtreturnIdSumRR=R1trepoXMLtrevisionR`(R t main_onlytgroupsRltmainRht main_grpstarepos_grpsRRtgroupRi((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
simpleVersion�s6
)cCs
t��dS(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 compared
Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
The last _two_ pkgs will be returned, not just one of them. N(R.(R tnaTupRaRb((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytreturnNewestByNameArch�scCs
t��dS(s�return 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 version.N(R.(R R=RaRb((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytreturnNewestByName�scCs
t��dS(s,returns a list of pkg tuples (n, a, e, v, r)N(R.(R RaRb((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
simplePkgList�scCs
t��dS(N(R.(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
printPackages�scCs
t��dS(sDexclude incompatible arches. archlist is a list of compatible archesN(R.(R tarchlist((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytexcludeArchs�scCs
t��dS(N(R.(R tfieldstcriteria_reR3((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytsearchPackagesscCs
t��dS(N(R.(R targt
query_type((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt searchAllscCsg}g}t|�}h}xN|D]F}ti|�o&ti|�}ti|�||<q%|||<q%W|id|�}xkg} |D]}
| |
iq�~ D]E}|\}}
}}}t|d||
fd||||
fd||fd|||fd|||||
fd|||||
ff�}x�|i �D]�\}}||jo<||jo+|i
|i|�d�|i|�q�qFxI|D]A}|i
|�o+|i
|i|�d�|i|�q�q�WqFWq�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]
Ras%s.%ss%s-%s-%s.%ss%s-%ss%s-%s-%ss%s:%s-%s-%s.%ss%s-%s:%s-%s.%si(tsetRtre_globtfnmatcht translatetretcompileRR;titemstappendR:tdiscardtmatchtuniqueR%(R tpkgspecstmatchedt
exactmatcht unmatchedtspecstptrestringtpkgst_[1]RR;RHRIRJRKRLRCttermtquery((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytmatchPackageNames sD%
c CsNd�}h}g}x�|id|�D]{}|ipq(nxa|iD]V}||jot�||<nt||�djoqIn||i|i�qIWq(Wx�|id|�D]�}d}x_||�D]Q}||jo>t||�djp|i||jo|d7}Pq$q�q�W|djo|i|�q�q�W|S(sjreturns a list of package objects that are not required by
any other package in this repositoryc sshx|iD]}|Vq
Wx|iD]}|Vq#Wx|iD]}|Vq<Wx|iD]}|VqUWdS(s& Return all the provides, via. yield. N(tprovides_namestfilelisttdirlistt ghostlist(RFtprov((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_return_all_providesBs
R`ii(Rtrequires_namesR�RtaddR=R�( R R`R�treqtorphansRFRLtpreqR�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytreturnLeafNodes>s4
+
N(NNN(NNN()RRt__doc__R
R R!R-R0R5R<RRBRRERGR:RPRRRSRTRURVRWRYRZR[R]R^R_RRfRvRxRyRzR{R}R�R�R�R�(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR8sL
& 5tMetaSackcBsseZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d!d!d!d!d!d�Zged �Z
d!d"d
�Zd!d#d�Zd�Zd
�Zd�Zd�Zed�Zd�Zd�Zd�Zd�Zd!d!ed�Zd�Zd!d!ed�Zd!d!ed�Zd!ed�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d �Z$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(RR
tsacksRtcompatarchs(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR
rs
cCs:d}x-t|ii��D]}|t|�7}qW|S(Ni(R'R�tvaluesR(R R$tsack((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR ws
cCs<x5|ii�D]$}t|d�o|i�qqWdS(NtdropCachedData(R�R�R"R�(R R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�}scCs!||i|<|i|i�dS(s1Adds a repository's packageSack to this MetaSack.N(R�R0R�(R R`R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pytaddSack�s
cCs$|i|ii||||�dS(N(R�tidR5(R R1R2R3R4((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR5�scCs+x$|ii�D]}|i|�qWdS(N(R�R�R0(R R/R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR0�scCs&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.
R6iR<(R7R8R9t_computeAggregateListResult(R R;((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR<�s
cCs|id|||||�S(s6return list of pkgobjects matching the nevra requestedRB(R�(R R=R>R?R@RA((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRB�scCs|id||�S(NRE(R�(R RCRD((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRE�scCs|id|||�S(s5return dict { packages -> list of matching provides }RR(t_computeAggregateDictResult(R R=RQRM((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRR�scCs|id|||�S(s5return dict { packages -> list of matching requires }RS(R�(R R=RQRM((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRS�scCs|id|�S(s<return list of package requiring the name (any evr and flag)RT(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRT�scCs|id|�S(s<return list of package providing the name (any evr and flag)RU(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRU�scCs|id|�S(sCreturn list of package conflicting with the name (any evr and flag)RV(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRV�scCs|id|�S(s=return list of package obsoleting the name (any evr and flag)RW(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRW�scs�|p|id�S|id�}td�|D��}h}d}d }d���fd�}x�t|i|dt�d��D]`}|d} || jo||
|�oq�n| }|}
||jo||||<q�q�W|S(
sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]RYcssx|]}|dVqWdS(iN((t.0tobstup((s3/usr/lib/python2.6/site-packages/yum/packageSack.pys <genexpr>�s R
cSs[t|d|d�}|o|St|d|d|df|d|d|df�S(s4 Compare two pkgtup's (ignore arch): n, a, e, v, r. iiii(R(R(txtyR$((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_pkgtup_nevr_cmp�scs�||�djS(Ni((R�R�(R�(s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_pkgtup_nevr_eq�sRDR(iN(R�R�RR'RER(R RXtobsdictRCtnobsdictt last_nametlast_pkgR�R;R=tlast_pkgtup((R�s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRY�s(
cCs|id|�S(s#return list of packages by filenameR[(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR[�scCsdS(saAdd a pkgobject to the packageSack. This is a meaningless operation
for the MetaSack.N((R R\((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR]�scCs(x!|ii�D]}|i�qWdS(s�builds the useful indexes for searching/querying the packageSack
This should be called after all the necessary packages have been
added/deletedN(R�R�R^(R R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR^�scCs|iii|�dS(s2Delete a pkgobject if it exists in every sub-sack.N(R1R�R_(R R\((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR_�scCs;|p|idd||�S|i|id|d|�S(s�Returns a list of packages. Note that the packages are
always filtered to those matching the patterns/case. An optional
repoid allows you to easily get data for a specific repo. RRaRbN(R�RR�R(R R`RaRb((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�s
cGsD|p |i}|dd|||�S|i|id|||�S(s� Add an "excluder" for all packages in the repo/sack. Can basically
do anything based on nevra, changes lots of exclude decisions from
"preload package; test; delPackage" into "load excluder".
Excluderid is used so the caller doesn't have to track
"have I loaded the excluder for this repo.", it's probably only
useful when repoid is None ... if it turns out utterly worthless
then it's still not a huge wart. RfN(R�RR�Rf(R R`RcRdRetcalr((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRf�s
cCsk|i}|d|||�}t|�}|o5|p|o'di|pg�}td|�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 compared.
Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
The last _two_ pkgs will be returned, not just one of them. Rxs, sNo Package Matching %s(R�tpackagesNewestByNameArchtjoinR(R RwRaRbR�R�tui_pats((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRxs cCsv|id|||�}t|�}|oF|p|o8|o
|}ndi|pg�}td|�n|S(s�return 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 version.Rys, sNo Package Matching %s(R�tpackagesNewestByNameR�R(R R=RaRbR�R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRys
cCs|id||�S(s,returns a list of pkg tuples (n, a, e, v, r)Rz(R�(R RaRb((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRz"s cCs(x!|ii�D]}|i�qWdS(N(R�R�R{(R R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR{'scCs+x$|ii�D]}|i|�qWdS(sDexclude incompatible arches. archlist is a list of compatible archesN(R�R�R}(R R|R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR}+scCs|id|||�S(NR�(R�(R R~RR3((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�0scCs|id||�S(NR�(R�(R R�R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�3sc Cs#g}g}d}x�|ii�D]�}t|d�o�ggg}}}y|i|�\}}}Wntj
o
q"nX|i|�|i|�|djot|�}q�|it|��}q"q"Wt i
|�}t i
|�}|djo
g}n
t|�}|||fS(NR�(RR�R�R"R�RtextendR�tintersectionRR�R%( R R�R�R�R�R�RJtmtu((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�6s,
cGs�g}x�t|ii��D]m}t||�oWt||�}yt||�}Wntj
o
qnX|o|i|�q�qqW|S(N(R'R�R�R"tgetattrtapplyRR�(R t
methodNameRetresultR�tmethodt
sackResult((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�QscGs�h}x�t|ii��D]m}t||�oWt||�}yt||�}Wntj
o
qnX|o|i|�q�qqW|S(N(R'R�R�R"R�R�RR(R R�ReR�R�R�R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�`sN(NNN(NNN(%RRR�R
R R�R�R5R0R<RRBRRERRRSRTRURVRWRYR[R]R^R_RRfRxRyRzR{R}R�R�R�R�R�(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�nsD !
tPackageSackcBsveZdZd�Zd�Zdd�Zd�Zd�Zd"d"d"d"d"d�Z ge
d�Zd"d#d �Zd"d$d
�Z
d�Zd�Zd
�Zd�Zd�Ze
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd"d"e
d�Zd"d"e
d�Zd"d"e
d�Z d"e
d�Z!d�Z"d �Z#d!�Z$RS(%s*represents sets (sacks) of Package ObjectscCs^h|_h|_h|_h|_h|_h|_h|_h|_d|_ d|_
dS(Ni(tnevrat obsoletestrequirestprovidest conflictst filenamest
pkgsByRepotpkgsByIDRR�tindexesBuilt(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR
rs cCs5d}x(|iD]}|t|i|�7}qW|S(Ni(R�R(R R$R1((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR �s
terrorcCsG|ip9|djo
td�qC|djo|i�qCndS(s�check to see if the indexes are built, if not do what failure demands
either error out or build the indexes, default is to error outR�s$Indexes not yet built, cannot searchtbuildN(R�RR^(R tfailure((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
_checkIndexes�s
cCs|i�dS(s* Do nothing, mainly for the testing code. N(tclearIndexes(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR��scCs
||_dS(N(R�(R R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR0�sc
CsN|idd�|||||f|ijo|i|||||fS|dj o(|ii|ddddfg�}n.g}x$|ii�D]}|i|�q�Wg}x�|D]�} |o|| ijp\|o|| ijpE|o|| i jp.|o|| i
jp|o|| ijoq�n|i| �q�W|S(s6return list of pkgobjects matching the nevra requestedR�R�N(
R�R�RtgetR�t
itervaluesR�R=R>R?R@RAR�(
R R=R>R?R@RAR�t
pkgsbyRepoR�RF((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRB�s(
(cCs�|idd�g}t�}xZ|D]R}||joq&n|i|�|i|ii|ddddfg��q&W|o#g}|D]}||iq�~S|S(s6return list of pkgobjects matching the names requestedR�R�N(R�R�R�R�R�R�RR;(R RCRDR�tdoneR=R�R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRE�s
/#cCs|idd�|djo
d}n9t|�ttd�tfjotii|�}nh}xM|ii |g�D]6}|i
d|||f�}|o|||<q{q{W|ddjoF|ddf}x4|i|�D]}|i|g�i
|�q�Wn|S( s5return dict { packages -> list of matching provides }R�R�R�it/N(NNN(NNN(R�RRRtunicodetrpmUtilst miscutilststringToVersionR�R�t
matchingPrcosR[RgR�(R R=RQRMR�RFthitsthit((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRR�s"
"!cCs�|idd�|djo
d}n9t|�ttd�tfjotii|�}nh}xM|ii |g�D]6}|i
d|||f�}|o|||<q{q{W|S(s5return dict { packages -> list of matching requires }R�R�R�N(NNN(R�RRRR�R�R�R�R�R�R�(R R=RQRMR�RFR�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRS�s
"cCs�|idd�t||�}ti|�\}}\}}}g} g}
||jo| i||�nxD| D]<}|i||||||ff�o|
i|�ququW|djo|
Sti|�p|
S|
i|i|��ti |
�S(NR�R�R�(
R�R�Rtstring_to_prco_tupleR�t checkPrcoR�tre_filenameR[R�(R R=tprcotypetprcodictRHtfRJRKRLt
basic_resultstresultsRF((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt
searchPrco�s"!
%
cCs|i|d�S(s3return list of package requiring the item requestedR�(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRT�scCs|i|d�S(s3return list of package providing the item requestedR�(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRU�scCs|i|d�S(s6return list of package conflicting with item requestedR�(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRVscCs|i|d�S(s4return list of package obsoleting the item requestedR�(R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRWscCs�h}xP|i�D]B}t|i�djoqn|i|ig�i|i�qW|p|Std�|i�D��}g}x,|D]$}||jo|i|�q�q�Wx|D]
}||=q�W|S(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]icssx|]}|iVqWdS(N(R;(R�R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pys <genexpr>s ( RRR�RgR;R�R�RyR�(R RXtobsRFtnewest_tupsttogoR�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRYs$
#
cCstS(sb Is calling pkg.returnFileEntries(primary_only=True) faster than
using searchFiles(). (R(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRZ%scCs4|idd�||ijo|i|SgSdS(s& Return list of packages by filename. R�R�N(R�R�(R R=((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR[*scCs0||jog||<n||i|�dS(N(R�(R tdicttkeytdata((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_addToDictAsList2s
cCsc||jodSy||i|�Wntj
onXt||�djo||=ndS(Ni(tremovet
ValueErrorR(R R�R�R�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_delFromListOfDict9s
cCsu|i}|i\}}}}}|ip||ijo|i|i||�n|io|i|�ndS(s"add a pkgobject to the packageSackN(R`R;R�R�R�R�t_addPackageToIndex(R R\R`R=RAR>R?R@((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR]Es
cCsP|i�x6|iD]+}x"|i|D]}|i|�q(WqWd|_dS(s�builds the useful indexes for searching/querying the packageSack
This should be called after all the necessary packages have been
added/deletediN(R�R�R�R�(R R`R\((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR^Ps
cCsLh|_h|_h|_h|_h|_h|_h|_d|_dS(Ni(R�R�R�R�R�R�R�R�(R ((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�]s cCs�x?|id�D].\}}\}}}|i|i||�qWx?|id�D].\}}\}}}|i|i||�qRWx?|id�D].\}}\}}}|i|i||�q�Wx?|id�D].\}}\}}}|i|i||�q�WxD|i�D]6}x-|i|�D]}|i|i||�q+WqW|i|i |i
|�|i\} }
}}}
|i|i| |||
|
f|�|i|i| ddddf|�dS(NR�R�R�R�(t
returnPrcoR�R�R�R�R�treturnFileTypestreturnFileEntriesR�R�R�R;R�R(R R\RHtflRJRKRLtftypetfileR=RAR>R?R@((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�is*
%cCs�x?|id�D].\}}\}}}|i|i||�qWx?|id�D].\}}\}}}|i|i||�qRWx?|id�D].\}}\}}}|i|i||�q�Wx?|id�D].\}}\}}}|i|i||�q�WxD|i�D]6}x-|i|�D]}|i|i||�q+WqW|i|i |i
|�|i\} }
}}}
|i|i| |||
|
f|�|i|i| ddddf|�dS(NR�R�R�R�(R�R�R�R�R�R�R�R�R�R�R�R;R�R(R R\RHR�RJRKRLR�RR=RAR>R?R@((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt_delPackageFromIndex|s*
%cCs8|i|i|i|�|io|i|�ndS(sdelete a pkgobjectN(R�R�R`R�R(R R\((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR_�s
c Cs�g}|djo,xP|iD]}|i|i|�qWn(y|i|}Wntj
onX|o/t|||dd�}|d|d}n|S(s2return list of all packages, takes optional repoidR�srepo-pkgkeyiiN(RR�R�tKeyErrorR(R R`RaRbt
returnListR1((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�s
cCs5h}|oQ|idd�|ii|dddddf�}|ptd|�qvn|id|d|�}x�|D]y}|i|if|jo|||i|if<q}||i|if}|i|�o|||i|if<q}q}W|o*||jo||gStd|�n|i �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 compared
Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
The last _two_ pkgs will be returned, not just one of them. R�R�isNo Package Matching %s.%sRaRbN(
R�R�R�RRRR=RAtverGTR�(R RwRaRbthighdicttwhereRtpkg2((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRx�s( %
cCsMh}|djo#|dj o|id|�}n|id|d|�}x�|D]�}|i|jo|g||i<qU||id}|i|�o|g||i<n|i|�o||ii|�qUqUW|o'||jo ||Std|�ng}x2|i�D]$} x| D]}
|i|
�q.Wq!W|S(s�return 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 version.R=RaRbisNo Package Matching %sN( RRBRR=RtverEQR�RR�(R R=RaRbRR�RRt
returnlisttpolstRF((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRy�s2
cCs4g}|id|dt�D]}||iq~S(sLreturns a list of pkg tuples (n, a, e, v, r) optionally from a single repoidRaRb(RRR;(R RaRbR�R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyRz�scCs x|i�D]}|GHq
WdS(N(R(R R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR{�s
cCs<x5|i�D]'}|i|jo|i|�q
q
WdS(sDexclude incompatible arches. archlist is a list of compatible archesN(RRAR_(R R|R((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR}�s
c Cs�h}x�|i�D]�}g}xE|D]=}t||�}|o!|i|�o|i|�q&q&Wt|�djo&|o|||�n|||<qqW|S(Ni(RR�tsearchR�R( R R~RR3tmatchesRFt tmpvaluestfieldtvalue((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�s
N(NNN(NNN(%RRR�R
R R�R�R0RRBRRERRRSR�RTRURVRWRYRZR[R�R�R]R^R�R�RR_RRxRyRzR{R}R�(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�psD
$$ cCs�h}x�|D]}}|i}d}||jo|i||d�}n|djo|g||<q
|djo||i|�q
q
Wg}x!|i�D]}|i|�q�W|S(st Does the same as PackageSack.returnNewestByName().
Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64ii(R=tverCMPR�R�R�(R�RXRR�tcvalR$tvals((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�s
cCseh}xR|D]J}|i|if}||jo|i||�oq
n|||<q
W|i�S(sz Does the same as PackageSack.returnNewestByNameArch()
The last _two_ pkgs will be returned, not just one of them.(R=RAtverLER�(R�RXRR�((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR�$s!tListPackageSackcBs#eZdZdd�Zd�ZRS(s�Derived 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(R�R
RtaddList(R tObjlist((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR
4s
cCs"x|D]}|i|�qWdS(N(R](R tObjListtpkgobj((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR9sN(RRR�RR
R(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyR/s(R�tErrorsRR7R�R�RtpackagesRtrpmUtils.miscutilsR�RRtobjectRR�R�R�R�R(((s3/usr/lib/python2.6/site-packages/yum/packageSack.pyt<module>s$�7���