ok

Mini Shell

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

�
8M�bc@sddlZddlZddlZddlZddlZddlZddlZddlZd�Z	d�Z
d�Zed�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zejdd
�Zd�Zd�Zd�Zd�Zd�ZdS(i����NcCs(t|�tjkr$t|�}n|S(N(ttypettypest
StringTypetstr(targ((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytrpmOutToStrsc	Cs�|\}}}|\}}}|dkr3d}nt|�}t|�}t|�}|dkrld}nt|�}t|�}t|�}tj|||f|||f�}|S(Nt0(tNoneRtrpmtlabelCompare(	t.0t.1te1tv1tr1te2tv2tr2trc((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyt
compareEVR$s		$cCstd|dfd|df�S(s-compare version strings only using rpm vercmpt(R(R
R((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytcompareVerOnly9scCs�d}|jd�}tj|tj�}y|j|�}Wn�tjk
r�}t|�dkrmd}nt|�dkr�d}nt|�dkr�d}nt|�dkr�d}q�n;Xt|�\}}	|d	kr�tj	|�~d
}n~|r�|dkr�tj
|dd�tjtj�|j
||�}
|
s�d}tj
|dd�tjtj�|j
||�ntjtj�nytj	|�Wntk
r�}nX|j|�|S(s�Takes a transaction set and a package, check it's sigs.

    By default, only v4 sigs (header-only) will be verified (faster).  By
    setting payload to True, v3 sigs (header+payload) will also be verified
    (slower).

    return 0 if they are all fine
    return 1 if the gpg key can't be found
    return 2 if the header or payload is in someway damaged
    return 3 if the key is not trusted 
    return 4 if the pkg is not gpg or pgp signedispublic key not availaiableispublic key not availablespublic key not trustediserror reading package headeriiei(t
setVSFlagstostopentO_RDONLYthdrFromFdnoRterrorRt
getSigInfotclosetlseektsetVerbositytRPMLOG_WARNINGt_verifySigstRPMLOG_INFOt
RPMLOG_NOTICEtOSError(ttstpackagetpayloadtvaluetcurrentflagstfdnothdrteRtsiginfotvalid((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytcheckSig=sH
			

	
cCs�tjtjd�d}|j|�}|dkrUd}|jd�\}}}nd}d}d}d}|||f}||fS(	sXchecks signature from an hdr hand back signature information and/or
       an error codetCs�%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|s(none)it,ietMD5R(tlocalet	setlocaletLC_ALLtsprintftsplit(R+tstringR-Rtsigtypetsigdatetsigidt	infotuple((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyR{scCs�|d}|tjs*|tjdkr7|d}nd}|d}|d}|d}|d	krpd}n|||||f}|S(
s^return a pkgtuple (n, a, e, v, r) from a hdr object, converts
       None epoch to 0, as well.tnameitarchtsrctversiontreleasetepochRN(RtRPMTAG_SOURCERPMtRPMTAG_SOURCEPACKAGER(R+R=R>tvertrelRBtpkgtuple((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytpkgTupleFromHeader�s
 



	cCs4|\}}}}}t||d|||ff�S(sureturns true if the package epoch-ver-rel satisfy the range
       requested in the reqtuple:
       ex: foo >= 2.1-1tEQ(trangeCompare(treqtupleRGtntaR,tvtr((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyt
rangeCheck�sc
Cs|\}}\}}}|\}}\}	}
}||kr@dS|sN|rRdS|dkrgd}n|dkr|d}	n|dkr�d}
n|dkr�d}nt|	|
|f|||f�}|dkr$|dkr�dS|dkr|dkrdSn|dkr$|dkr!dSq$n|dkr�|dkrO|dkrOdSn|dkrn|dkrndSn|dkr�|dkr�dSn|dkr�|d kr�dSn|d!kr�|d"kr�dSq�n|dkr|d#kr�|d$kr�dSn|d%krdSndS(&s,returns true if provtuple satisfies reqtupleiitGTtGEiit>s>=RIit=tLEi
tLTis<=t<i����N(RQRRiiRSs>=(sEQiRT(RUi
RVis<=RW(	RURVsEQi
iis<=RWRT(RURVi
is<=RW(RQiRS(RQRRiiRSs>=(RRis>=(RQRRsEQRUiiii
RSs>=RTs<=(sEQiRT(	sEQRRRUiii
RTs>=s<=(RUi
s<=(sEQRURVRRii
iiRTs<=RWs>=(RViRW(RURVi
is<=RW(	RQRRsEQiiiRSs>=RT(RQRRiiRSs>=(RURVi
is<=RW(RR(
RKt	provtupletreqntreqftreqetreqvtreqrRLtfR,RNROR((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyRJ�s^				!

cCsDt|�}|dkrgSi}yx|D]}d||<q,WWntk
rW~nX|j�Syt|�}|j�Wntk
r�~n{X|dks�t�|d}d}}xI||kr|||kr�||||<}|d7}n|d7}q�W|| Sg}x*|D]"}||kr|j|�qqW|S(sReturn a list of the elements in s, but without duplicates.

    For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
    unique("abcabc") some permutation of ["a", "b", "c"], and
    unique(([1, 2], [2, 3], [1, 2])) some permutation of
    [[2, 3], [1, 2]].

    For best speed, all sequence elements should be hashable.  Then
    unique() will usually work in linear time.

    If not possible, the sequence elements should enjoy a total
    ordering, and if list(s).sort() doesn't raise TypeError it's
    assumed that they do enjoy a total ordering.  Then unique() will
    usually work in O(N*log2(N)) time.

    If that's not possible either, the sequence elements must support
    equality-testing.  Then unique() will usually work in quadratic
    time.
    ii(tlent	TypeErrortkeystlisttsorttAssertionErrortappend(tsRLtutxtttlasttlastiti((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytunique�s:


	




c
Cs�|ddkr|d }n|jd�}||d}|| jd�}||d|!}|| jd�}||d|!}|jd�}|dkr�d}n
|| }||d|!}	|	||||fS(	s�
    Pass in a standard style rpm fullname 
    
    Return a name, version, release, epoch, arch, e.g.::
        foo-1.0-1.i386.rpm returns foo, 1.0, 1, i386
        1:bar-9-123a.ia64.rpm returns bar, 9, 123a, 1, ia64
    i����s.rpmt.it-t:i����R(trfindtfind(
tfilenamet	archIndexR>trelIndexRFtverIndexREt
epochIndexRBR=((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyt
splitFilenameDs	
	
ic	Cs�tjj�}|j|�}~|tjp1d}|dkrStjd|�ntjdddt
j|d|��}x/|j|�}|dkr�Pn|j
|�q}|j�dS(s�Performs roughly the equivalent of rpm2cpio(8).
       Reads the package from fdno, and dumps the cpio payload to out,
       using bufsize as the buffer size.tgzips$Unsupported payload compressor: "%s"trbRN(trpmUtilsttransactiontinitReadOnlyTransactionRRtRPMTAG_PAYLOADCOMPRESSORt
RpmUtilsErrorRytGzipFileRRtfdopentreadtwriteR(R*touttbufsizeR%R+tcomprR^ttmp((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytrpm2cpiocs
'cCs�|}|r�t|�td�ks<t|�td�kr�|tjtjBtjB@r�|d}|tj@r{|d}n|tj@r�|d}n|tj@r�|d}n|r�d||f}q�q�n|S(s�
    Return a human readable requirement string (ex.  foobar >= 2.0)
    @param name: requirement name (ex. foobar)
    @param version: requirent version (ex. 2.0)
    @param flags: binary flags ( 0010 = equal, 0100 = greater than, 1000 = less than )
    ilt RWRSRTs%s %s(RRt
RPMSENSE_LESStRPMSENSE_GREATERtRPMSENSE_EQUAL(R=R@tflagsRf((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyt
formatRequirezs6






cCsn|d@}|dkrdS|dkr*dS|dkr:dS|dkrJdS|d	krZd
S|dkrjdS|S(
NiiiRViRQiRIi
RUiRR(R(R�((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytflagToString�s
cCs|dkrdS|jd�}|dkrbytt|| ��}Wqhtk
r^d}qhXnd}|jd�}|dkr�||d|!dkr�d}n||d|!}||d}n1||ddkr�d}n||d}d}|||fS(	NRRpi����RRoi(NR(NNN(RRrRtlongt
ValueError(t	verstringRlRBtjR@RA((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pytstringToVersion�s(

		cCs�ytj|tj�}Wntk
r:}tjd�nXy|j|�}Wn/tjk
r}tj	|�tjd�nXt
|�tjkr�tj	|�tjd�ntj	|�|S(s>hand back the rpm header or raise an Error if the pkg is fubarsUnable to open filesRPM Error opening Packages RPM Error opening Package (type)(RRRR$R{RRRRRRR+(R%R&R*R,R+((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pythdrFromPackage�s


cCsbttd�r^ttd�r^tjtjtjtjtjtjg�r^t	j
d�q^ndS(NtcheckSignalst
signalsCaughti(thasattrRR�tsignaltSIGINTtSIGTERMtSIGPIPEtSIGQUITtSIGHUPtsystexit(((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyR��s(RRRyRR�R3R�trpmUtils.transactionR{RRRtFalseR/RRHRPRJRmRxtstdoutR�R�R�R�R�R�(((s6/usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyt<module>s.			>			
	P	E					

Zerion Mini Shell 1.0