MINI MINI MANI MO

Path : /lib/python2.7/site-packages/yum/
File Upload :
Current File : //lib/python2.7/site-packages/yum/misc.pyc


[c@sdZddlZddlZddlZddlZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddgZyddlZejdWnek
rTdZnXddlmZmZddl Tyddl!Z!ddl"Z!Wnek
rdZ!nXy+ddl#Z#e$d	d
ddd
gZ%WnNek
r&ddl&Z&ddl'Z'e$d	d
gZ%ddXdYZ#nXe$Z(xe)e%D]Z*ye#j+e*Wq=e,k
rZ-e.e-e/re0e-j1dre(j2e*nej3de4e*IJe%j5e*q=Xq=Wx0dYD]Z*e*e%kre*gZ6PqqWedddlm7Z7m8Z8ddl9m:Z:m;Z;ia<ia=dZ>dZ?da@dZAeBdZCdaDdZEdZFdZGdaHdZIdZJdZKddZd YZLd!d[d"YZMd\dd%ZNd&ZOd'd]d(YZPd)ZQd*d+ZReBd,ZSd-ZTd.ZUddeVd/ZWd0ZXdd1ZYd2eVd3d4ZZd5Z[d6Z\d7Z]d8Z^d9Z_d:Z`d;Zad<Zbd=Zcd>Zdd?d@Zed?dAZfdBZgdCjhdDeidEDZjeBdFZkdGZleBdHZmdIZndaodJZpddlqZqeVeBdKZrdLZsdMZtdNZudOZvdeBeBdPZweBdQZxeVdRZydazdSZ{dTZ|dUZ}dVZ~dWZdS(^s%
Assorted utility functions for yum.
iN(tStringIOtgztbz2txz(tstringToVersiontflagToString(t*tmd5tsha1tsha256tsha384tsha512thashlibcBseZedZRS(cCs9|dkrtjS|dkr,tjStddS(NRRsBad checksum type(Rtnewtshat
ValueError(talgo((s,/usr/lib/python2.7/site-packages/yum/misc.pyR
4s


(t__name__t
__module__tstaticmethodR
(((s,/usr/lib/python2.7/site-packages/yum/misc.pyR2ssdisabled for fipssChecksum type %s disabledsbroken hashlib(t	MiscErrortFIPSNonCompliantError(tto_utf8t
to_unicodecCsGt}t|trt}nt|tjkr7|S|j||S(s Take a value and use the same value from the store,
        if the value isn't in the store this one becomes the shared version. (t_share_data_storet
isinstancetunicodet_share_data_store_uttypettypest	TupleTypet
setdefault(tvaluetstore((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
share_data[s	cCsiaiadS(N(RR(((s,/usr/lib/python2.7/site-packages/yum/misc.pytunshare_datakscCs+tdkr!tjdjant|S(s( Tests if a string is a shell wildcard. s[*?]|\[.+\]N(t_re_compiled_glob_matchtNonetretcompiletsearch(ts((s,/usr/lib/python2.7/site-packages/yum/misc.pytre_globrscstr[y5|rtjp!d}tjtj|jSWq[tjk
rWq[Xn|rzjfdSfdS(s5 Compile shell wildcards, return a 'match' function. ics|jkS(N(tlower(R)(tpat(s,/usr/lib/python2.7/site-packages/yum/misc.pyt<lambda>scs
|kS(N((R)(R,(s,/usr/lib/python2.7/site-packages/yum/misc.pyR-s(	R*R&tIR'tfnmatcht	translatetmatchterrorR+(R,tignore_casetflags((R,s,/usr/lib/python2.7/site-packages/yum/misc.pytcompile_pattern{s 
cCs+tdkr!tjdjant|S(s Tests if a string could be a filename. We still get negated character
        classes wrong (are they supported), and ranges in character classes. s[/*?]|\[[^]]*/[^]]*\]N(t_re_compiled_filename_matchR%R&R'R1(R)((s,/usr/lib/python2.7/site-packages/yum/misc.pytre_filenamescCs$t|rtS|dkr tStS(s" Tests if a filename string, can be matched against just primary.
        Note that this can produce false negatives (Eg. /b?n/zsh) but not false
        positives (because the former is a perf hit, and the later is a
        failure). Note that this is a superset of re_primary_dirname(). s/usr/lib/sendmail(tre_primary_dirnametTruetFalse(tfilename((s,/usr/lib/python2.7/site-packages/yum/misc.pytre_primary_filenames
cCs'd|krtS|jdr#tStS(s~ Tests if a dirname string, can be matched against just primary. Note
        that this is a subset of re_primary_filename(). sbin/s/etc/(R9t
startswithR:(tdirname((s,/usr/lib/python2.7/site-packages/yum/misc.pyR8s
cCsdtdkr?tjdj}tjdj}||fanxtD]}||rFtSqFWtS(sC Tests if a string needs a full nevra match, instead of just name. s.*([-.*?]|\[.+\]).s[0-9]+:N(t_re_compiled_full_matchR%R&R'R1R9R:(R)tonettwotrec((s,/usr/lib/python2.7/site-packages/yum/misc.pytre_full_search_neededs
cCsI|j}|jdrtS|jdr2tS|jdrEtStS(s8 Tests if a string is a "remote" URL, http, https, ftp. shttp://shttps://sftp://(R+R=R9R:(R)((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
re_remote_urlscCs,t|}|dkrgSyt|}Wntk
r?nXt|Syt|}|jWntk
rz~n{X|dkst|d}d}}xI||kr|||kr||||<}|d7}n|d7}qW|| 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(tlentsett	TypeErrortlisttsorttAssertionErrortappend(R)tntutttlasttlastititx((s,/usr/lib/python2.7/site-packages/yum/misc.pytuniques6

	




t	ChecksumscBszeZdZd
eedZdZeddZdZ	ddZ
d	Zd
d
ZdZ
d
dZRS(sn Generate checksum(s), on given pieces of data. Producing the
        Length and the result(s) when complete. cCs|dkrt}ng|_g|_d|_t}x|D]}|dkr[d}n||krmq@n|tkrtj|}n4|rq@n(|t	krt
|n
td||j||jj
||jj
|q@W|r
|r
tdndS(NiRRs(Error Checksumming, bad checksum type %ss*Error Checksumming, no valid checksum type(R%t_default_checksumst	_sumalgost	_sumtypest_lenRFt_available_checksumsRR
t_fips_noncompliantRRtaddRK(tselft	checksumstignore_missingtignore_nonetdonetsumtypetsumalgo((s,/usr/lib/python2.7/site-packages/yum/misc.pyt__init__	s.					
	

cCs|jS(N(RX(R\((s,/usr/lib/python2.7/site-packages/yum/misc.pyt__len__%stfgetcCs|jS(N(RX(R\((s,/usr/lib/python2.7/site-packages/yum/misc.pyR-)scCs:|jt|7_x|jD]}|j|qWdS(N(RXRERVtupdate(R\tdataRb((s,/usr/lib/python2.7/site-packages/yum/misc.pyRf+siicCs |j|}|j||S(N(treadRf(R\tfotsizeRg((s,/usr/lib/python2.7/site-packages/yum/misc.pyRh0s
cCs@i}x3t|j|jD]\}}|j||<qW|S(N(tzipRWRVt	hexdigest(R\tretRatsumdata((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
hexdigests5s"cCsL|dkr)|jsdS|jd}n|dkr>d}n|j|S(NiRR(R%RWRo(R\tchecksum((s,/usr/lib/python2.7/site-packages/yum/misc.pyRl;s		cCs@i}x3t|j|jD]\}}|j||<qW|S(N(RkRWRVtdigest(R\RmRaRn((s,/usr/lib/python2.7/site-packages/yum/misc.pytdigestsDs"cCsL|dkr)|jsdS|jd}n|dkr>d}n|j|S(NiRR(R%RWRr(R\Rp((s,/usr/lib/python2.7/site-packages/yum/misc.pyRqJs		Ni(RRt__doc__R%R:RcRdtpropertytlengthRfRhRoRlRrRq(((s,/usr/lib/python2.7/site-packages/yum/misc.pyRTs					tAutoFileChecksumscBs2eZdZeedZdZddZRS(sk Generate checksum(s), on given file/fileobject. Pretending to be a file
        object (overrrides read). cCs"||_t||||_dS(N(t_foRTR](R\RiR]R^R_((s,/usr/lib/python2.7/site-packages/yum/misc.pyRcXs	cCst|j|S(N(tgetattrRw(R\tattr((s,/usr/lib/python2.7/site-packages/yum/misc.pyt__getattr__\sicCs|jj|j|S(N(R]RhRw(R\Rj((s,/usr/lib/python2.7/site-packages/yum/misc.pyRh_s(RRRsR:RcRzRh(((s,/usr/lib/python2.7/site-packages/yum/misc.pyRvTs	iicCsyt|tjkr!|}nt|d}t|g}x5|j||rv|dk	rB|j|krBPqBqBWt|tjkr|j	n|dk	r||jkrd||j
|fS|j
|SWn&ttfk
r}t
d|nXdS(stakes filename, hand back Checksum of it
       sumtype = md5 or sha/sha1/sha256/sha512 (note sha == sha1)
       filename = /path/to/file
       CHUNK=65536 by defaulttrs!%u!%ss#Error opening file for checksum: %sN(RRtStringTypestopenRTRhR%Rut
StringTypetcloseRltIOErrortOSErrorR(RatfiletCHUNKtdatasizeRiRgte((s,/usr/lib/python2.7/site-packages/yum/misc.pyRpcs	
cCst|}ytj|}Wn&tk
rG}td||fnXx|D]}tjj|d|rt|d|||}qO|s||jd|krOtjj	|d|}|j
|qOqOW|S(sfReturn all files in path matching ext, store them in filelist, 
       recurse dirs return list objects Error accessing directory %s, %st/s%s(REtostlistdirRRtpathtisdirtgetFileListR+tnormpathRK(Rtexttfilelisttextlentdir_listRtdtnewpath((s,/usr/lib/python2.7/site-packages/yum/misc.pyRs
"t
GenericHoldercBs,eZdZddZdZdZRS(sGeneric Holder class used to hold other objects of known types
       It exists purely to be able to do object.somestuff, object.someotherstuff
       or object[key] and pass object to another function that will 
       understand itcCs
||_dS(N(t_GenericHolder__iter(R\titer((s,/usr/lib/python2.7/site-packages/yum/misc.pyRcscCs$|jdk	r t||jSdS(N(RR%R(R\((s,/usr/lib/python2.7/site-packages/yum/misc.pyt__iter__scCs)t||rt||St|dS(N(thasattrRxtKeyError(R\titem((s,/usr/lib/python2.7/site-packages/yum/misc.pyt__getitem__s
N(RRRsR%RcRR(((s,/usr/lib/python2.7/site-packages/yum/misc.pyRs	cCstjdd|}t}d}d}x|jdD]}|jdrXd}q:|ry|jdkryd}q:|r|jdrPq:|r|jdrPq:|r:|j|dq:q:Wtj|j	S(	s-Convert ASCII armoured GPG key to binary
    s
?s
is$-----BEGIN PGP PUBLIC KEY BLOCK-----its"-----END PGP PUBLIC KEY BLOCK-----t=(
R&tsubRtsplitR=tstriptwritetbase64tdecodestringtgetvalue(trawkeytblocktinblocktpastheaderstline((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
procgpgkeys 			icCsn|d}tj|}|rjgtdt||D]}||||!^q;}dj|}n|S(s Given a key_info data from getgpgkeyinfo(), return an ascii
    fingerprint. Chop every 4 ascii values, as that is what GPG does. tfingerprintit (tbinasciithexlifytrangeREtjoin(tinfotchoptfpRQ((s,/usr/lib/python2.7/site-packages/yum/misc.pytgpgkey_fingerprint_asciis
6c
Csg}ytj|}Wn%tk
r@}tt|nXt|dkrbtdnx|D]}|jj}i|jd6t	j
d|dd6|jjd6|jjd6|j
d6td	6td
6}x|jdD]{}t|tjsqn|j|krt|dr`|jtj}	|	d
kr]t|	d|d<Pq]q`qqW|j|qiW|r|S|dSd
S(sReturn a dict of info for the given ASCII armoured key text

    Returned dict will have the following keys: 'userid', 'keyid', 'timestamp'

    Will raise ValueError if there was a problem decoding the key.
    isNo key found in given key datatuserids>Qtkeyidt	timestampRtraw_keythas_sigt	valid_sigthashed_subpaksiN(tpgpmsgtdecode_multiple_keyst	ExceptionRtstrREt
public_keytkey_idtuser_idtstructtunpackRRRR:tuser_idsRt	signatureRtget_hashed_subpaktSIG_SUB_TYPE_CREATE_TIMER%tintRK(
Rtmultiplet
key_info_objstkeysRtkeyt
keyid_blobRRttspkt((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
getgpgkeyinfos<





cCsd|d@S(s[Convert an integer representing a GPG key ID to the hex version string
    used by RPM
    s%08xl((R((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
keyIdToRPMVerscCswt|}xd|jddD]P}|d|krt|dd}||krXdS||krhdSdSqqWd	S(
sd
    Return if the GPG key described by the given keyid and timestamp are
    installed in the rpmdb.  

    The keyid and timestamp should both be passed as integers.
    The ts is an rpm transaction set object

    Return values:
        - -1      key is not installed
        - 0       key with matching ID and timestamp is installed
        - 1       key with matching ID is installed but has a older timestamp
        - 2       key with matching ID is installed but has a newer timestamp

    No effort is made to handle duplicates. The first matching keyid is used to 
    calculate the return result.
    tnames
gpg-pubkeytversiontreleaseiiiii(RtdbMatchR(ttsRRthdrtinstalledts((s,/usr/lib/python2.7/site-packages/yum/misc.pytkeyInstalled	scCstdkrtS|s#d|}ntjj|sEtj|nt|}|tjd<tj	}t
tjj|dd}|jd|j
|j||j
|j|}tjj||tj|r|d}	tjj|	stj|	ddx[tj|d	D]F}
tjj|
}|	d
|}tj|
|tj|dq'Wt
|	ddd}d
}
|j|
|j
qntS(Ns	%s/gpgdirt	GNUPGHOMEsgpg.conftwbRs-rotmodeis/*Rs	/gpg.conftwslock-never    
no-auto-check-trustdb    
trust-model direct
no-expensive-trust-checks
no-permission-warning         
preserve-permissions
(tgpgmeR%R:RRtexiststmakedirsRtenvirontContextR}RRRtimport_tget_keyteditutilt
edit_trusttVALIDITY_ULTIMATEtglobtbasenametshutiltcopytchmodR9(RRtcachedirtgpgdirtmake_ro_copytkey_fotctxRtktrodirtfRtro_ftopts((s,/usr/lib/python2.7/site-packages/yum/misc.pytimport_key_to_pubring*s<







cCstdkstjj|r#gS|tjd<tj}g}xD|jD]6}x-|jD]"}|j	r_|j
|jq_q_WqOW|S(NR(RR%RRRRRtkeylisttsubkeystcan_signRKR(RRtkeyidsRtsubkey((s,/usr/lib/python2.7/site-packages/yum/misc.pytreturn_keyids_from_pubring[s
	c
CstdkrtS|r<tjj|s,tS|tjd<nt|drT|}nt|d}t|dr{|}nt|d}d}tj	}y|j
|||}Wntjk
r}tSX|stS|d}	|	stS|	jtj
tjtjfkrtStS(sAtakes signature , file that was signed and an optional gpghomedirRRhR{iN(RR%R:RRRRRR}Rtverifyt
GpgmeErrortvalidityt
VALIDITY_FULLtVALIDITY_MARGINALRR9(
tsig_filetsigned_filetgpghometsigtsigned_textt	plaintextRtsigsRtthissig((s,/usr/lib/python2.7/site-packages/yum/misc.pytvalid_detached_sigis6		
s/var/tmpsyum-cCstj}y,tj|}|d}tj|}Wntk
rLdSX|rd||f}d||f}tt	j	|}xZ|D]O}tj
|}	t|	drt|	ddkr|	d|kr|SqWnt
jd|d|}
|
S(	sqreturn a path to a valid and safe cachedir - only used when not running
       as root or when --tempcache is setis%s%s-s%s/%s*iitprefixtdirN(RtgeteuidtpwdtgetpwuidturllibtquoteRR%tsortedRtlstattS_ISDIRtS_IMODEttempfiletmkdtemp(ttmpdirtreuseRtuidtusertuptusernametdirpatht	cachedirstthisdirtstatsR((s,/usr/lib/python2.7/site-packages/yum/misc.pytgetCacheDirs"


6cCs4|j|jkrdS|j|jkr,dSdSdS(s+sorts a list of yum package objects by nameiiiN(R(tpkg1tpkg2((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
sortPkgObjs
cCsn|jg}|d}xN|D]F}|j|rG|g}|}q |j|r |j|q q W|S(s, Return the newest in the list of packages. i(tpoptverGTtverEQRK(tpkgsRmtnewesttpkg((s,/usr/lib/python2.7/site-packages/yum/misc.pytnewestInLists

		cCsp|\}}}d}|dkr2|d|7}n|dk	rO|d|7}n|dk	rl|d|7}n|S(	s
    Convert a tuple representing a package version to a string.

    @param evrTuple: A 3-tuple of epoch, version, and release.

    Return the string representation of evrTuple.
    Rit0s%s:s%ss-%sN(iR,N(R%(tevrTupleRtvR{R)((s,/usr/lib/python2.7/site-packages/yum/misc.pytversion_tuple_to_stringscCsc|\}}}idd6dd6dd6dd6d	d
6}|dkrH|Sd|||t|fS(
s7returns a text string of the prco from the tuple formatt>tGTs>=tGERtEQt<tLTs<=tLEs%s %s %sN(R%R/(t	prcoTupleRtflagtevrR4((s,/usr/lib/python2.7/site-packages/yum/misc.pytprco_tuple_to_strings
)c	Cst|tjkr'|\}}}nc|}d}}|ddkr|jdr|j}t|dkr|\}}}qn|dk	r	|tjkr	|tj	kryt
t|}Wqtt
fk
r}tjd|qXq	tj	|}nt|tjtjtjfkrEt|\}}}n0t|tjtjfkru|\}}}n|||||ffS(s:returns a prco tuple (name, flags, (e, v, r)) for a stringiRsgpg(isInvalid version flag: %sN(RRRR%R=RREt	constantstLETTERFLAGStSYMBOLFLAGSRRRRGtErrorsRR~tNoneTypetUnicodeTypeRtListType(	t
prcoStringRLRR.t
prco_splitRtprco_etprco_vtprco_r((s,/usr/lib/python2.7/site-packages/yum/misc.pytstring_to_prco_tuples(
 $cCs7tjd|r$tj|}ntj|}|S(smTakes a search string from the cli for Search or Provides
       and cleans it up so it doesn't make us vomits[*{}?+]|\[.+\](R&R(R/R0tescape(targtrestring((s,/usr/lib/python2.7/site-packages/yum/misc.pytrefineSearchPatternscCsi|tkr%d|}tj|n|dkrFtj|d}nB|dkrgtj|d}n!|dkrtj|d}nt	|d}xt
rPy|jd}Wn>tt
tfk
r}d|t|f}tj|nX|sPny|j|Wqtt
fk
rL}d	|t|f}tj|qXqW|j|jdS(
Ns%s compression not availableRR{RRRisError reading from file %s: %ssError writing to file %s: %s(t_available_compressionR>RRtBZ2FiletlzmatLZMAFiletgziptGzipFileR}R9RhRRtEOFErrorRRR(tsourcetdesttztypetmsgts_fntdestinationRgR((s,/usr/lib/python2.7/site-packages/yum/misc.pyt_decompress_chunked
s2
	
cCst||dddS(s1 Extract the bzipped contents of source to dest. RURN(RY(RSRT((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
bunzipFile/scCstjd}ttjd|}x|D]x}|jd|}x]|D]U}|d}|dd
krxd}nt|}|d|d||d|d	fSWq0WdS(s}This takes the output of uname and figures out the pkgtup of the running
       kernel (name, arch, epoch, version, release).is/boot/vmlinuz*%s*t	basenamestepochR,RtarchRRN(NNNNN(RtunameRRRR%R(RtvertfnstfntmithR((s,/usr/lib/python2.7/site-packages/yum/misc.pytget_running_kernel_pkgtup3s


	(cCs2t|}|ddk	r.|d|dfSdS(sgThis takes the output of uname and figures out the (version, release)
    tuple for the running kernel.iiiN(NN(RdR%(Rtpkgtup((s,/usr/lib/python2.7/site-packages/yum/misc.pyt"get_running_kernel_version_releaseGss/var/lib/yumc	Csg}d|df}d|df}tj|}tj|}xT|D]L}|jdrfqKntjj|}|jdd}|j|qKW|j|S(sreturns a list of the timestamps from the filenames of the unfinished 
       transactions remaining in the yumlibpath specified.
    s%s/%sstransaction-all*stransaction-done*tdisabledstransaction-all.R(RtendswithRRRtreplaceRKRI(	t
yumlibpatht
timestampsttsallgttsdonegttsallsttsdonesRattransR((s,/usr/lib/python2.7/site-packages/yum/misc.pytfind_unfinished_transactionsOs

cCseg}d|d|f}d|d|f}g}tjj|sH|Stjj|rt|d}|j}|jnt|d}|j}|jx-|D]%}	|	|krqn|j|	qWx|D]}	|	jdd}	|	dkrqny|	j\}
}Wn)t	k
rI}d|}
t
j|
nX|j|
|fqW|S(sthis function takes the timestamp of the transaction to look at and 
       the path to the yum lib dir (defaults to /var/lib/yum)
       returns a list of tuples(action, pkgspec) for the unfinished transaction
       elements. Returns an empty list if none.

    s%s/%s.%sstransaction-allstransaction-doneR{s
Rs(Transaction journal  file %s is corrupt.(
RRRR}t	readlinesRtremoveRiRRR>RRK(RRjtto_complete_itemst	tsallpatht
tsdonepathttsdone_itemst	tsdone_fottsall_fottsall_itemsRtactiontpkgspecRRV((s,/usr/lib/python2.7/site-packages/yum/misc.pytfind_ts_remainingcs8




cCs~g}t|}t|}d}xB||krh||}|j|||!||7}||8}q'W|j|||S(sE Given a seq, split into a list of lists of length max_entries each. i(RERHRK(tseqtmax_entriesRmtnumtbegtend((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
seq_max_splits

Rccs'|]}|dkrt|VqdS(i	i
i
N(i	i
i
(tchr(t.0RQ((s,/usr/lib/python2.7/site-packages/yum/misc.pys	<genexpr>si cCst|tkrRyt|dWqtk
rNt|djd}qXnGt|tkrv|jd}n#|dkrdStdt||j}|j	dt
}|jdd}|jdd}|jd	d
}|r|jdd}|jd
d}n|S(s_ Returns xml-friendly utf-8 encoded string.
        Accepts utf-8, iso-8859-1, or unicode.
    sutf-8s
iso-8859-1RsString expected, got %st&s&amp;R4s&lt;R0s&gt;t"s&quot;t's&apos;N(RRRtUnicodeDecodeErrortencodeR%RtreprtrstripR0t_deletecharsRi(Rtattrib((s,/usr/lib/python2.7/site-packages/yum/misc.pytto_xmls&
cCsXytj|Wn@tk
rS}|jtjtjtjtjfkrTqTnXdS(s| Call os.unlink, but don't die if the file isn't there. This is the main
        difference between "rm -f" and plain "rm". N(RtunlinkRterrnotENOENTtEPERMtEACCEStEROFS(R;R((s,/usr/lib/python2.7/site-packages/yum/misc.pytunlink_fs
'cCsiytj|SWnQtk
rd}|jtjtjfkrBdS|r^|jtjkr^dSnXdS(sF Call os.stat(), but don't die if the file isn't there. Returns None. N(RtstatRRRtENOTDIRR%R(R;t
ignore_EACCESR((s,/usr/lib/python2.7/site-packages/yum/misc.pytstat_fscCsXytd}Wntk
r$dSX|j}yt|SWntk
rSdSXdS(s Get the audit-uid/login-uid, if available. None is returned if there
        was a problem. Note that no caching is done here. s/proc/self/loginuidN(R}RR%RhRR(RiRg((s,/usr/lib/python2.7/site-packages/yum/misc.pyt_getloginuids

cCstdkrtantS(s Get the audit-uid/login-uid, if available. None is returned if there
        was a problem. The value is cached, so you don't have to save it. N(t_cached_getloginuidR%R(((s,/usr/lib/python2.7/site-packages/yum/misc.pytgetloginuidscCsy3tjtjd|r2tjtjdnWnCtjk
rx}tjdIJdtjd<tjtjdnX|rdddY}|tj	tj
t_	ndS(NRtCs%Failed to set locale, defaulting to CtLC_ALLt
UnicodeStreamcBs#eZdZdZdZRS(cSs||_||_dS(N(tstreamtencoding(R\RR((s,/usr/lib/python2.7/site-packages/yum/misc.pyRcs	cSs;t|tr'|j|jd}n|jj|dS(NRi(RRRRRR(R\R)((s,/usr/lib/python2.7/site-packages/yum/misc.pyRscSst|j|S(N(RxR(R\R((s,/usr/lib/python2.7/site-packages/yum/misc.pyRzs(RRRcRRz(((s,/usr/lib/python2.7/site-packages/yum/misc.pyRs		((tlocalet	setlocaleRtLC_TIMEtErrortsyststderrRRtstdouttgetpreferredencoding(toverride_codecst
override_timeRR((s,/usr/lib/python2.7/site-packages/yum/misc.pytsetup_locales


cCsZytjtj}Wntk
r1}d}nX|dkrGd}ndj|}|S(NRt.(NN(NN(Rt	getlocaletLC_MESSAGESRR%R(tmylangR((s,/usr/lib/python2.7/site-packages/yum/misc.pytget_my_lang_code
s
	cCsgtj}g}xNtjdD]=}|tjj|krFq"n|jtjj|q"W|S(s5return list of running processids, excluding this ones/proc/[0123456789]*(RtgetpidRRRRK(tmypidtpidsRa((s,/usr/lib/python2.7/site-packages/yum/misc.pytreturn_running_pidssc
Csrg}d|}yt|d}Wnttfk
r?}|SXx|D]}|jddkrhqGn|jdd}|jd}||}|jdd}|j}||krG|j|qGqGWd	|}yt|d}	Wnttfk
r
}|SX|	j}
|
jd
dkrn|
jd
}x0|D]%}|j	drB|j|qBqBWn|S(s returns files open from this pids
/proc/%s/mapsR{sfd:is
RRs	(deleted)s/proc/%s/cmdlinet(
R}RRtfindRiRRKRhRR=(
tpidtfilestmaps_ftmapsRRtslashR;tcli_ftclitcmdlinetcmdsRQ((s,/usr/lib/python2.7/site-packages/yum/misc.pytget_open_files$s8




cCstjj|r%t|djSyddlm}Wn&tk
ratddj}nXt|}y4t|d}|j	||j
|jWntt
fk
r}nX|SdS(swcreate, store and return a uuid. If a stored one exists, report that
       if it cannot be stored, return a random oneR{i(tuuid4s/proc/sys/kernel/random/uuidRN(RRRR}RhtuuidRtImportErrorRRtflushRRR(tsavepathRtmyidtsfR((s,/usr/lib/python2.7/site-packages/yum/misc.pytget_uuidGs


cCs|}|s|}n|jdrHd}|s|jdd}qn|jdsf|jdrd}|s|jdr|jdd}q|jdd}qn7|jdrd}|s|jdd}qn|S|rAt|}t|}|rA|rAt|jt|jkr1|S|r>d	SqAn|sy?t||||r|rtj||j|jfnWqt	|qXn|S(
s|take a filename and decompress it into the same relative location.
       if the file is not compressed just return the files.gzRRs.bzs.bz2Rs.xzRN(
RhRiRRtst_mtimeR%RYRtutimeR(R;RTtfn_onlytcheck_timestampstoutRUtfiRi((s,/usr/lib/python2.7/site-packages/yum/misc.pyt
decompress^sF	
#

cCsstjj|d|}yt|d|dtSWn8ttfk
rn}|rh|jtjkrhdSnXdS(s This is a wrapper around decompress, where we work out a cached
        generated name, and use check_timestamps. filename _must_ be from
        a repo. and generated_name is the type of the file. s/gen/RTRN(
RRR>RR9RRRRR%(R;tgenerated_nametcachedRTR((s,/usr/lib/python2.7/site-packages/yum/misc.pytrepo_gen_decompressscCsg}xtj|D]}xt|D]}tjd|rGq)n|j}|j}|skq)n|r|jdd}|jdd}|j|jq)n|j	|q)WqW|S(s'takes a glob of a dir (like /etc/foo.d/*.foo)
       returns a list of all the lines in all the files matching
       that glob, ignores comments and blank lines,
       optional paramater 'line_as_list tells whether to
       treat each line as a space or comma-separated list, defaults to Trues\s*(#|$)s
Rt,(
RR}R&R1RtlstripRitextendRRK(tthisglobtline_as_listtresultstfnameR((s,/usr/lib/python2.7/site-packages/yum/misc.pytread_in_items_from_dot_dirs cCsMtdkrIyddlm}Wntk
r?ddl}nX|andS(s Importing xElementTree all the time, when we often don't need it, is a
        huge timesink. This makes python -c 'import yum' suck. So we hide it
        behind this function. And have accessors. i(tcElementTreeN(t__cached_cElementTreeR%t	xml.etreeRR(R((s,/usr/lib/python2.7/site-packages/yum/misc.pyt_cElementTree_imports
cCsttj|S(s) Lazily load/run: cElementTree.iterparse (RRt	iterparse(R;((s,/usr/lib/python2.7/site-packages/yum/misc.pytcElementTree_iterparsescCsttj|S(s% Lazily load/run: cElementTree.parse (RRtparse(R;((s,/usr/lib/python2.7/site-packages/yum/misc.pytcElementTree_xmlparsescCs|dkr|Sg}xo|D]g}|jdkrbd|jkrGqn|jj|krwqqwn|j|krwqn|j|qW|S(s Given a list of packages, filter them for those "in" the repoid.
    uses from_repo for installed packages, used by repo-pkgs commands. t	installedt	from_repoN(R%trepoidt
yumdb_infoRRK(R(RRmR*((s,/usr/lib/python2.7/site-packages/yum/misc.pytfilter_pkgs_repoids
	cCs=tjtjd}x"|D]}||kr|SqWdSdS(s;Return the first invalid char found in the repoid, or None.s-_.:N(tstringt
ascii_letterstdigitsR%(Rt
allowed_charstchar((s,/usr/lib/python2.7/site-packages/yum/misc.pytvalidate_repoids

((R	ssha1((i((RsRRRtos.patht	cStringIORRRRR&RR>R;RRRRR/RRPRRRRLRNRKRR%trpmUtils.miscutilsRRRRtgpgme.editutilRRFRYRRRZRHtctypeR
RRRRRRhR[RRRsRURRti18nRRRRR"R#R$R*R:R5R6R7R<R8R?RCRDRSRTRvRpRRRRRRRR9RRR
R!R$R+R/R:RGRKRYRZRdRfRqR}RRRRRRRRRRRRRRRRRRRRRRRRR(((s,/usr/lib/python2.7/site-packages/yum/misc.pyt<module>s





	$
						
							BO		2		!1	(					
	#		"			.	!				
	
	
	#	4				

OHA YOOOO