Current File : //proc/3/task/3/cwd/proc/3/task/3/cwd/usr/lib/python2.7/site-packages/yum/packageSack.pyc
�
�v_c@s�dZddlmZddlZddlZddlZddlZddlmZddl Z
ddl mZdfd��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|_tjdg�|_dS(Nitsha1(t_numtmisct Checksumst_chksum(tself((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__init__s cCsd|j|jj�fS(Ns%u:%s(RRt hexdigest(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__str__#scCs�|dkrtSt|�td�td�fkrDt|�|kS|j|jkrZtS|jj�|jj�kr|tStS(Ntu(tNonetFalsettypetstrRRtdigesttTrue(R tother((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__eq__&s$cCs||kS(N((R R((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__ne__-scCs`|jd7_|jjt|��|dk r\|jj|d�|jj|d�ndS(Nii(RRtupdateRR(R tpkgtcsum((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR0s
(t__name__t
__module__R
RRRR(((s3/usr/lib/python2.7/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�Zeid�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
i|_dS(N(tadded(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR
:scCst|j��S(N(tlentreturnPackages(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__len__=scCs3|j�}t|d�r%|j�St|�SdS(Nt__iter__(RthasattrR!titer(R tret((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR!@s
cCs�|dkrdSt|j�}t|j�}t|�t|�krZt|�t|�SxBtt|�t|��D]%\}}t||�}|rv|SqvWdS(Nii(RtlistRRtziptsortedtcmp(R Rts_reposto_reposts_repoto_repoR$((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt__cmp__Gs(cCs
t��dS(N(tNotImplementedError(R tcompatArchs((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytsetCompatArchsUscCs
t��dS(N(R.(R trepotmdtypetcallbackt cacheOnly((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytpopulateXscCs#tjdtdd�|j|�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.7/site-packages/yum/packageSack.pytpackagesByTuple[s
cCs
t��dS(s6return list of pkgobjects matching the nevra requestedN(R.(R tnametepochtvertreltarch((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytsearchNevracscCs
t��dS(N(R.(R tnamestreturn_pkgtups((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytsearchNamesgscCs7|jd|jd|jd|jd|jd|j�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.7/site-packages/yum/packageSack.pytsearchPOjs$cCs=|\}}}}}|jd|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.7/site-packages/yum/packageSack.pyR:qscCsd|r6|j}|j}|j}|j}|j}nt|jd|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.7/site-packages/yum/packageSack.pytcontainsvs cCs
t��dS(s5return dict { packages -> list of matching provides }N(R.(R R=tflagsRM((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytgetProvides�scCs
t��dS(s5return dict { packages -> list of matching requires }N(R.(R R=RQRM((s3/usr/lib/python2.7/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.7/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.7/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.7/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.7/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.7/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.7/site-packages/yum/packageSack.pythave_fastReturnFileEntries�scCs
t��dS(s#return list of packages by filenameN(R.(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytsearchFiles�scCs
t��dS(s"add a pkgobject to the packageSackN(R.(R tobj((s3/usr/lib/python2.7/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.7/site-packages/yum/packageSack.pytbuildIndexes�scCs
t��dS(sdelete a pkgobjectN(R.(R R\((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt
delPackage�scCs
t��dS(sreturn list of all packagesN(R.(R trepoidtpatternstignore_case((s3/usr/lib/python2.7/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.7/site-packages/yum/packageSack.pytaddPackageExcluder�scCsVd�}t�}i}i}i}xt|j��D]�}|j�} |j|| �x^|D]V}
|j||
kr`|
|kr�t�||
<i||
<n||
j|| �q`q`W|r�q7n|jjj}|||j ||| �xA|D]9}
|j||
kr�|||
|j ||| �q�q�Wq7W|rL||||gS||gS(s5 Return a simple version for all available packages. cSso|j|i�}|jdt��}|j||�|dk rk|j|t��}|j||�ndS(N(t
setdefaultRRR(tareposR`trevRRtarevstrpsv((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_up_revs�s(
RR'RtreturnIdSumRR=R1trepoXMLtrevisionR`(R t main_onlytgroupsRltmainRht main_grpstarepos_grpsRRtgroupRi((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt
simpleVersion�s0
(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.7/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.7/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.7/site-packages/yum/packageSack.pyt
simplePkgList�scCs
t��dS(N(R.(R ((s3/usr/lib/python2.7/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.7/site-packages/yum/packageSack.pytexcludeArchs�scCs
t��dS(N(R.(R tfieldstcriteria_reR3((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytsearchPackagesscCs
t��dS(N(R.(R targt
query_type((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt searchAllscCs�g}g}t|�}i}x!|D]}tj|�||<q%W|jd|�}xKg|D]}|j^q^D]-} | \}
}}}
}t|
d|
|fd|
|
||fd|
|
fd|
|
|fd||
|
||fd|
||
||ff�}x�|j�D]�\}}||krS|j|j| �d�|j|�qxD|D]<}
||
�rZ|j|j| �d�|j|�qZqZWqWqqWtj |�tj |�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(tsetRtcompile_patternRR;titemstappendR:tdiscardtuniqueR%(R tpkgspecstmatchedt
exactmatcht unmatchedtspecstptpkgsRR;RHRIRJRKRLRCttermtquery((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytmatchPackageNames s4
#
c CsAd�}i}g}x�|jd|�D]u}|js=q(nx]|jD]R}||krit�||<nt||�dkr�qGn||j|j�qGWq(Wx�|jd|�D]�}d}xZ||�D]L}||kr�t||�dks|j||kr|d7}Pqq�q�W|dkr�|j|�q�q�W|S(sjreturns a list of package objects that are not required by
any other package in this repositorycsshx|jD]}|Vq
Wx|jD]}|Vq#Wx|jD]}|Vq<Wx|jD]}|VqUWdS(s& Return all the provides, via. yield. N(tprovides_namestfilelisttdirlistt ghostlist(RFtprov((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_return_all_provides=s R`ii(Rtrequires_namesR�RtaddR=R�( R R`R�treqtorphansRFRLtpreqR�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytreturnLeafNodes9s, )
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.7/site-packages/yum/packageSack.pyR8sL
& 0tMetaSackcBsseZdZd�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#tj|�i|_d|_dS(N(RR
tsacksRtcompatarchs(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR
ms
cCs:d}x-t|jj��D]}|t|�7}qW|S(Ni(R'R�tvaluesR(R R$tsack((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR rscCs:x3|jj�D]"}t|d�r|j�qqWdS(NtdropCachedData(R�R�R"R�(R R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�xscCs!||j|<|j|j�dS(s1Adds a repository's packageSack to this MetaSack.N(R�R0R�(R R`R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pytaddSack}s
cCs$|j|jj||||�dS(N(R�tidR5(R R1R2R3R4((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR5�scCs+x$|jj�D]}|j|�qWdS(N(R�R�R0(R R/R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR0�scCs&tjdtdd�|jd|�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.7/site-packages/yum/packageSack.pyR<�s
cCs|jd|||||�S(s6return list of pkgobjects matching the nevra requestedRB(R�(R R=R>R?R@RA((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRB�scCs|jd||�S(NRE(R�(R RCRD((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRE�scCs|jd|||�S(s5return dict { packages -> list of matching provides }RR(t_computeAggregateDictResult(R R=RQRM((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRR�scCs|jd|||�S(s5return dict { packages -> list of matching requires }RS(R�(R R=RQRM((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRS�scCs|jd|�S(s<return list of package requiring the name (any evr and flag)RT(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRT�scCs|jd|�S(s<return list of package providing the name (any evr and flag)RU(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRU�scCs|jd|�S(sCreturn list of package conflicting with the name (any evr and flag)RV(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRV�scCs|jd|�S(s=return list of package obsoleting the name (any evr and flag)RW(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRW�scs�|s|jd�S|jd�}td�|D��}i}d}d }d }d���fd�}x~t|j|dt�d��D][} | d}
||
kr�||| �r�q�n|
}| }| |kr�|| || <q�q�W|S(
sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]RYcss|]}|dVqdS(iN((t.0tobstup((s3/usr/lib/python2.7/site-packages/yum/packageSack.pys <genexpr>�sR
cSsYt|d|d�}|r!|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.7/site-packages/yum/packageSack.pyt_pkgtup_nevr_cmp�scs�||�dkS(Ni((R�R�(R�(s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_pkgtup_nevr_eq�sRDR(iN(R�R�RR'RER(R RXtobsdictRCtnobsdictt last_nametlast_pkgtlast_pkgtupR�R;R=((R�s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRY�s(
cCs|jd|�S(s#return list of packages by filenameR[(R�(R R=((s3/usr/lib/python2.7/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.7/site-packages/yum/packageSack.pyR]�scCs(x!|jj�D]}|j�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.7/site-packages/yum/packageSack.pyR^�scCs|jjj|�dS(s2Delete a pkgobject if it exists in every sub-sack.N(R1R�R_(R R\((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR_�scCs9|s|jdd||�S|j|jd|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.7/site-packages/yum/packageSack.pyR�s
cGsB|s%|j}|dd|||�S|j|jd|||�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.7/site-packages/yum/packageSack.pyRf�s
cCsf|j}|d|||�}t|�}|rb|s=|rbdj|pLg�}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.7/site-packages/yum/packageSack.pyRx�s cCso|jd|||�}t|�}|rk|s7|rk|rF|}ndj|pUg�}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.7/site-packages/yum/packageSack.pyRys cCs|jd||�S(s,returns a list of pkg tuples (n, a, e, v, r)Rz(R�(R RaRb((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRzs cCs(x!|jj�D]}|j�qWdS(N(R�R�R{(R R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR{#scCs+x$|jj�D]}|j|�qWdS(sDexclude incompatible arches. archlist is a list of compatible archesN(R�R�R}(R R|R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR}'scCs|jd|||�S(NR�(R�(R R~RR3((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�,scCs|jd||�S(NR�(R�(R R�R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�/sc Csg}g}d}x�|jj�D]�}t|d�r"ggg}}}y|j|�\}}}Wntk
r}q"nX|j|�|j|�|dkr�t|�}q�|jt|��}q"q"Wt j
|�}t j
|�}|dkrg}nt|�}|||fS(NR�(RR�R�R"R�RtextendR�tintersectionRR�R%( R R�R�R�R�R�RJtmtu((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�2s*
cGs�g}x~t|jj��D]g}t||�rt||�}yt||�}Wntk
riqnX|r�|j|�q�qqW|S(N(R'R�R�R"tgetattrtapplyRR�(R t
methodNameRetresultR�tmethodt
sackResult((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�Ms
cGs�i}x~t|jj��D]g}t||�rt||�}yt||�}Wntk
riqnX|r�|j|�q�qqW|S(N(R'R�R�R"R�R�RR(R R�ReR�R�R�R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�\s
N(NNN(NNN(%RRR�R
R R�R�R5R0R<RRBRRERRRSRTRURVRWRYR[R]R^R_RRfRxRyRzR{R}R�R�R�R�R�(((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�isD "
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 ObjectscCsktj|�i|_i|_i|_i|_i|_i|_i|_i|_ d|_d|_dS(Ni(
RR
tnevrat obsoletestrequirestprovidest conflictst filenamest
pkgsByRepotpkgsByIDRR�tindexesBuilt(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR
ns
cCs5d}x(|jD]}|t|j|�7}qW|S(Ni(R�R(R R$R1((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR �sterrorcCsA|js=|dkr!td�q=|dkr=|j�q=ndS(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.7/site-packages/yum/packageSack.pyt
_checkIndexes�s
cCs|j�dS(s* Do nothing, mainly for the testing code. N(tclearIndexes(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR��scCs
||_dS(N(R�(R R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR0�sc
Cs?|jdd�|||||f|jkrH|j|||||fS|dk r{|jj|ddddfg�}n-g}x$|jj�D]}|j|�q�Wg}x�|D]�} |r�|| jks�|r�|| jks�|r�|| j ks�|r|| j
ks�|r*|| jkr*q�n|j| �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.7/site-packages/yum/packageSack.pyRB�s$'
cCs�|jdd�g}t�}xX|D]P}||kr>q&n|j|�|j|jj|ddddfg��q&W|r�g|D]}|j^q�S|S(s6return list of pkgobjects matching the names requestedR�R�N(R�R�R�R�R�R�RR;(R RCRDR�tdoneR=R((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRE�s
/cCs|jdd�|dkr%d}n6t|�ttd�tfkr[tjj|�}ni}xK|jj |g�D]4}|j
d|||f�}|rw|||<qwqwW|ddkr|ddf}x3|j|�D]}|j|g�j
|�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.7/site-packages/yum/packageSack.pyRR�s ! cCs�|jdd�|dkr%d}n6t|�ttd�tfkr[tjj|�}ni}xK|jj |g�D]4}|j
d|||f�}|rw|||<qwqwW|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.7/site-packages/yum/packageSack.pyRS�s !cCs�|jdd�t||�}tj|�\}}\}}}g} g}
||krl| j||�nxB| D]:}|j||||||ff�rs|
j|�qsqsW|dkr�|
Stj|�s�|
S|
j|j|��tj |
�S(NR�R�R�(
R�R�Rtstring_to_prco_tupleR�t checkPrcoR�tre_filenameR[R�(R R=tprcotypetprcodictRHtfRJRKRLt
basic_resultstresultsRF((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt
searchPrco�s !
$cCs|j|d�S(s3return list of package requiring the item requestedR�(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRT�scCs|j|d�S(s3return list of package providing the item requestedR�(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRU�scCs|j|d�S(s6return list of package conflicting with item requestedR�(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRV�scCs|j|d�S(s4return list of package obsoleting the item requestedR�(R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRWscCs�i}xN|j�D]@}t|j�dkr4qn|j|jg�j|j�qW|sa|Std�|j�D��}g}x*|D]"}||kr�|j|�q�q�Wx|D]
}||=q�W|S(sEreturns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]icss|]}|jVqdS(N(R;(R�R((s3/usr/lib/python2.7/site-packages/yum/packageSack.pys <genexpr>s( RRR�RgR;R�R�RyR�(R RXtobsRFtnewest_tupsttogoR�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRY s#
cCstS(sb Is calling pkg.returnFileEntries(primary_only=True) faster than
using searchFiles(). (R(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRZ#scCs2|jdd�||jkr*|j|SgSdS(s& Return list of packages by filename. R�R�N(R�R�(R R=((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR[(scCs.||krg||<n||j|�dS(N(R�(R tdicttkeytdata((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_addToDictAsList0s
cCs]||krdSy||j|�Wntk
r8nXt||�dkrY||=ndS(Ni(tremovet
ValueErrorR(R R�R�R�((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_delFromListOfDict7s
cCsp|j}|j\}}}}}|js:||jkrS|j|j||�n|jrl|j|�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.7/site-packages/yum/packageSack.pyR]Cs cCsP|j�x6|jD]+}x"|j|D]}|j|�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.7/site-packages/yum/packageSack.pyR^Ns
cCsLi|_i|_i|_i|_i|_i|_i|_d|_dS(Ni(R�R�R�R�R�R�R�R�(R ((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�[s cCs�x?|jd�D].\}}\}}}|j|j||�qWx?|jd�D].\}}\}}}|j|j||�qRWx?|jd�D].\}}\}}}|j|j||�q�Wx?|jd�D].\}}\}}}|j|j||�q�WxD|j�D]6}x-|j|�D]}|j|j||�q+WqW|j|j |j
|�|j\} }
}}}
|j|j| |||
|
f|�|j|j| 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.7/site-packages/yum/packageSack.pyR�gs((((%cCs�x?|jd�D].\}}\}}}|j|j||�qWx?|jd�D].\}}\}}}|j|j||�qRWx?|jd�D].\}}\}}}|j|j||�q�Wx?|jd�D].\}}\}}}|j|j||�q�WxD|j�D]6}x-|j|�D]}|j|j||�q+WqW|j|j |j
|�|j\} }
}}}
|j|j| |||
|
f|�|j|j| ddddf|�dS(NR�R�R�R�(R�R�R�R�R�R�R�R�R�R�R�R;R�R(R R\RHR�RJRKRLR�R�R=RAR>R?R@((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt_delPackageFromIndexzs((((%cCs6|j|j|j|�|jr2|j|�ndS(sdelete a pkgobjectN(R�R�R`R�R�(R R\((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR_�s cCs�g}|dkr=xM|jD]}|j|j|�qWn%y|j|}Wntk
ranX|r�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.7/site-packages/yum/packageSack.pyR�s
cCs)i}|rZ|jdd�|jj|dddddf�}|srtd|�qrn|jd|d|�}x}|D]u}|j|jf|kr�|||j|jf<qy||j|jf}|j|�ry|||j|jf<qyqyW|r||kr||gStd|�n|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 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.7/site-packages/yum/packageSack.pyRx�s& %
cCs@i}|dkr3|dk r3|jd|�}n|jd|d|�}x�|D]�}|j|krz|g||j<qR||jd}|j|�r�|g||j<n|j|�rR||jj|�qRqRW|r||kr�||Std|�ng}x2|j�D]$} x| D]}
|j|
�q!WqW|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=R�tverEQR�RR�(R R=RaRbR�R�RRt
returnlisttpolstRF((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRy�s,
cCs,g|jd|dt�D]}|j^qS(sLreturns a list of pkg tuples (n, a, e, v, r) optionally from a single repoidRaRb(RRR;(R RaRbR((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyRz�scCs x|j�D]}|GHq
WdS(N(R(R R((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR{�scCs:x3|j�D]%}|j|kr
|j|�q
q
WdS(sDexclude incompatible arches. archlist is a list of compatible archesN(RRAR_(R R|R((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR}�sc Cs�i}x�|j�D]�}g}xB|D]:}t||�}|r&|j|�r&|j|�q&q&Wt|�dkr|r�|||�n|||<qqW|S(Ni(RR�tsearchR�R( R R~RR3tmatchesRFt tmpvaluestfieldtvalue((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR��s
N(NNN(NNN(%RRR�R
R R�R�R0RRBRRERRRSR�RTRURVRWRYRZR[R�R�R]R^R�R�R�R_RRxRyRzR{R}R�(((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR�lsD
$$ cCs�i}x|D]w}|j}d}||krH|j||d�}n|dkrd|g||<q
|dkr
||j|�q
q
Wg}x!|j�D]}|j|�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.7/site-packages/yum/packageSack.pyR�s
cCsbi}xO|D]G}|j|jf}||krJ|j||�rJq
n|||<q
W|j�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.7/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-tj|�|dk r)|j|�ndS(N(R�R
RtaddList(R tObjlist((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR
2s
cCs"x|D]}|j|�qWdS(N(R](R tObjListtpkgobj((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR7s
N(RRR�RR
R(((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyR
-s(R�tErrorsRR7tretfnmatchRtpackagesRtrpmUtils.miscutilsR�RRtobjectRR�R�R�R�R
(((s3/usr/lib/python2.7/site-packages/yum/packageSack.pyt<module>s$�2���