Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/UpdateManager/Core/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyc


Oc@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Zddlm
Z
ddlmZmZmZdefdYZedkreddZd	ejd
dGHndS(i(tTemplateN(tgettext(tSourcesList(tget_distturl_downloadabletcountry_mirrortDistUpgradeFetcherCorecBseZdZdZdZdejkZdZdZ	dZ
dZdZd	d
Z
dZdZd
ZdZdZdZdZdZRS(s2 base class (without GUI) for the upgrade fetcher s http://archive.ubuntu.com/ubuntutmaintDEBUG_UPDATE_MANAGERcCs+||_t|_||_g|_dS(N(tnew_distRtcurrent_dist_namet	_progresstrun_options(tselfR	tprogress((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyt__init__+s		cCs$|jr tjj|dndS(s" helper to show debug information s
N(tDEBUGtsyststderrtwrite(R
tmsg((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyt_debug2s	cCstS(N(tTrue(R
((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytshowReleaseNotes7scCs|GH|GHtS(s dummy implementation for error display, should be overwriten
            by subclasses that want to more fancy method
        (tFalse(R
tsummarytmessage((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyterror:scCs|jjr|jdtjj|jj}|jdtjj|jj}tditjj|d6tjj|d6GH|j||rt	Snt
S(Nt/s0authenticate '%(file)s' against '%(signature)s' tfilet	signature(R	tupgradeToolSigttmpdirtostpathtbasenametupgradeToolt_tgpgauthenticateRR(R
tftsig((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytauthenticateBs##s/etc/apt/trusted.gpgcCstj}dd|jddd|g|j_|jd||gddd	d
g}|jdj}y|jWnXt	k
r}d|GHdGH|jdjGH|jd
jGH|jd	jGHt
SXd
|krtSdGH|GHt
S(sx authenticated a file against a given signature, if no keyring
            is given use the apt default keyring
        s--no-optionss	--homedirs--no-default-keyrings--ignore-time-conflicts	--keyrings--verifyt
create_fhststatustloggerRsexception from gpg: %ssDebug information: tVALIDSIGsinvalid result from gpg:(tGnuPGInterfacetGnuPGR toptionst
extra_argstrunthandlestreadtwaittIOErrorRR(R
RRtkeyringtgpgtproctgpgreste((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyR&Ms.		cCstjj|jtjj|j}tdtjj|GHtjj|sXtSyXt	j
|jdtjj|jd}x|D]}|j|qW|jWn(t	j
k
r}tjd|tSXtS(Nsextracting '%s'Rtrsfailed to open tarfile (%s)(R!R"tjoinR R#turiR%texistsRttarfiletopentextracttcloset	ReadErrortloggingRR(R
tfnamettarttarinfoR;((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytextractDistUpgraderks',
cCs`d|j|jjf|_}tjj|s\|jtdtddtdSt	S(Ns%s/%ssCould not run the upgrade tools.  swThis is most likely a bug in the upgrade tool. Please report it as a bug using the command 'ubuntu-bug update-manager'.(
R R	tnametscriptR!R"R?RR%R(R
RK((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytverifyDistUprader{s
 c
Cs)|jd|jtdt}t}x|jD]}|js6|js6|jdkrdq6n|j	|kryq6n|j	j
|r|j|jkr|j|j
kr|S|j|jkr6d|j
kr6|j	|t|}t||jr|S|j|j	q6q6W|jddS(s
      try to figure what the mirror is from current sources.list

      do this by looing for matching DEFAULT_COMPONENT, current dist
      in sources.list and then doing a http HEAD/ftp size request
      to see if the uri is available on this server
      smirror_from_sources_list: %stwithMatchertdebRsno mirror foundt(RR
RRtsettlisttdisabledtinvalidttypeR>t
startswithtdisttDEFAULT_COMPONENTtcompstlenRtadd(R
R>tdefault_uritsourcestseenR;t
mirror_uri((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytmirror_from_sources_lists(	"
cCs|j|jrA|jd|j||j}|rA|Snt|}t}|jd|}y)t||jstd|nWn6tk
r}|jd||jdd}nX|S(s
        expand the uri so that it uses a mirror if the url starts
        with a well know string (like archive.ubuntu.com)
        strying to find suitable mirrort
countrymirrorsfailed to download %ss url '%s' could not be downloadedRO(	RUtDEFAULT_MIRRORRR_RRtsafe_substituteRt	Exception(R
R>tnew_urituri_templatetmR;((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyt
_expandUris
	cCstjdd|_}tj|tjd||jdkrotj	j
ddtj	j
ddntj|j}|j
jd
kr|j|j
j}tj||dtd	}|n|j
jd
kr|j|j
j|_tj||jdtd
}||j}||jkrLtjd|tSxwtjj|j
jtjj|j
jgD]E}tjj|otjj|dks}tjd|tSq}WtStS(s. download the tarball with the upgrade script tprefixsupdate-manager-susing tmpdir: '%s'isDebug::Acquire::httpt1sDebug::Acquire::ftptdescrsUpgrade tool signaturesUpgrade toolsfetch result != continue (%s)sfile '%s' missingN(ttempfiletmkdtempR R!tchdirREtdebugRtapt_pkgtConfigtSettAcquireRR	RtNoneRgtAcquireFileR%R$R>R2tRESULT_CONTINUEtwarnRR"R#R?tgetsizeR(R
R tfetcherR>taf1taf2tresultR'((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytfetchDistUpgraders<
			*cCsV|jg|j}tjdkr?tjddg|ntj|j|dS(Nis
/usr/bin/sudotsudo(RKRR!tgetuidtexecv(R
targs((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytrunDistUpgraderscCs!tjdtj|jdS(Ns..(R!RmtshutiltrmtreeR (R
((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pytcleanups
cCs|jsdS|js<|jtdtddS|jsr|jtdtd|jdS|js|jtdtddS|js|jtdtd|jdSyKtj	|j
tjstd	|j
}d
|_
|n|jWnetk
r}|j
d
kr`|jtdtdtS|jtdtd
|jnXtS(NsFailed to fetchs=Fetching the upgrade failed. There may be a network problem. sAuthentication faileds_Authenticating the upgrade failed. There may be a problem with the network or with the server. sFailed to extracts[Extracting the upgrade failed. There may be a problem with the network or with the server. sVerification faileds[Verifying the upgrade failed.  There may be a problem with the network or with the server. sCan not execute '%s'i
sCan not run the upgradesyThis usually is caused by a system where /tmp is mounted noexec. Please remount without noexec and run the upgrade again.sThe error message is '%s'.(RR|RR%R)RRIRLR!taccessRKtX_OKtOSErrorterrnoRRtstrerrorR(R
texR;((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyR2sD





		
(t__name__t
__module__t__doc__RaRWR!tenvironRRRRRR)R&RIRLR_RgR|RRR2(((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyR$s$										&		t__main__sgot mirror: '%s'sghttp://archive.ubuntu.com/ubuntu/dists/intrepid-proposed/main/dist-upgrader-all/0.93.34/intrepid.tar.gzs http://archive.ubuntu.com/ubuntu(tstringRR!RoRER@RkRRR.RR%taptsources.sourceslistRtutilsRRRtobjectRRRstdR_(((sM/usr/lib/python2.7/dist-packages/UpdateManager/Core/DistUpgradeFetcherCore.pyt<module>s