ok

Mini Shell

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

�
8M�bc@s_ddlZddlZddlZddlZddlZddlmZmZddlmZddl	m
Zd�ZeZ
d�Zd�Zdd	�Zd
�Zd�Zd�Zd
�Zd�Zd�ZddgZdejfd��YZddd�Zddd��YZdefd��YZdefd��YZddd��YZdS( i����N(twrite32utFNAME(tURLGrabError(terrorcCstj|IJdS(N(tsyststderr(tnumtmsg((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytlogscCs|S(N((R((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt_scCs�t|�}d}|jdkr*d}n-||j�ksN||j�krWd}n|rtdtd�||f��ndS(s�check a header by opening it and comparing the results to the name and arch
       we believe it to be for. if it fails raise URLGrabError(-1)iii����s1Header cannot be opened or does not match %s, %s.N(tHeader_WorkthdrtNonetnametarchRR	(t
headerfileR
Rthtfail((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytcheckheaders	$	"icCs�tjd�tj|tj�}ytj|�Wntjk
rQ}d}nXd}tj|�tjd�|r�|s�t	dt
d�|��q�dSn|SdS(sdtake a package, check it out by trying to open it, return 1 if it's good
       return 0 if it's nottmd5iitdefaulti����sRPM %s fails md5 checkN(ttstsigCheckingtostopentO_RDONLYthdrFromFdnotrpmRtcloseRR	(tpackageturlgraberrortfdnotetgood((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytcheckRpmMD5%s



cCs�tjd�tj|tj�}ytj|�}Wnntjk
r�}t|�dkr`dSt|�dkrvdSt|�dkr�dSt|�dkr�dSn6Xt	|�\}}|d	kr�tj
|�~d
S~tj
|�dS(s� take a package, check it's sigs, return 0 if they are all fine, return 
    1 if the gpg key can't be found,  2 if the header is in someway damaged,
    3 if the key is not trusted, 4 if the pkg is not gpg or pgp signedRspublic key not availaiableispublic key not availablespublic key not trustediserror reading package headeriieii(RRRRRRRRtstrt
getSigInfoR(RRRR Rtsiginfo((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytcheckSig;s*


cCssd}|j|�}|dkrBd}|jd�\}}}nd}d}d}d}|||f}||fS(sEchecks if a computerhand back signature information and an error codes�%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|s(none)it,ietMD5R(tsprintftsplit(RtstringR%Rtsigtypetsigdatetsigidt	infotuple((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR$WscCsXg}|tj}|dkr"n2t|�tjkrG|j|�n
|j|�|S(N(RtRPMTAG_PROVIDENAMERttypettypestListTypetextendtappend(theadert	provnamestprovides((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytgetProvidesgs

c

Cs�|\}}}|\}}}d�}||�}||�}||�}||�}||�}||�}tj|||f|||f�}	tdd|||||||	f�|	S(NcSs4t|�tjkr0|dkr0t|�}n|S(N(R1R2t
StringTypeRR#(targ((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytrpmOutToStrvs!is%s, %s, %s vs %s, %s, %s = %s(RtlabelCompareR(
t.0t.1te1tv1tr1te2tv2tr2R<trc((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt
compareEVRrs	$&cCs�|r�|tjtjBtjB@r.|d}n|tj@rH|d}n|tj@rb|d}n|tj@r�|d}|d|}q�n|S(Nt t<t>t=s %s(Rt
RPMSENSE_LESStRPMSENSE_GREATERtRPMSENSE_EQUAL(R
tversiontflags((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt
formatRequire�s






cCsFytjtj�}Wn)tjk
rA}tdtd��nX|S(NisFCould not open RPM database for reading. Perhaps it is already in use?(RtTransactionSettconftinstallrootRterrorlogR	(tdbR ((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt	openrpmdb�s
tGzipFileRcBseZd�ZRS(cCs�|jjd�|jjd�|jd }d}|rBt}n|jjt|��t|jtd��|jjd�|jjd�|r�|jj|d�ndS(Ns�si����iss�t(tfileobjtwritetfilenameRtchrRtlong(tselftfnameRP((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt_write_gzip_header�s
	(t__name__t
__module__Ra(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRX�strbi	cCst|||�S(N(RX(R\tmodet
compresslevel((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt	_gzipOpen�st
RPM_Base_WorkcBskeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cCs
d|_dS(N(RR(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt__init__�scCs=|jdkr2tdtd��tjd�n|j|S(Nis-Got an empty Header, something has gone wrongi(RRRUR	Rtexit(R_ttag((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt_getTag�scCs!|jd�dkrdSdSdS(Nt
sourcepackageii(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytisSource�scCs
|jd�S(NR
(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR
�scCs
|jd�S(NR(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR�scCs
|jd�S(Ntepoch(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRo�scCs
|jd�S(NRO(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRO�scCs
|jd�S(Ntrelease(Rl(R_((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRp�scCs:|jd�}|jd�}|jd�}|||fS(NRoRORp(Rl(R_R tvtr((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytevr�scCs^|jd�}|jd�}|jd�}|jd�}|jd�}|||||fS(NR
RoRORpR(Rl(R_tnR RqRrta((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytnevra�sc
Cs�|j�\}}}}}|dkr0d}n|j�rXd|||||f}nd||||||f}|r�t|d�}	nt|d�}	|	j|jjd��|	j�|S(Nt0s%s/%s-%s-%s-%s.src.hdrs%s/%s-%s-%s-%s.%s.hdrtwi(	RvRRnRgRR[RtunloadR(
R_t	headerdirtcompressR
RotvertrelRtheaderfnt	headerout((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytwriteHeader�s	
(
RbRcRiRlRnR
RRoRORpRsRvR�(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRh�s										R
cBseZdZd�ZRS(s�for operating on hdrs in and out of the rpmdb
       if the first arg is a string then it's a filename
       otherwise it's an rpm hdrcCslt|�tjkrYyetj|d�}ytj|j��}Wn3tjk
rx}t	dt
d�|�d}nXWn�tk
r�}t|d�}ytj|j��}WqLtjk
r�}t	dt
d�|�d}qLXn_t
k
r}t	dt
d�|�d}n0tk
rK}t	dt
d�|�d}nX|j�n|}||_dS(NRrisDamaged Header %s(R1R2R:tgzipRRt
headerLoadtreadRRUR	RtIOErrort
ValueErrort	zlibErrorRR(R_R6tfdRR ((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRi�s0
	

(RbRct__doc__Ri(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR
�stRPM_WorkcBseZd�ZRS(cCs�tjtj�tj|tj�}ytj|�|_Wn<tj	k
rz}t
dtd�||f�d|_nXtj
|�dS(NisError opening rpm %s - error %s(Rt
setVSFlagsRt_RPMVSF_NOSIGNATURESRRRRRRRUR	RR(R_trpmfnR�R ((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRis
(RbRcRi(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR�stRpm_Ts_WorkcBs>eZdZdd�Zd�Zdddd�Zd�ZRS(s�This should operate on groups of headers/matches/etc in the rpmdb - ideally it will 
    operate with a list of the Base objects above, so I can refer to any one object there
    not sure the best way to do this yet, more thinking involvedt/cCs�y+tjr*tjdkr*tj}q*nWntk
r@}nXtj|�|_dddddddd	d
ddg|_dS(
NR�t
addInstalltaddErasetruntchecktorderRtcloseDBtdbMatchtsetFlagsR�t
setProbFilter(RSRTt	NameErrorRRRRtmethods(R_tdbPathR ((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRi!s	cCs,||jkrt|j|�St|�dS(N(R�tgetattrRtAttributeError(R_t	attribute((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt__getattr__.scCsOg}|dkr<|dkr<|dkr<|jj�}n�|dkr`|jj||�}n�|dkr�|jj�}|j|tj|�n�|dkr�|jj�}|j|tj|�nY|dkr�|jj�}|j|tj|�n%|jj�}|j|tj|�x'|D]}t	|�}|j
|�q(W|S(s(hands back a list of Header_Work objectstglobtregextstrcmpN(RRR�tpatternRtRPMMIRE_GLOBt
RPMMIRE_REGEXtRPMMIRE_STRCMPtRPMMIRE_DEFAULTR
R5(R_RktsearchtmirethwlistthdrlistRthdrobj((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pytmatch4s($
cCs||dkr*|jjtjtjB�nN|dkrM|jjtj�n+|dkro|jjtj�n	t|�dS(sApass type of check you want to occur, default is to have them offRtnoneRN(RR�RtRPMVSF_NOMD5tRPMVSF_NEEDPAYLOADR�tRPMVSF_DEFAULTR�(R_tsig((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyRSsN(RbRcR�RiR�RR�R(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyR�s

	(((RR2RR�RRRturlgrabber.grabberRtzlibRR�RRUR	RR"R&R$R9RGRQRWt__all__RXRgRhR
R�R�(((s5/usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyt<module>s2										A 

Zerion Mini Shell 1.0