ok

Mini Shell

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

�
8M�bc@s�ddlZddlZddlZddlZddlmZmZmZmZddl	Z	ddl
Z
ddlmZm
Z
mZddlZddlZddlZddlZddlmZddlmZmZddlZddlZddlZd�Zd�Zd�Zd	�Zd
�Zd�Z deeefd
��YZ!dej"fd��YZ#d�Z$d�Z%d�Z&d�Z'dZ(dZ)dS(i����N(t
PackageObjecttRpmBasetYumAvailablePackaget
parsePackages(t
executeSQLtsql_esctsql_esc_glob(t
seq_max_split(tto_utf8t
to_unicodecs>�fd�}�j|_�j|_|jj�j�|S(s8This decorator converts sqlite exceptions into RepoErrorcs�y�||�SWnvtjjk
r�}tjdkrtt|d�r_tjt|j	��qttjt|��ntjt|��nXdS(Nitmessage(
tsqlutilstsqlitetErrortsyst
hexversionthasattrtErrorst	RepoErrortstrR
(targstkwargste(tfunc(s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytnewFunc,s(t__name__t__doc__t__dict__tupdate(RR((Rs2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytcatchSqliteException*s

cCs
tj|�S(N(tmisct
share_data(tvalue((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_share_data>scCsb||krtS|stS|rN|rN|ddkrN|d|dkrNtS||�r^tStS(Nit?t*t[(R"R#R$(tTruetFalse(tmatchtregexp_matchtn((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_parse_pkg_nBs0c	
Cs�|d}|std��||kr,tS|rt|rt|ddkrt|d|dkrt|d|dkrttSd|krd||f|d<d	||||f|d
<d||f|d<d
|||f|d<d|||||f|d<d|||||f|d<nt||d|d
|d|d|d|dg�}||kr_tS|sitSx|D]}||�rptSqpWtS(NR)sNothing in epochiR"R#R$tnameArchs%s.%ss%s-%s-%s.%stnameVerRelArchs%s-%stnameVers%s-%s-%st
nameVerRels%s:%s-%s-%s.%stenvras%s-%s:%s-%s.%stnevra(R"R#R$(tAssertionErrorR%R&tset(	R'R(tdataRtvtrtaR)titem((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt
_parse_pkgNs0
( 
cCs�tr	n�|dkr:t|||||||�r�tSng|dkrct|||d�r�tSn>|dkr�t|||�r�tSn|dkr�d	|kr�d
|d|||f|d	<n||d	kr�tSn�|dkr1d
|krd|d||||f|d
<nt|||d
�r�tSnp|dkrT|d|kr�tSnM|dkr�d	|kr�d
|d|||f|d	<n|d	|kr�tSn�|dkr�d
|kr�d|d||||f|d
<n|d
|kr�tSn�|dkr||dkr�tSn�|dkr=|d|kr�tSnd|dkrZ|dr�tSnG|dkrw|ds�tSn*|dkr�tSts�td|��dStS(NteqR'sname.eqs
name.matchR)sarch.eqs
arch.matchsnevr.eqtnevrs%s-%s:%s-%ssnevra.eqsnevra.matchR0s%s-%s:%s-%s.%ssname.insnevr.insnevra.ins	pkgtup.eqtpkgtups	pkgtup.intmarkedtwashedR#sBad excluder: (R9smatch(sname.eqs
name.match(sarch.eqs
arch.match(snevra.eqsnevra.match(R&R8R%R*R1tNone(texcluderR'R(R3RR4R5R6((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_excluder_matchmsf!$!$

ccsOd}xB|D]:}|dkr,||}n|||krBq
n|Vq
WdS(sEliminate duplicate rows from cursor based on field.

    Assuming the result set can be divided into one or more equivalent groups
    of rows based on the given field, this wrapper will yield rows from only
    one of the groups, avoiding duplicates.
    N(R>(tcurtfieldt	first_valtob((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_deduplicate�s

tYumAvailablePackageSqlitecBs�eZd�Zedd��Zdd�Zed��Zd�Z	d�Z
d�Zd�Zd	�Z
d
ed�Zed�Zd
d
�Zed�Zd�ZRS(cCs�idd6dd6dd6d	d6|_|j|_|j|_||_d|_t|_d|_	|j
|�|jdkr�d|_n|j|_|j
|_|j|_|j|j|j|j
|jf|_d|_d|_dS(
Nt	obsoletest	conflictstrequirestprovidest0(((((tprcotsacktidtrepoidtrepoR>tstateR&t_loadedfilest_filest_read_db_objtepochtpkgIdtversiontvertreleasetreltnametarchR;t
_changelogt_hash(tselfRPtdb_obj((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt__init__�s&

				
'	tfgetcCs
|j�S(N(t
_loadFiles(R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt<lambda>�scCs�|r0y||SWq0ttfk
r,d	SXnxXddddddgD]>}yt||t||��WqIttfk
r�qIXqIWy@|d|_t|d�}||dtf}|g|_Wnttfk
r�nXd	S(
swread the db obj. If asked for a specific item, return it.
           otherwise populate out into the object what existsR[R\RURWRYtpkgKeyRVt
checksum_typeN(t
IndexErrortKeyErrorR>tsetattrR!RVR%t
_checksums(R_R`R7Rft	check_sum((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRT�s"
cGs=t|j|d�|j}|j�}t|||�|S(s6 Exec SQL against an MD of the repo, return a cursor. tdb(tgetattrRMRPtcursorR(R_tMDtsqlRtcacheRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_sql_MD�scCs�idd6dd6dd6dd6d	d
6dd6d
d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6}|jd!�r�|jd!�r�t|�n|j||�}y)|jd"d#||jf�j�}Wn@tjk
r}t	|�jd$�rt
t	|��n�nX|d%}|d&krI|dkrId'}n|d-krj|dkrjd*}n|i	d+d6d+d6d+d6d+d6d+d6d+d(6d+d)6d+d6d+d,6kr�t|�}nt
|||�|S(.Ntsize_packagetpackagesizetsize_archivetarchivesizetsize_installedt
installedsizet
time_buildt	buildtimetrpm_header_startthdrstarttrpm_header_endthdrendt
location_basetbasepatht
location_hreftrelativepatht	time_filetfiletimetrpm_packagertpackagert	rpm_grouptgroupt
rpm_buildhostt	buildhostt
rpm_sourcerpmt	sourcerpmt
rpm_vendortvendortrpm_licensetlicenseRVtchecksum_valuet__tprimarys'SELECT %s FROM packages WHERE pkgId = ?sno such columniRURKtsummarytdescriptiontiturl(R�R�(t
startswithtendswithtAttributeErrortgetRrRVtfetchoneRRRRhR>R!Ri(R_tvarnametdb2simplemaptdbnameR5RR ((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt__getattr__�sN

	
		
c	Cs'|jr|jSi}|jj|jdd�|jdd|jf�}x�t|d�D]�}|d}|dkrd}n#|r�|dd	kr�|d	7}nt|d
�}t	|d�}xE|r	||j
�}t|j
��}|j|g�j
|�q�WqZWt|_||_|jS(Ntmdtypet	filelistssrSELECT pkgKey, dirname, filetypes, filenames FROM   filelist JOIN packages USING(pkgKey) WHERE  packages.pkgId = ?Retdirnamet.R�i����t/t	filetypest	filenames(RRRSRMtpopulateRPRrRVREtdecodefiletypelisttdecodefilenamelisttpopR!t
setdefaulttappendR%(	R_tresultRARDR�R�R�tfilenametfiletype((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRc6s,		
	
	!		cCs�g}|js�|j|jjkrey|jj|jdd�Wqetjk
ra||_dSXn|jdd|jf�}xet	|d�D]T}d|dd}t
|d�}t
|d	�}|j|t|�|f�q�W||_dSdS(
NR�t	otherdatatotherswSELECT pkgKey, date, author, changelog FROM   changelog JOIN packages USING(pkgKey) WHERE  pkgId = ? ORDER BY date DESCReidtdatetauthort	changelog(
R]RPRMtotherdbR�RRRrRVRERR�R!(R_R�RARDtc_datetc_authortc_log((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_loadChangelogSs$			 	cCs|j|jfS(N(RfRV(R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytreturnIdSumrscCs|j�|jS(N(R�R](R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytreturnChangelogus
tfilecCsa|rD|jrDd}|jd||j|f�}td�|�S|j�tj|||�S(s}return list of files based on type, you can pass primary_only=True
           to limit to those files in the primary repodatas=SELECT name as fname FROM files WHERE pkgKey = ? and type = ?R�cSs|dS(Ntfname((tx((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRds(RRRrRetmapRcRtreturnFileEntries(R_tftypetprimary_onlyRpRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR�ys
cCsX|rA|jrAd}|jd||jf�}td�|�S|j�tj|�S(s�return list of types of files in the package, you can pass
           primary_only=True to limit to those files in the primary repodatas9SELECT DISTINCT type as ftype FROM files WHERE pkgKey = ?R�cSs|dS(NR�((R�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRd�s(RRRrReR�RcRtreturnFileTypes(R_R�RpRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��s
cCsMtjdtjdd�d}|jd||j|f�}td�|�S(Ns_simpleFiles() will go away in a future version of Yum.Use returnFileEntries(primary_only=True)
t
stacklevelis=SELECT name as fname FROM files WHERE pkgKey = ? and type = ?R�cSs|dS(NR�((R�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRd�s(twarningstwarnRtYumDeprecationWarningRrReR�(R_R�RpRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsimpleFiles�s
	cCst|�}|dkr!d}nt|j|t�r�d|}|jd||jf�}g|j|<x�|D]z}|ds�qpnt|d�t|d�t|d�t|d�t|d	�ff}|j|jt|��qpWntj|||�S(
Ntstrong_requiresRIsDSELECT name, version, release, epoch, flags FROM %s WHERE pkgKey = ?R�R[tflagsRURWRY(	R!t
isinstanceRLttupleRrReR�Rt
returnPrco(R_tprcotypet	printableRpRARDtprco_set((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��s"	




!cCs�d}|jd||jf�}g}x�|D]�}d}|dj�d
krYd}nt|d�t|d	�t|d
�t|d�t|d�f|f}|j|�q.W|S(s%returns requires with pre-require bitsNSELECT name, version, release, epoch, flags,pre FROM requires WHERE pkgKey = ?R�RKtprettrueit1R[R�RURWRY(R�i(RrRetlowerR!R�(R_RpRARIRDR�R�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_requires_with_pre�s
	

N(Rt
__module__RatpropertytfilesR>RTRRrR�RcR�R�R�R&R�R�R�R�R�(((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRF�s			9				tYumSqlitePackageSackcBs�eZdZd�Zed��Zd�Zd�Zd�Zd�Z	ed��Z
d�Zd	d
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Zed�Zd�Zd�Zd<d�Zdd�Zd<ed�Z d�Z!ed��Z"ed��Z#d �Z$eed!��Z%ed"��Z&ed#��Z'eed$��Z(ed%��Z)ed&��Z*ed'��Z+ed(��Z,d<d=d)�Z-d<d>d*�Z.eged+��Z/ed,��Z0d-�Z1d.�Z2d/�Z3d0�Z4ed1�Z5ed<d<ed2��Z6ed<d<ed3��Z7ed4��Z8d<d<ed5�Z9d6�Z:ed<d<ed7��Z;d<d<ed8�Z<ed<ed9��Z=ed<d<d<d<d<d:��Z>ed;��Z?RS(?s~ Implementation of a PackageSack that uses sqlite cache instead of fully
    expanded metadata objects to provide information cCs�tjj||�i|_i|_i|_i|_t�|_t�|_	i|_
iid6id6|_i|_i|_
i|_t�|_t�|_t�|_d|_g|_i|_t|_dS(NRJRI(tyumRepotYumPackageSackRat	primarydbtfilelistsdbR�texcludesR2t	_excludest_exclude_whitelistt
_all_excludest
_search_cachet_key2pkgt_pkgname2pkgkeyst_pkgtup2pkgst_pkgnames_loadedt_pkgmatch_failst_provmatch_failsR>t
_arch_allowedt_pkgExcludert_pkgExcludeIdsR&t_pkgobjlist_dirty(R_tpackageClass((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRa�s*					
						cGs7t||d�|}|j�}t|||�|S(s6 Exec SQL against an MD of the repo, return a cursor. Rl(RmRnR(R_RoRPRpRRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRr�scCs#d}|jd||�j�dS(s- Give a count of pkgIds in the given repo DB s!SELECT count(pkgId) FROM packagesR�i(RrR�(R_RoRPRp((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_sql_MD_pkg_num�scsUt�d�st��jrNt�fd��j�}|�_t�_n�jS(s{ If the pkgobjlist is dirty (possible pkgs on it which are excluded)
            then clean it, and return the clean list. t
pkgobjlistcs�j|�S(N(t_pkgExcluded(R�(R_(s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRd�s(RR1R�tfilterR�R&(R_tpol((R_s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_clean_pkgobjlist�s		cCs�t}x6|jj�D]%\}}||jkrt}PqqW|rIdSt|d�rht|j��Sd}x(|jD]}|t|j|�7}qxWd}x'|jD]}||j	d|�7}q�W||S(NiR�R�(
R%R�titemsR�R&RtlenR�R�R�(R_tall_excludedRPRqtexclude_numtpkg_num((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt__len__�s cCs�t|d�r|`nt|d�r0|`nt|d�rH|`nt|_i|_i|_t�|_	t�|_
t�|_i|_iid6id6|_
tj�dS(Nt_memoize_requirest_memoize_providesR�RJRI(RR�R�R�R&R�R�R�R2R�R�R�R�R�Rtunshare_data(R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytdropCachedData
s"							
cCs�|j�x;|jj�|jj�|jj�D]}|j�q4Wi|_i|_i|_i|_t�|_t�|_	i|_
g|_i|_t
|_tjj|�dS(N(R�R�tvaluesR�R�tcloseR�R2R�R�R�R�R�R&R�R�R�(R_tdataobj((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRs 
								cCsdS(N((R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytbuildIndexes3sterrorcCsdS(N((R_tfailure((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt
_checkIndexes8scs�|jj||f�||jkr�|j|j|d���dk	r�|j�j}t�fd�|�}||j�j<q�ndS(st Exclude a package so that _pkgExcluded*() knows it's gone.
            Note that this doesn't update self.exclude. cst|�t��kS(N(RN(R�(tpo(s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRdDsN(R�taddR�R�R>R�R;R�(R_RPRetpos((Rs2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt
_delPackageRK;scCs�|j|jkr%i|j|j<nd|j|j|j<|j|jf|jkrv|jj|j|jf�n|j|j|j�t|_dS(Ni(	RPR�RVReR�tdiscardR	R%R�(R_tobj((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt
delPackageJscCset|j|<||jkr)|j|=n||jkrE|j|=n||jkra|j|=ndS(s% Exclude all packages from the repo. N(R%R�R�R�R�(R_RP((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_delAllPackagesSs


cCs=||jkrtS||jkr9||j|kr9tStS(N(R�R%R�R&(R_RPRV((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt	_excluded]s
"cCs8|jr||jkrtS|jo7||f|jkS(N(R�R%R�(R_RPRe((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_pkgKeyExcludedfsc
Cs�|jr"||f|jkr"tS|j||�r8tS|jdk	rj||jkrj|j||�tS|jswtSi|j�d6|||||fd6td6}|j�}|j�}|j�}|j�}x�|jD]�\}	}
}}|	dk	r|	|j	krq�n|
j
dd�}
t|
�dkrTts�td|
��q�n|
\}}triq�|dkr�t
||||||||�r�|j||�tSq�|d	kr�t
||||||||�r�Pq�q�|d
kr+|dr�q�t
||||||||�r�t|d<q�q�|dkru|dsDq�t
||||||||�r�t|d<q�q�ts�td|
��q�W|jj||f�tS(
s Main function to use for "can we use this package" question.
                . Tests repo against allowed repos.
                . Tests pkgKey against allowed packages.
                . Tests arch against allowed arches.
                . Tests addPackageExcluder() calls.
        R)R;R<R�iisBad excluder: texcludetincludetmarktwashN(R�R&RR%R�R>R	R�R�RNtsplitR�R1R@R(R_RPReR)RR4R5R6R3ROR?R'R(texSPLITtexTtexM((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_pkgExcludedRKNEVRAlsX	0!!
!
!c	Cs4|\}}}}}|j|||||||�S(sb Helper function to call _pkgExcludedRKNEVRA.
            Takes a repo, pkgKey and a package tuple(R(	R_RPReR;R)R6RR4R5((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_pkgExcludedRKT�sc	CsW|d|d|d|d|df\}}}}}|j|||||||�S(si Helper function to call _pkgExcludedRKNEVRA.
            Takes a repo, pkgKey and a dict of package dataR[R\RURWRY(R(	R_RPReR3R)R6RR4R5((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_pkgExcludedRKD�s*cCs|j|j|j|j�S(sR Helper function to call _pkgExcludedRKNEVRA.
            Takes a package object. (RRPReR;(R_R((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��scGs�|dk	r||jkrdSd}d}tr4nS|jd�rnt|�dks[t�|dj�}n|jd�r�t|�dks�t�|d}n�|jd�r	t|�dks�t�|dj�}tj|�r�t	j
tj|��j
}q�n~|jd�r3t|�dks�t�nT|jd�r]t|�dks�t�n*|jd	�r�t|�dks�t�n|jj||||f�|dk	r�t|j�|j|<nt�|_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. Ns.eqiis.ins.matchs.*s.markeds.washed(R>R�R&R�R�R1R�Rtre_globtretcompiletfnmatcht	translateR'R�R�R2R�R%R�(R_ROt
excluderidR?RR'R(((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytaddPackageExcluder�s8
!c	Cs�|st�|r(|j||�r(dS||jkrTi|j|<i|j|<n||j|krGd}|jd|||f�j�}|dkr�d||f}tj|�n|r�|j	|||�r�dS|j
||�}||j||<|jj|j
g�j|�|j|j|dg�}|j|�n4|r{|j|j||�r{|j||�dS|j||S(s: Lookup a pkg by it's pkgKey, if we don't have it load it sXSELECT pkgKey, pkgId, name, epoch, version, release, arch FROM packages WHERE pkgKey = ?R�s"pkgKey %s doesn't exist in repo %sR[N(R1RR>R�R�RrR�RRRtpcR�R�R;R�R�R	(	R_RPReRRpR3tmsgRtpkgkeys((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt
_packageByKey�s.
! cCs�|st�|r+|j|||�r+dS||jkrWi|j|<i|j|<n|d|jj|i�kr�|j||�}||j||<|jj|j	g�j
|�|j|j|dg�}|j
|�n|j||dS(s= Like _packageByKey() but we already have the data for .pc() ReR[N(R1RR>R�R�R�R"R�R�R;R�(R_RPReR3RRR$((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_packageByKeyDatas
cCs�|j|||�rdS|jj|�}|dkrTi|j|<i|j|<n|d|krs||djS|d|d|d|d|dfS(sb Like _packageByKeyData() but we don't create the package, we just
            return the pkgtup. ReR[R\RURWRYN(RR>R�R�R�R;(R_RPReR3tprepo((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_pkgtupByKeyDatas
cCs�g}x�|jD]u}|jj|i�j|g�}|sCqnx?|D]7}|j||�}|dkrtqJn|j|�qJWqW|S(s2 Load all pkgnames from cache, with a given name. N(R�R�R�R%R>R�(R_tpkgnametretRPR$tpkgkeytpkg((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_packagesByName#s!
cCs�||jkr)||j|kr6dSn
g|j|<||jkrUi|j|<n|dkrztjd||f�n|dkr�||j|<nN|dkr�||j|<n2|dkr�||j|<ntjd||f�|j|j|�dS(NsTried to add None %s to %stmetadataR�R�s&Sorry sqlite does not support %s in %s(	taddedR�R>RRR�R�R�R�(R_RPtdatatypeRtcallback((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytaddDict2s 
tlikecCs|j|d�S(NRJ(t
searchPrco(R_R[t
query_type((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt	searchAllOscCs�|dkrg}nxe|D]]}|rD|j||d|�}n|j||d�}|dkrlqn|j|�qW|S(sB Takes a cursor and maps the pkgKey rows into a list of packages. ReN(R>R&R%R�(R_RPRAtpkgst	have_dataRDR,((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_sql_pkgKey2poSs	
cCs7t}x*|jD]}||jkrt}PqqW|S(s6 Are we going to skip every package in all our repos? (R%R/R�R&(R_tskip_allRP((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt	_skip_all`scCs�d}tjj|�}tj|�s0d}ng}xh|jj�D]W\}}||jkrgqFn|j�}t	|d||f�|j
|||�qFWtj|�S(Ntglobt=s1select DISTINCT pkgKey from files where name %s ?(tostpathtnormpathRRR�R�R�RnRR9tunique(R_R[t	querytypetresultstrepRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_search_primary_filesis	cCshxa|jj�D]P\}}||jkr1qn|j�}t|d�x|D]}PqQWtSqWtS(s� Return true if pkg.returnFileEntries(primary_only=True) is fast.
            basically does "CREATE INDEX pkgfiles ON files (pkgKey);" exist. sPRAGMA index_info(pkgfiles)(R�R�R�RnRR&R%(R_RDRqRARD((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_have_fastReturnFileEntrieszs

cCs(t|d�s!|j�|_n|jS(sb Is calling pkg.returnFileEntries(primary_only=True) faster than
            using searchFiles(). t_cached_fRFE(RRFRG(R_((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pythave_fastReturnFileEntries�scs�|j�rgSt}t�d}tjj|�}tjj|�}tjj|��|sntj|�r�t	}t	�d}ntj��s�t	�n|ddkr�|d }ng}tj
|�r�|j|�St|j
�dkr:xH|jj�D]4\}}||jkr q�n|j|dd�q�Wnxk|j
D]`}t|d�r_qDn|jd	|�}	|jd|�}
|	|
kr�tj�nt|_qDWg}d
}|s�t��\}
}d|}|j|�|jd|
d�n��sBt��\}
}d
|}|j|�|jd|
d�n��dkr�xu|j
j�D]d\}}||jkrq^n|j�}|j|�t|d|f|�|j|||�q^Wtj|�Sx�|j
j�D]�\}}||jkrq�n|j�}t|d||f|d|g�|j|||��rhtjtj |���n���fd�}|j!dd|�t|d||�|j|||�q�Wtj|�}|S(sYsearch primary if file will be in there, if not, search filelists, use globs, if possibleR<R=i����R�iR�R�t_checked_filelists_pkgsR�R�s(dirname = ? and filenames LIKE ? %s and t%s+dirname GLOB ? and filenames LIKE ? %s and R#sQSELECT pkgKey FROM filelist
                                   WHERE dirname %s ?s�select pkgKey from filelist where                     %s length(filetypes) = 1 and                     dirname || ? || filenames                     %s ?cse|jd�}�s%t�|k�St�fd�|�}x!|D]}�j|�rDdSqDWdS(NR�csd�|fS(Ns%s/%s((tf(tsql_dirname(s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRd�sii(RtintR�R'(RLt
sql_filenamesR�tfnsR'(t	file_globR�tname_re(RLs2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytfilelist_globber�s
RRis�select pkgKey from filelist where                              %s length(filetypes) > 1                              and filelist_globber(dirname,filenames)("R;R%R>R?R@R�tbasenameRRR&tre_primary_filenameRER�R�R�R�R�R�RR�RRRIRR�RnRR9RARRRRtcreate_function(R_R[tstrictR<RBR�R7RPRqtpri_pkgstfil_pkgst
sql_paramst
dirname_checktpatterntescRDRARR((RPR�RQs2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchFiles�s�		









c
Cs�|j�rgSg}t|�dkr,|S|jdd�}t|�\}}d|d||f}x(|dD]}d||||f}qrWxI|jj�D]8\}}|j�}	t|	|�|j||	|�q�W|S(s7search arbitrary fields from the primarydb for a stringit's''s>select DISTINCT pkgKey from packages where %s like '%%%s%%'%s is%s or %s like '%%%s%%'%s (	R;R�treplaceRR�R�RnRR9(
R_tfieldstsearchstringR�R\RpRKRDRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchPrimaryFieldss
cCs|j�rgSg}|s$|r(|St|�tjt|�kr�i}xK|D]C}|j||�}x(|D] }|j|d�d||<qsWqTWx:t|dtjdt	�D]}|j
|||f�q�W|Sd}d}	g}
x�|D]y}|jdd�}t|�\}}d	|d||f}
x(|dD]}d
|
|||f}
qAW|
j
|
�q�W|dj
|
�|	}x�|jj�D]u\}}|j�}t||�xM|D]E}|j||d�}|dkr�q�n|j
||d
f�q�Wq�W|S(s�search arbitrary fields from the primarydb for a multiple strings
           return packages, number of items it matched as a list of tuplesiitkeytreverses*select pkgKey, SUM(cumul) AS total from ( s$)GROUP BY pkgKey ORDER BY total DESCR^s''s@select pkgKey,1 AS cumul from packages where %s like '%%%s%%'%s s%s or %s like '%%%s%%'%s s UNION ALL RettotalN(R;R�t	constantstPATTERNS_MAXRbR�tsortedtoperatort
itemgetterR%R�R_RtjoinR�R�RnRR%R>(R_R`t
searchstringsR�ttotRatmatchesRtunionstringtendunionstringtselectstsR\RpRKttotalstringRDRqRARDR,((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt"searchPrimaryFieldsMultipleStrings)sD

""


c	Csu|j�riS|r"t��ni}xF|jj�D]5\}}|j�}t|d�x
|D]}t|d�t|d�t|d�t|d�t|d�f}|j||d|�r�qdnt|d�t|d	�t|d
�t|d�t|d�f\}}	}
}}t|�}t||	|
||ff�}
|j|g�j	|
�qdWq8W|S(
Ns�select packages.name as name,                packages.pkgKey as pkgKey,                packages.arch as arch, packages.epoch as epoch,                packages.release as release, packages.version as version,                obsoletes.name as oname, obsoletes.epoch as oepoch,                obsoletes.release as orelease, obsoletes.version as oversion,                obsoletes.flags as oflags                from obsoletes,packages where obsoletes.pkgKey = packages.pkgKeyR[R\RURWRYRetonametoflagstoepochtoversiontorelease(
R;tNotImplementedErrorR�R�RnRR!RR�R�(R_tnewestRGRDRqRARDRcR)RKRR4R5tval((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytreturnObsoletes]s0




"!cCsUxN|jj�D]=\}}|j�}t|d|f�x|D]}|SWqWdS(Ns&select * from packages where pkgId = ?(R�R�RnR(R_RVRDRqRARD((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytgetPackageDetails�s

cCs�g}t|�dkr|Stt|��}x[|jj�D]J\}}|j�}t|d|f�x|D]}|j|�qqWq>W|S(Nis(select * from packages where pkgId in %s(R�RR�R�R�RnRR�(R_t
pkgId_listR7tpkgid_queryRDRqRARD((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_getListofPackageDetails�s
c
	Cs?t|d|�s.i}x�|jj�D]�\}}||jkrJq)n|j�}t|d|�x�|D]�}t|d�t|d�t|d�t|d�t|d�ff}t|�}||df}t|d	�}	|	|f}|j|g�j|�qnWq)Wt	|d||�nt
|d|�S(
Nt	_memoize_sselect * from %sR[R�RURWRYiRe(RR�R�R�RnRR!R�R�RiRm(
R_R�tmemoizeRDRqRAR�R|RcR+((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_search_get_memoize�s$
!c	Cs|j�riSt|�}|dkr1d}nt|�ttd�tfkrp||tjj|�f}n*t|�t	t
fkr�|||f}nt|�}t|�}||j|kr�|j||Si}t
r�|jj�}t}ng}t
}|j|�}	x�|jj�D]�\}
}|
|jkrDq#ni}x]|	j|
|fg�D]C}
|
\}}tjj||�rc|j|g�j|�qcqcWxH|j�D]:\}}|j|
|�}|dkr�q�n|||<q�Wq#Wx9|D]1\}
}|
|jkr!qn|j�}t|d||f�i}x�|D]�}
t|
d�t|
d�t|
d�t|
d�t|
d�ff}t|�}tjj||�rQ|j|
dg�j|�qQqQWxH|j�D]:\}}|j|
|�}|dkr#q�n|||<q�WqW|d	ksQ|dd
kro|sk||j||<n|Stj|�s�x3|j|dt
�D]}|ddfg||<q�W|s�||j||<n|Sx>|j|�D]-}|ddfg||<||j||<q�W|S(Nisselect * from %s where name=?R[R�RURWRYReRJR�RV(R;R	R>ttypeRtunicodetrpmUtilst	miscutilststringToVersionR�tlistR!R�R%R�R�R&R�R�R�trangeCompareR�R�t	iteritemsR%RnRRRTR]RE(R_R�R[R�RWtreqR�tprimarydb_itemstpreloadR�RDRqttmpR�R+R|RethitsR,RA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_search�s�	!	 


$cCs|jd|||�S(NRJ(R�(R_R[R�RW((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytgetProvidesscCs|jd|||�S(NRI(R�(R_R[R�RW((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytgetRequiresscCs0|j�rgSt|d�}g}t|�}g}x^|D]V}||jkrYq>n|sn||jkr�|j|j|��q>|j|�q>W|r�g|D]}|j^q�}n|s�|St	j
}t|�|krx0t||�D]}|j|j
||��q�W|Sg}	d}
x|D]}|	jd�q,W|
dj|	�}
x�|jj�D]�\}}
|
j�}t||
|�|r�xF|D]>}|j||d|�}|dkr�q�n|j|�q�Wqfn|j|||dt�qfW|s,|jjg|D]}|^q�n|S(syreturn a list of packages matching any of the given names. This is 
           only a match on package name, nothing elseR�s^select pkgId,pkgKey,name,epoch,version,release,arch
                      from packages where sname = ?s OR ReR8N(R;RR2R�R�textendR-R�R;RftPATTERNS_INDEXED_MAXR�RtsearchNamesRkR�R�RnRR(R>R9R%R(R_tnamestreturn_pkgtupstloaded_all_namest
returnListt
user_namesR)R,tmax_entriestpat_sqlstqsqlR[RPRqRARDR;((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR�sP
	

&c	Cs|j�rgSy%tj|�\}}\}}}Wn(tjk
r_}tjt|��nX|}t|�}	|	}t}
d}tj|�s�t	}
d}ng}g}
xY|j
j�D]H\}}|j�}t
|d||f|f�|j|||�q�Wx�|D]~}tj|�rE|dkrE|
j|�qn|
s�|j||||||ff�r�|
j|�q�q|
j|�qW|dkr�|
Stj|�s�|
S|
j|j|��tj|�r�|
r�tj|
�S|
j|j|��tj|
�S(s3return list of packages matching name and prcotype R<R=s.select DISTINCT pkgKey from %s where name %s ?RJN(R;Rtstring_to_prco_tupleRt	MiscErrortPackageSackErrorR	R%RR&R�R�RnRR9tre_filenameR>R�t	checkPrcoR�RERTRAR](R_R[R�R)RKRR4R5tn_btn_uR<RBt
basic_resultsRCRDRqRAR((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR4NsJ%	

$
cCsB||jkrgS|j|d�}|s>|jj|�n|S(s9return list of packages providing name (any evr and flag)RJ(R�R4R(R_R[R*((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchProvides�scCs|j|d�S(s9return list of packages requiring name (any evr and flag)RI(R4(R_R[((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchRequires�scCs|j|d�S(s:return list of packages obsoleting name (any evr and flag)RG(R4(R_R[((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchObsoletes�scCs|j|d�S(s@return list of packages conflicting with name (any evr and flag)RH(R4(R_R[((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchConflicts�scCs�dGHdd1d��Y}|�}|d|d|d|d|df|_||_|d	|_|rm|Si|d
d6|dd
6|_i|dd6dd6|dd6|_idd6|dd6|d	d6|_i|dd6|dd6|_i|dd6|dd6|d d!6|_i	|d"d"6|d#d#6|d$d%6|d&d'6|d(d)6|d*d+6|d,d,6|d-d.6|d/d06|_|S(2Nsdie die die die die db2classt	tmpObjectcBseZRS((RR�(((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��sR[RURWRYR\RVR{tstartR}tendR�threfR�R RtbasetYEStpkgidRfR�RytbuildR�R�RstpackageRutarchiveRwt	installedR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�((	R0RMRVthdrangetlocationtchecksumttimetsizetinfo(R_Rlt
nevra_onlyR�ty((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytdb2class�s&	,	
&*'cCs�|stjj||||�Sg}xR|jj�D]A\}}|j�}t|d|�|j|||dt�q5W|s�t	j
d|�ntj|�S(NsYselect pkgId,pkgKey,name,epoch,version,release,arch from packages where name=? and arch=?R8sNo Package Matching %s.%s(
R�R�treturnNewestByNameArchR�R�RnRR9R%RR�RtnewestInList(R_tnaTuptpatternstignore_casetallpkgRDRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��scCs�|j�rgS|s/tjj||||�Sg}xU|jj�D]D\}}|j�}t|d|f�|j|||dt	�qEW|s�t
jd|�ntj
|�S(sBreturn 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.
           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. sNselect pkgId,pkgKey,name,epoch,version,release,arch from packages where name=?R8sNo Package Matching %s(R;R�R�treturnNewestByNameR�R�RnRR9R%RR�RR�(R_R[R�R�R�RDRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��s	cCs>|j�rgggfSg}g}t|�}x�|D]�}tj|�rntidd6|d6}|}ntidd6|d6}|}xq|jj�D]`\}}	|	j�}
t|
|�|j	||
�}t
|�r�|j|�n|j|�q�Wq8Wtj
|�}tj
|�}tj
|�}|||fS(NR<toptqR=(R;R�RRtPARSE_QUERYR�R�RnRR9R�tremoveR�RA(R_tpkgspecstmatchedt
exactmatcht	unmatchedtptquerytmatchresRDRlRAtpmatches((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytmatchPackageNames�s,

	
c
Cs^|d
krg}ndddddddg}t}x<|D]4}tj|�r=|sg||jkr=t}Pq=q=Wtj}|s�dg}tj}nt	|�|kr�g}n|r�t
|�}n�g}t}	xL|D]D}tj|�r
|j|df�t}	q�|j|d	f�q�W|rH|	rH|rH|||tfS|}|||tfS(szSetup need_full and patterns for _yieldSQLDataList, also see if
           we can get away with just using searchNames(). R[tsql_nameArchtsql_nameVerRelArchtsql_nameVertsql_nameVerRelt	sql_envrat	sql_nevraR<R=N(
R>R&Rtre_full_search_neededR�R%RfRgR�R�RRR�(
R_ROR�R�R`t	need_fulltpattpat_maxR�t	need_glob((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_setupPkgObjLists<		
			
	ccsAg}g}x�|D]}\}}|r;||jkr;qnxR|D]J}	|rh|jd|	|f�n|jd|	|f�|j|�qBWqW|r�|r�dS|r�tdj|�}
nd}
xs|jj�D]b\}}|dks�||jkr�|j�}
t	|
|
|�x|
D]}||fVq!Wq�q�WdS(s^Yields all the package data for the given params. Excludes are done
           at this stage. s%s LIKE ?%ss%s %s ?Ns OR sYselect pkgId, pkgKey, name,epoch,version,release,arch
                      from packages(
R�R�t_FULL_PARSE_QUERY_BEGRkR�R�R>RNRnR(R_ROR�R`R�R�tpat_dataR[trestRBR�RPRqRAR�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_yieldSQLDataList7s*


cCs�g}|j|||�}|\}}}}|r@|j|�Sx^|j||||�D]D\}	}
|j|	|
d|
�}|dkr�qYn|j|�qYW|r�|dkr�||_t�|_n|r|dkr|jj	g|D]}|j
^q��n|rqx`|D]U\}}
|
dkr3qnx4|D],}|j
|kr:|jj|j
�Pq:q:WqWn|s�x'|D]\}}
|jj|�q~Wn|S(sjBuilds a list of packages, only containing nevra information.
           Excludes are done at this stage. ReR=R�N(R=R�(
R�R�R�R&R>R�R�R2R�RR[RR�(R_ROR�R�R�R3R�R`R�RPR�RR�R�R,((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt_buildPkgObjListWs8
	)
cCs�|j�rgSt|d�}|r4|j�}n$|j|||�}t|d�}|r�|r�t}t|||dd�}|d|d}n|dkr�|r�|}n|Sg}x0|D](}||jkr�q�n|j|�q�W|S(s�Returns a list of packages, only containing nevra information. The
           packages are processed for excludes. Note that the packages are
           always filtered to those matching the patterns/case. R�RAsrepo-pkgkeyiiN(	R;RR�R�R&RR>ROR�(R_ROR�R�tinternal_pkgoblistR�R�R((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytreturnPackages~s,	

cCs�|j�rgSt|d�}|r;tjj|||�Sd}g}|j|||�}|\}}}}	|	r�g|j|�D]}
|
j^q�Sx^|j	||||�D]D\}}|j
||d|�}
|
dkr�q�n|j|
�q�W|S(s�Returns a list of pkg tuples (n, a, e, v, r), optionally from a
           single repoid. Note that the packages are always filtered to those
           matching the patterns/case. R�ReN(R;RR�R�t
simplePkgListR>R�R�R;R�R(R�(R_R�R�R�ROR�R3R�R`R�R,RPR�R;((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��s&#cCs�|j�rgSg}|r�x�|jd|g�D]�}t}x]d|fd|fd|fd|fgD]1\}	}
|
rit||	�|
krit}PqiqiW|r2|j|�q2q2W|St}x,|||||fD]}|r�t}q�q�W|r�|Sd}
x�d|fd|fd|fd|fd|fgD]P\}	}
|
r5|
dd	krn|
d
|	|
f}
q�|
d|	|
f}
q5q5WxO|jj�D]>\}}|j�}t	||
�|j
|||dt�q�W|S(
s6return list of pkgobjects matching the nevra requestedR�RURWR\RYsGselect pkgId,pkgKey,name,epoch,version,release,arch from packages WHERER[i����tWHEREs AND %s = "%s"s
 %s = "%s"R8(R;R�R%RmR&R�R�R�RnRR9(R_R[RURXRZR\R�R,R'tcoltvartemptytargR�RDRqRA((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytsearchNevra�s@"
"
c	Cs|jdkr!t|�|_n|jj|�|_td�|�}dj|�}x�|jj�D]�\}}|j�}|j	j
d�sgd|jkr�qgnt}t|d�x(|D] }|d|kr�t
}Pq�q�W|sg|j|�dSqgWdS(sBexcludes incompatible arches - archlist is a list of compat archescSsd|S(Ns'%s'((R�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyRd�st,s-sourcetsrcs"SELECT DISTINCT arch FROM packagesiN(R�R>R2tintersectionR�RkR�R�RnRNR�R&RR%R
(	R_tarchlistt	sarchlistt
arch_queryRDRqRAthas_archtrow((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytexcludeArchs�s$"


N(NNN(NNN(@RR�RRaRRrR�R�R�R�RRRR	RR
RRRRRR�R!R%R%R&R(R-R>R2R6R&R9R;RERFRHR]RbRtR}R~R�R�R�R�R�R�R4R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR��s�											
				A				)		
			}4%[;A					(	 &#,cCs
dj|�S(NR�(Rk(tfilenamelist((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytencodefilenamelist
scCs|jdd�}|jd�S(Ns//R�(R_R(tfilenamestring((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR�scCsDd}idd6dd6dd6}x|D]}|||7}q(W|S(NR�RKR�tdtdirtgtghost((tfiletypelistR�t	ft2stringR�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pytencodefiletypelists

cCs6idd6dd6dd6}g|D]}||^q"S(NR�RKR�R�R�R�((tfiletypestringt	string2ftR�((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyR� ss�
select pkgKey from packages
where name %(op)s '%(q)s'
   or name || '.' || arch %(op)s '%(q)s'
   or name || '-' || version %(op)s '%(q)s'
   or name || '-' || version || '-' || release %(op)s '%(q)s'
   or name || '-' || version || '-' || release || '.' || arch %(op)s '%(q)s'
   or epoch || ':' || name || '-' || version || '-' || release || '.' || arch %(op)s '%(q)s'
   or name || '-' || epoch || ':' || version || '-' || release || '.' || arch %(op)s '%(q)s'
s�
SELECT pkgId,pkgKey,name,epoch,version,release,arch,
  name || "." || arch AS sql_nameArch,
  name || "-" || version || "-" || release || "." || arch AS sql_nameVerRelArch,
  name || "-" || version AS sql_nameVer,
  name || "-" || version || "-" || release AS sql_nameVerRel,
  epoch || ":" || name || "-" || version || "-" || release || "." || arch AS sql_envra,
  name || "-" || epoch || ":" || version || "-" || release || "." || arch AS sql_nevra
  FROM packages
  WHERE
(*R>tos.pathRR�tpackagesRRRRRRRRRRtrpmUtils.miscutilsR�RfRityum.miscRtyum.i18nRR	RRR�RR!R*R8R@RERFR�R�R�R�RR�R�R�(((s2/usr/lib/python2.7/site-packages/yum/sqlitesack.pyt<module>sF"					C	������T					

Zerion Mini Shell 1.0