v_c@sddlZddlZddlZddlZddlZejjdddlZddlZddl m Z ddl m Z ddl m Z ddlZddl mZddlZddlZddlmZddlZddlZddlZddlmZdd lmZdd lmZdd lmZdd lTddlZddlZddl Z ddl!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&Z&e'Z(y9ddl)Z)e*e)d  pe*e)d re+Z)nWne,k r e+Z)nXdZ-dZ.e!j/dej0ej1dZ2ej1dZ3dej4fdYZ5deej6fdYZ7e+dZ8dfdYZ9dS(iNtmedia(t URLGrabber(tdefault_grabber(t format_number(t URLGrabError(t Repository(tconfig(tmisc(tcomps(t_(t*tgettsetcCs3ts dSytj|d|}WndSX|S(Nsuser.yum.checksum.(txattrtNoneR (tfilenametchktypetret((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_xattr_get_chksumQscCs4ts dSytj|d||WntSXtS(Nsuser.yum.checksum.(R RR tFalsetTrue(RRtchksum((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_xattr_set_chksum\stignores yum.Repossyum.verbose.RepostYumPackageSackcBsteZdZdZdZdZd dZdZdd ddZ d Z d Z d Z d Z RS(s;imports/handles package objects from an mdcache dict objectcCs&tjj|||_i|_dS(N(t packageSackt PackageSackt__init__tpctadded(tselft packageClass((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRos cCsTy|jWn?tjk rO}tjdt|t||jfnXdS(NsException %s %s in %s ignored(tclosetErrorst RepoErrortverbose_loggertdebugtreprtstrt__del__(Rte((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR'tscCs i|_dS(N(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR zsc Cs||jkr)||j|kr)dSnt|}|dkrd}x||D]t}|d7}|rz|j|||n||}|j||} || _|j|j|| |j| qNW||jkrg|j|sN(t__name__t __module__t__doc__RR'R RR?RKRsRFR]R{RE(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRms    , T  t YumRepositoryc Bs eZdZdZdZdZeeZdZeeZ dZ dZ dZ ee Z dZd Zd Zd ZdyedzdZdZdZdZdZdZedZdZdZedZdZdZ edZ!edZ"dZ#dZ$dZ%dZ&ed Z'ed!Z(ed"d#Z)ed$d%Z*ed&d'Z+ed(d)Z,ed*Z-d+Z.d,Z/d-Z0d.Z1d/Z2ed0d1d2d3d4d5Z3d6Z4ed0d7d2d8d4d9Z5d:Z6dzdzdzdzdzdzdzdzd;edzd< Z7e7Z8dzdzed=Z9dzd;ed>Z:d?Z;d@Z<dAZ=edBZ>dCZ?dzdzdzdzdDZ@dEZAdzdzdFZBdzdGZCdHZDdIZEdJZFdzdKZGedLZHdMZIeJdNZKdzdzdOZLdPZMdzdQZNdzdRZOedSZPdzdTZQdUZRdVZSdzdzdWZTdXZUdzdYZVdZZWed0d[d2d\d4d]ZXd^ZYd_ZZed`Z[edzedaZ\dbZ]edcZ^ddZ_deZ`dfZadgZbdzdhZcdiZddjZedkZfdzdlZgdmZhdnZidodzdpZjdqZkdrZldsZmdtZnduZodvdwgdxZpRS({so This is an actual repository object Configuration attributes are pulled in from config.RepoConf. cCstjj|tj||d|_g|_g|_d|_d|_ d|_ d|_ i|_ d|_ t|_d|_i|_i|_d|_d|_d|_t|_i|_d|_d|_d|_d|_d|_idd6dd6dd 6dd 6dd 6dd 6|_t|_d|_d|_ d|_!d|_"d|_#t|_$d|_%d|_&d|_'d|_(t)|_*d|_+d|_,d|_-t|_.dS( Nis yumgroups.xmlsrepodata/repomd.xmlt cachecookietiRPR*RQtgroupt updateinfot prestodelta(/RtRepoConfRRRtrepofilet mirrorurlst_urlst enablegroupstgroupsfilenamet repoMDFilet_repoXMLt_oldRepoMDDataRbRt_retry_no_cachetmirrorlistparsedtyumvart _proxy_dicttmetadata_cookie_fnt_metadataCurrentt _metalinkt groups_addedt http_headerstrepo_config_aget basecachedirtbase_persistdirtcostt copy_localt retrievedt_preloaded_repomdR9tmulti_callbackt failure_objtmirror_failure_objtinterrupt_callbackt_callbacks_changedt mediafunctgpg_import_functgpgca_import_funct confirm_funcRttimestamp_checkt_sackt _grabfunct_grabt_async(RRO((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRHsV                                      cCs`|dkrdSt|dr+|j}nd}t|j|}|rM|St|j|jS(s@ Sort yum repos. by cost, and then by alphanumeric on their id. iRiN(RRSRtcmpR.(RRQtocostR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt__cmp__s  cCs.|jdkr'tjtj|_n|jS(N(RRt sqlitesacktYumSqlitePackageSacktYumAvailablePackageSqlite(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_getSackscCst|drt|dStj|}|s:d}ng|\}}||}d|kri|d}n8d|kr|d}nd|kr|d}nd}|j}xE|jD]:}d||kr|d7}|t|j|7}qqWt|d||S(s@ Show self.id, but include any $releasever/$basearch/etc. data. t__cached_ui_idRtmetalinkt mirrorlisttbaseurlt$Rt( RStgetattrRt_readRawRepoFileR.tui_repoid_varsR&Rtsetattr(Rtvaltinit section_idRtvar((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_ui_ids*            cCs0|jdk r|jjntj|dS(N(RRtsackR R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR scCs d|_dS(N(RR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _resetSackscCs|j|jr|jSdS(N(t doProxyDictRR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt__getProxyDicts  cCs|jS(s7Returns the instance of this repository's package sack.(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytgetPackageSackscCs t|dr|jdk StS(s;Returns true if this repository is setup and ready for use.tmetadata_cookieN(RSRcRR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytreadys cCsCd|jjkr*|jjd}n|jjd}|jS(s"Returns the location of the group.tgroup_gzR(Rct fileTypesRdRv(Rtthisdata((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytgetGroupLocationscCs|jS(N(R.(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt__str__siicCsytj||||SWn`tjtfk r|}|r?dSd|}t|tjrjt|}ntj |nXdS(stakes filename, hand back Checksum of it sumtype = md5 or sha filename = /path/to/file CHUNK=65536 by defaults#Error opening file for checksum: %sN( RReR!t MiscErrortEnvironmentErrorRt isinstancetFIPSNonCompliantErrorR&R"(RtsumtypetfiletCHUNKtchecksum_can_failtdatasizeR(tmsg((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _checksums c!Csd|j}d(}xt|D]}|jd#r;q n||krMq ntt||tjrnq nt||}| rt|tttd$fkrd%}nt|tj krd&j |}n|d'||f}q W|S()Ns[%s] RRt metalink_datatgrabtgrabfuncRctcfgRRRRRR9RRRR.RRRRRRRRtquick_enable_disableRRturlsRRRRR iRs, s%s = %s (!s mediafuncssacks metalink_datasgrabsgrabfuncsrepoXMLRs retrievedsmirrorlistparsedsgpg_import_funcsgpgca_import_funcs failure_objscallbacks confirm_funcs groups_addedsinterrupt_callbacksidsmirror_failure_objsrepo_config_agesgroupsfilenames copy_locals basecachedirs http_headerssmetadata_cookiesmetadata_cookie_fnRs repoMDFilestimestamp_checksurlss mirrorurlssyumvarsrepofilesmulti_callback( R.tdirt startswithRRttypest MethodTypettypeRtListTypetjoin(Rtoutputt excluded_varstattrtres((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytdumps4  + cCso|jytj|ddgWnDtk rj}|jtjkrXtj|qktt|nXdS(s%Persistently enables this repository.tonlytenabledN( tenableRtwriteRawRepoFiletIOErrorterrnotEACCEStloggertwarningR&(RR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytenablePersistents cCso|jytj|ddgWnDtk rj}|jtjkrXtj|qktt|nXdS(s&Persistently disables this repository.RRN( tdisableRRRRRRRR&(RR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytdisablePersistent"s cCs9t|jdkr5|j r5tjd|jndS(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(R,RtmediaidR!R"R4(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytcheck-scCs|jr dSi|_d}d }|j|kr:d}n|jrd|j}|j|krtj|j}|j|kr|dtj|j7}ntjd|j \}}d|||f}qn|dk r ||jd<||jd<||jd scCs |jS(N(Rg(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs{tjj|r(tjj|r(dSytj|ddWn5tk rv}dd|d|f}tj|nXdS(s@make the necessary directory path, if possible, raise on failureNtmodeis %s: %s %s: %ssError making cache directorys error was(RwRxRtisdirtmakedirstOSErrorR!R"(RtdpathR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_dirSetupMkdir_ps$c Cstjj|j|j}tjj|j|j}tjj|d}tjj|d}|jd||jd||jd||jd|d}tjdkrd }n|jd |d ||jd |d ||jd|j }|jd|x1|j|jd|j gD]}|j |q2Wx>|j gD]0}y|j |WqVt jk r}qVXqVW|jdrt|_n|jd|jd|jddS(s6make the necessary dirs, if possible, raise on failuretpackagesRt_dir_setup_cachedirt_dir_setup_pkgdirt_dir_setup_hdrdirt_dir_setup_persistdirRis-rot_dir_setup_gpgdirs/gpgdirt_dir_setup_gpgcadirs /gpgcadirRtt_dir_setup_metadata_cookies/gens repomd.xmlRsmirrorlist.txts metalink.xmlN(RwRxRRR.Rt setAttributetgeteuidRVRtpkgdirRnt persistdirR!R"t_preload_md_from_system_cacheRR( RRVRzRythdrdirtexttcookieRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytdirSetups6 #   cCs3d|}t||s&|jnt||S(s; Make the directory attributes call .dirSetup() if needed. t _dir_setup_(RSRR(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _dirGetAttrs  cCsd|}t||s&|jn|dkrit|dsMg|_n|jjt||nt|||}|dkr|j|n|S(s; Make the directory attributes call .dirSetup() if needed. RRqt _old_pkgdirs(s_dir_setup_pkgdir(RSRRR2RRRn(RRRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _dirSetAttrs     cCs |jdS(NRV(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRh scCs |jdS(NRz(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRh scCs |jdS(NRy(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRh scCs|jd|S(NRy(R(Rtx((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRh scCs |jdS(NR|(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs|jd|S(NR|(R(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs |jdS(Ntgpgdir(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs|jd|S(NR(R(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs |jdS(Ntgpgcadir(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs|jd|S(NR(R(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs |jdS(NR(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCs'tjdtjdd|jdS(Ns8baseurlSetup() will go away in a future version of Yum. Ri(RRR!Rt _baseurlSetup(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt baseurlSetups cCsF|jr dS|jsdS|jjddkr6dS|j|_dS(NRi(RRtfind(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_hack_mirrorlist_for_anacondas  c Cs|j|j|_|j|_g}|j|jrl|j rl|jt|jj t |_n|j r|j r|j|j t |_n|j||_ |j|j |_t|jdkrlt|drltjj|jrl|jsiytj|jWn3ttfk rN}tjd|j|fqfXtjd|jqiqln|j|_|jdS(sgo through the baseurls and mirrorlists and populate self.urls with valid ones, run self.check() at the end to make sure it workeditmirrorlist_files-Could not delete bad mirrorlist file: %s - %ss-removing mirrorlist with no valid mirrors: %sN(t_replace_and_check_urlRt _orig_baseurlRRRtextendtlistRRRRt_getMirrorListRRR,RSRwRxRRRbRR^RRlRterrorRR(RRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR*s,    $  c Cs g}d}x|D]}|d kr+qntj||j}|ddkr]|d}ny%tj|\}}}}} } Wn"tttfk r} d}nX|d kr|}qq|j|qW|dk r|rt j d t j |qt j d t j |n|S( NRiRttblahRRRRsMYumRepo Warning: Some mirror URLs are not using ftp, http[s] or file. Eg. %ssJYumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. %s(RN(shttpsftpsfileshttps(Rtparsert varReplaceRR+t ValueErrort IndexErrortKeyErrorR2RRRR0R( Rturl_listtgoodurlstskippedR1tstbtptqtftoR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRNs*   %   cCs|js|jn|jS(N(RR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_geturlsls  tfgetcCs |jS(N(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhqstfsetcCst|d|S(NR(R(Rtvalue((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhrstfdelcCst|ddS(NR(RR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhsscCs|js|jdd|_|jd}|jstj|j}|jd|jdk}y8t d|j |}|j ||dd|j }Wqt k r}tjj|jsd |j }tj|ntjd ||jd tj|jd ft|_qXn|jsy)tj||_tj||jWqtjk r}tjd ||ft|_tj|qXn|jrtj|j|_qn|jS(NRts metalink.xmls.tmpRbRLR ttexts %s/metalinksQCannot retrieve metalink for repository: %s. Please verify its path and try agains*Could not get metalink %s error was %s: %siis)Could not parse metalink %s error was %s(RRVtmetalink_filenamet_metalinkCurrentRR0RRHt http_cachingRR9turlgrabR4RRwRxRR!R"RRtargst to_unicodeRRtMetaLinkRepoMDtshutiltmovetMetaLinkRepoErrorParseFailR^(RtlocalR1RKtugRR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _getMetalinkus6   # 1   cCs |jS(N(R(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCst|d|S(NR(R(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhs cCst|ddS(NR(RR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRhscCsZ|r"|jdp!|jdS|js/tSx$|jD]}|j|s9tSq9WtS(NRtsfile:(RRRt_all_urls_are_filesR(RR1((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs R$c Ks|dkr|j}n|dks0|dkrFtjd|jn|jdkrtjj|rk|Stjd||jfn|rt j |\} }}}}n|j r|j rd}|r| dkr|rt |}qny\|j d|d|d|d|d |d |d |j d |jd |d||f }|SWqtjk r~}tjtjd|fqXn| r|s|j| rtjtjj|}|j|j}|t| krtjtdtjj|t|tt| fqn|r,| dkr,|jd| }td|jd |d| d|jd|j d|d| d|j!|}|d|}y:|j"t#j$||dt#j$|d||f}Wqt%k r(}|j&|| d|||f}tj|}||_'|qXnt(|j)d| }yg|j*j"t#j$||dt#j$|d||fd |d| d|d|d| d|j!| }Wnit%k r}|j&|| d|||f}t+|dd}tj,||}||_'|nX|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 baseurls/get request for Repo %s, gave no source or destis0Caching enabled but no local cache of %s from %sRRt checkfunctrelativeRRR1Rtnametdiscnumtranges8Error getting package from media; falling back to url %ssKInsufficient space in download directory %s * free %s * needed %sRbR R#R"Rtsizetretry_no_cacheRts*failed to retrieve %s from %s error was %sRsfailure: %s from %s: %sterrorsN(-RRR!R"R4RbRwRxRR+R,RRtintRt MediaErrorR#tlogt logginglevelstDEBUG_2Rtstatvfstdirnametf_bavailtf_bsizetlongR RRHRR9RRRRRR0Rt _del_dl_fileR6R^R_RRtNoMoreMirrorsRepoError(RR1RRtstarttendRRRR#RbRR*tschemeR-RxtquerytfragidRRR(tdirstattavailRKRR~terrstrRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_getFiles  !T! 4         c  sj}jj}|jrMjr=Stjn|dkrnfd}n|jdk|_ z@|j d|d|dd|d|d|d j |}Wdt |_ X|j d  rj rd } | jjf} tj| n|S( Ncs5js1tjtdtdndS(Nis)Package does not match intended download.(tverifyLocalPkgRR^RR (R=(Rtpackage(s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR"s  s lazy:packagesR1RRRRRbRRCs3Downloaded package %s, from %s, but it was invalid.(t relativepathtlocalPkgtbasepatht_preload_pkg_from_system_cacheRRR^RRRRRRR R6R.R!R"( RRRRRbR*R~RRR((RRs//usr/lib/python2.7/site-packages/yum/yumRepo.pyt getPackages2       c Cs|j}|j}|j}|j}||} |j} tjj|jsbtj |jn|j d| d|d|d|ddd|d|dd d |d | S( NR1RRRR#RRRiRbR( RtlocalHdrthdrstartthdrendRRwRxRR|RkRR( RRRR#RbR~RRRRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt getHeader@s      !cCs|jdk r|jS|j|j|j}|s8|S|jdd}tjj|s_t S|j |jdd}|j rtjj| rt St |_t 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 False. This result is cached, so that metalink/repomd.xml are synchronized.Rts repomd.xmls metalink.xmlN( RRtwithinCacheAgeRtmetadata_expireRVRwRxRRRRR(RtmC_deftrepomdfntmlfn((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytmetadataCurrentRs  cCs|jdk r|jS|jrHtjj|j rHtjd|n|jr]t |_nNtjj|js~t |_n-|j |j |j rt |_n t |_|jS(Ns$Cannot find metalink.xml file for %s(RRRbRwRxRRR!R"RRRRR(R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRos     cCst|dr|jjdr|jjdr|jtd}|jtd}|dkr{|dkswttS|dkr|dkrtSn|dkr|dkrtSqntS(s8Return whether cache_req matches metadata_expire_filter.t_metadata_cache_reqs read-only:tfuturetpasttpresent(RRR(RR(RSRRtmetadata_expire_filterR,tAssertionErrorRR(Rt cache_filtt cache_req((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_matchExpireFilters      cCs|r|jrd}n|dkr=tjj|r=tSt}tjj|rtj|}|d|tjkrt}n|dtjkrt}n|js|S|dt |j krt}qn|S(sxcheck if any file is older than a certain amount of time. Used for the cachecookie and the mirrorlist return True if w/i the expiration time limit false if the time limit has expired Additionally compare the file to age of the newest .repo or yum.conf file. If any of them are newer then invalidate the cache ii( RRwRxRRRtstatttimetcheck_config_file_ageRR(Rtmyfiletexpiration_timetexpire_req_filterRt cookie_info((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs      cCse|j}tjj|js*|j}ntj|tjrat|jd}|j~ndS(s/if possible, set touch the metadata_cookie filesw+N( RRwRxRRVtaccesstW_OKtopenR (RRtfo((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytsetMetadataCookies   cCsy1||_||_||_||_||_Wntjk rL}nX|j r|jr|j r|j rt j t j dt|_t|_ndS(Ns1Disabling media repo for non-media-aware frontend(RbRRRRR!R"RRRR#RRRRRRtskip_if_unavailable(RRbRRRRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytsetups     ' cCsO|jr2tjj| r2tjd|jn|jsG|jrKtSt S(s( Should we cache the current repomd.xml s"Cannot find repomd.xml file for %s( RbRwRxRR!R"R4RRR(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_cachingRepoXMLs cCsk|jdif}|dkr0d|jk}nd}yvtjdddddtjj|}|jd|j d |d d d |d dd|d|j dkdd}Wnmt k r}t j ||rdStjd||fn.tjk rt j ||rdSnXytj||Wn4t j ||rMdStjd||fnX|S(s* Call _getFile() for the repomd.xml file. t old_repo_XMLRtprefixtrepomdtsuffixstmp.xmlRRRRiRR#RRbRLRisError downloading file %s: %ssError renaming file %s to %s(N(t _checkRepoXMLRRttempfiletmktempRwRxRRRRRRR^R!R"trename(RRRt grab_can_failRttfnameRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_getFileRepoXMLsD      cCsuytj|j|SWnWtjk rp}|dkrJd|jk}n|rTdStjd|j|fnXdS(s Parse the repomd.xml file. Rs&Error importing repomd.xml from %s: %sN( t repoMDObjecttRepoMDR.R!t RepoMDErrorRRR"R4(RRtparse_can_failR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _parseRepoXMLs cCsx+tj|jdD]}tj|qWtjj|r|d}tj|||j |t }|dkr|dSi|d6|d6|d6gd6|_ |SdS(s= If we have an older repomd.xml file available, save it out. s /*.old.tmps.old.tmpRRt old_localt new_MD_filesN( tglobRVRR^RwRxRRtcopy2R RRR(RRRR Rn((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_saveOldRepoXMLs  cCs|jstjd|jnd|jkr;i|_dSx"|jdD]}tj|qIW|j}i|_d|krtj|d|dn|d|_ d|krdSx&|dD]}tj|d|qWdS( s0 If we have older data available, revert to it. s*Can't download or revert repomd.xml for %sRNR R Rt old_MD_filess.old.tmp( RR!R"R4RRR^RwRR(RRtold_datatrevert((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_revertOldRepoXML s        cCsl|j}i|_d|kr2tj|dnd|krBdSx#|dD]}tj|dqMWdS(s Done with old data, delete it. R RNs.old.tmp(RRR^(RRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_doneOldRepoXML?s    cCs|dkr|j}n|dkr?d|jkr?d}n|dkrq|j|dd|rq|d7}n||jj|fS( NRRRQR*RPt_dbRc(sothers filelistssprimary(RRcRREtrepoDataR (RRfRc((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_get_mdtype_dataLs     cCsN|j\}}|jdtjj|}|rJtj|dt}n|S(NRtR(RvRVRwRxRyRRR(RRHt compressedR}R~R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_get_mdtype_fnameXs cCs~d|jkrtS|jd}|jrz|j|jjkrztjd|jtj |jtj |jjft StS(s| We check the timestamps, if any of the timestamps for the "new" data is older than what we have ... we revert. RskNot using downloaded %s/repomd.xml because it is older than what we have: Current : %s Downloaded: %s( RRRt timestampRcRRR.RtctimeR(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_groupCheckDataMDNewer`s   cCs|j|jkrtS|j|jkr,tSt}xJ|jD]?}||jkrWq<n|j||j|krutSt}q<W|S(s7 Check parsed repomd.xml against metalink.repomd data. (RRtlengthRt checksumstchksumsR(RcRtdoneRe((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_checkRepoXMLMetalinkss cCs|dkr|j}n|dkr0|j}n|j||jrItSxb|jjD]T}|j||rVtjt j dt j |jj t j |j ftSqVWtS(s@ Check the repomd.xml against the metalink data, if we have it. s/Using older repomd.xml Latest: %s Using: %sN(RRRR!RRt old_repomdsR#RRRRRRR(RRcRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_checkRepoMetalinks     cCsk|j|}|stS|j|js0tS|jj}|jr[|j|jkr[tS|j ||S(sx Save the Old Repo XML, and if it exists check to see if it's the latest available given the metalink data. ( RRRRRRRRRR!(RRtoxmlR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_latestRepoXMLs   cCsN|jd}|jdk r tS|j|r>t}|}nt}|j|rr|}|j}|d|_ni|j||}|dkr|j rt |dr|j dkrt j d|jn|jtS|j|jdkr |j||_n|jdkr&|jtS|r0tS|jsJ|jtStS( s` Common LoadRepoXML for instant and group, returns False if you should just return. s /repomd.xmlRRtwritesread-only:futures Can't download repomd.xml for %sN(swritesread-only:future(RVRRRRRR%RRRRSRR!R"R4RRR R(RRtmdtypesRtcachingRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_commonLoadRepoXMLs<         cCs[|jdkrtS|dkr+|j}n||jkrWt|j|jkrWtSntS(NRn(tmddownloadpolicyRRRcRt DBVERSIONt dbversionR(RRfRc((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyREs  c Cs|dkrdS|s.t}|j|}nEt}|j|}tjj|sstj|dt}t}n|j tjj ||j ||d|d|dtsdS|S(s Check that we already have this data, and that it's valid. Given the DB mdtype and the main mdtype (no _db suffix). RRRHRuN( RRRRwRxRRRRR{RyRz(RRHtdbmdtypetmmdtypet file_checkRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_groupCheckDataMDValids  cCsZ|j|}x7|D]/\}}|j|dts|jtSqW|j|tS(s Retrieve any listed mdtypes, and revert if there was a failure. Also put any of the non-valid mdtype files from the old_repo_XML into the delete list, this means metadata can change filename without us leaking it. tretrieve_can_fail(t_commonRetrieveDataMD_listRGRRRt_commonRetrieveDataMD_done(RR't downloadingtndatatnmdtype((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_commonRetrieveDataMDs  cCsd}|jj}xH|jjD]7}||kr@q(n|d krRq(n|j|q(W|d krx|}ng}d|jkrd }n|jd}||jds+Could not read mirrorlist %s, error was %ss \w+://\S+\s*$s$ARCHs $BASEARCHN( Rt readlinest ExceptionRRR RtrstriptreplaceR2(RRR1t returnlisttcontentR(tlineR&((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_readMirrorLists"      c Cs|jdd|_d }t}|j|j|jdtrft}t|jd}d|j}n|j}t j |d}|dkrd|}n|j }yt j j ||}WnJtk r }tjd||jdtj|jd fd }nX|j||\}}|r||j r| rt|jd } x|D]} | j| qUW| jqnL| rtjj|jrtj|jd |jt|jddS|S( s$retrieve an up2date-style mirrorlist file from our mirrorlist url, also save the file to the local repo dir and use that if cache expiry not expired we also s/$ARCH/$BASEARCH/ and move along return the baseurls from the mirrorlist file Rtsmirrorlist.txtRtrsfile://iRs1Could not retrieve mirrorlist %s error was %s: %sitwN(RVRRRRtmirrorlist_expireRRRR+RHREtgrabberturlopenRRRRRRRqRbR&R RwRxRtutime( RRtcacheokR1RRKR(RnRoRRp((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs:     1  cCs~tjj|stStjj|r[tj|tjtj|tjkr[tSnytj||WntSXtS(s&attempts to copy the file, if possible( RwRxRRRtST_CTIMERRR(RR[tdestfn((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _preload_files,RcCst|dstS|jdkr&tStjj|j|j}tjj|sWtStjj|tjj|j krtS|d|tjj |}|dkr|j d|tjj |}n|j ||S(sLattempts to copy the file from the system-wide cache, if possibletold_base_cache_dirRRtN( RSRR|RwRxRR.RtnormpathRVRyRR{(RRtsubdirRztglob_repo_cache_dirR[((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_preload_file_from_system_caches' $cCs |j|S(sUattempts to copy the metadata file from the system-wide cache, if possible(R(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyR{ scCstjj|j}tjj|j|}|j|jddd|rUtSt|dsht Sx6|j D]+}|j tjj|||rrtSqrWt S(sOattempts to copy the package from the system-wide cache, if possibleR~s packages/RzR( RwRxRyRRRyRRRSRRR{(RtpkgtpnameRztopkgdir((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs !cCsg}dGHy|jj}Wn<tjk r\}tddt|}|j||SXxp|D]h}d|GHy|j|Wqdtjk r}d|}td|t|}|j|qdXqdW|S(Ns verifying mdisfailed to load repomd.xmls verifying %ss.%s metadata missing or does not match checksumi(RcRR!R"tRepoVerifyProblemR&R2Ra(Rtproblemstmd_typesR(tprbtmd_typeR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _verify_md"s"    cCsdGHg}|j}|dk r5tj|}nytj}|j|WnJtjtj fk r}d}t t |t |}|j|n8X|j dkrd}t t |d}|j|n|S(Nsverifying compsscomps file failed to addisno groups in compsR(ReRRRRtCompstaddR!t GroupsErrortCompsExceptionRtREPO_PROBLEM_COMPSR&t compscount(RRtgrpfiletcR(RR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt _verify_comps7s"   cCsgS(N((R((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt_verify_packagesSstrepodataRcCs|g}d|kr(|j|jnd|krV|jrV|j|jqVnd|krx|j|jn|S(s}download/verify the specified items @items = ['repodata', 'comps'] can include: repodata, comps, packages RRRo(RRRRR(RtitemsR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytverifyVs    iN(qRRRRRRtpropertyRRR4R Rt_YumRepository__getProxyDictReRRRRRRRRRRRRRR_RRRHRfRgRRRnRRRRVRzRyR|RRRRRRRRRRRRRt_YumRepository__getRRRRRRRRRRR RRRRRRt staticmethodR!R#R%R)RER0R7R2R3RBRKRMRNRcRRRRzRaRGRWRYR[ReRfRgRhRiRqRR{RR{RRRRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRAs =                 <    '             $     $    h)     #  *      -   S      , 0  Z          ,       c CsRtjdtjddg}ttjdr=tj}nddl}|}tj|d}|dkr{d|}n|}y|j |d |}WnBt k r}d ||j dt j |j d fGHd}nX|dk rN|j} xT| D]I} tjd | rqn| j} | jd d} |j| qWn|S(Ns9getMirrorList() will go away in a future version of Yum. RiRviiRsfile://R]s1Could not retrieve mirrorlist %s error was %s: %sis\s*(#|$)s$ARCHs $BASEARCH(RRR!RRSRERuR R+RvRRRRRRjR RRlRmR2( RtpdictRnt urlresolverR RR1RR(RoRpR&((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyt getMirrorListgs2     )     RcBseZdZedZRS(s9 Holder for each "problem" we find with a repo.verify(). cCs(||_||_||_||_dS(N(Rtmessagetdetailstfake(RRRRR((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs   (RRRRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pyRs(:RwR RRR+t uses_fragmentR2R R!turlgrabber.grabberRRturlgrabber.progressRturlgrabber.mirrorRERRRtreposRRRTRtyumRRRR t constantsRtloggingRRR RRRRRtskip_old_DBMD_checkR RSRt ImportErrorRRt simplefilterRt getLoggerRR#RRRRRR(((s//usr/lib/python2.7/site-packages/yum/yumRepo.pytsn                             - %