Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/DistUpgrade/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyc


Oc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
ZddlmZm
Z
ddlmZmZddlmZmZmZddlmZdefdYZdefd	YZd
efdYZedkreZeZeZejd
dejZx#ejdD]Z ee j!qoWej"eeej#dej$dndS(iN(tNoSectionErrort
NoOptionError(tPIPEtPopen(tDistUpgradeViewtInstallProgresst
FetchProgress(tDistUpgradeConfigtNonInteractiveFetchProgresscBseZdZRS(cCsutj||||||tjkrqd||jtjt|jfGHtj	j
rqtj	jqqndS(Nsfetched %s (%.2f/100) at %sb/s(Rt
update_statustapt_pkgt	STAT_DONEtpercenttsize_to_strtinttcurrent_cpstsyststdouttisattytflush(tselfturitdescrt
shortDescrtstatus((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR	)s$(t__name__t
__module__R	(((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR(stNonInteractiveInstallProgresscBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	s 
    Non-interactive version of the install progress class
    
    This ensures that conffile prompts are handled and that
    hanging scripts are killed after a (long) timeout via ctrl-c
    cCstj|tjdtjjds<dtjd<ndtjd<dtjd<td|_||_	d	|_
y2|jjd
dtrt
jjdd
nWnttfk
rnXd|_y|jjd
d|_Wntk
rnXdS(Ns*setting up environ for non-interactive usetDEBIAN_FRONTENDtnoninteractivetnonetAPT_LISTCHANGES_FRONTENDt1tRELEASE_UPRADER_NO_APPORTt.itNonInteractivetForceOverwritesDPkg::Options::s--force-overwritei`	tTerminalTimeout(Rt__init__tloggingtdebugtostenvironthas_keyRtconfigtlogdirtinstall_run_numbertgetWithDefaulttFalseR
tsetRRttimeouttgetintt	Exception(RR-((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR&;s&



			
c
Cs|tjd||f|jjddts3dStjtj}d|d<g}d|krd}d}d	}d
|||f}nd|krd}d
}d}d||f}n{d|krd}d}d}d
|||f}nGd|kr"d}d}d}d
|||f}nd||fGHdStjj	|s\tjd|dSt
|jdjj
d}	d|	ksd|	krdg}
n3d|	krdg}
d|d<ntjd |	d!t
|jkrd"|d#<d$|d%<d&}	d'dg}
n|j|	|j|
|j||j||dkrtd(|d)td*tjd}|r5|j|j
d+d,d,jq5n|d
kr5tjj|}|j
d-d}td.|d)td*tjd}|r5|j|j
d+d,d,jq5ntjd/||ftj|d0|}tjd1||fdS(2Ns)got a error from dpkg for pkg: '%s': '%s'R#tDebugBrokenScriptsR(t	PYCENTRALspost-installations/var/lib/dpkg/info/tpostinstt	configures%s/%s.%sspre-installations/var/lib/dpkg/tmp.ci/tpreinsttinstalls%s/%sspre-removaltprermtremovespost-removaltpostrms3UNKNOWN (trigger?) dpkg/script failure for %s (%s) s+can not find failed maintainer script '%s' iitbashs/bin/shs-extperls-dsAutoTrace NonStoptPERLDB_OPTSsunknown interpreter: '%s's. /usr/share/debconf/confmodulet	developert
DEBCONF_DEBUGR tDEBIAN_HAS_FRONTENDs/usr/share/debconf/frontendtshs%dpkg-query -s %s|grep ^Config-VersiontshellRt:it_sdpkg-query -s %s|grep ^Versionsre-running '%s' (%s)tenvs%s script returned: %s(R'terrorR,R/R0tcopyR)R*tpathtexiststopentreadlinetstriptsplittwarningtreadtappendtextendRtTrueRtcommunicatetbasenameR(t
subprocesstcall(
RtpkgterrormsgR*tcmdtprefixtnametargumenttmaintainer_scripttinterpt
debug_optstversiontret((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRITsz	
&	






&)&)cCs`tjd|tjdytj|jdWn$tk
r[}tjd|nXdS(Ns.got a conffile-prompt from dpkg for file: '%s'isn
s/error '%s' when trying to write to the conffile(	R'RQttimetsleepR)twritet	master_fdR4RI(Rtcurrenttnewte((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytconffiles
cCstj|tj|_|jjddt}|rtjj	|j
d|j}tj
d|t|d|_nttjd|_|jjdtjdS(NR#tDpkgProgressLogsdpkg-progress.%s.logs!writing dpkg progress log to '%s'tws
%s: Start
(Rtstart_updateRet
last_activityR,R/R0R)RKtjoinR-R.R'R(RMtdpkg_progress_logtdevnullRg(Rtprogress_logtfullpath((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRos
cCsGtj||jjdtj|jj|jd7_dS(Ns
%s: Finished
i(Rt
finish_updateRrRgRetcloseR.(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRvs

cCs*|jjdtj|||fdS(Ns%s:%s:%s:%s
(RrRgRe(RRZRt
status_str((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyt
status_changescCs0tj||jdkr dS|j|jtjkrutjd|j|j	ft
j|jt
dntj|jgggd}xt|ddkrtj|_y-t
j|jd}tjjd|Wntk
rdSXtj|jgggd}qWtjjdS(Ns,no activity %s seconds (%s) - sending ctrl-cig?iis%s(Rtupdate_interfacetstatusfdtNoneRpR2ReR'RQRR)RgRhtchrtselecttlenRRRRtOSErrorR(Rtrests((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRzs"
	
"cCsltjddtjd<dtjd<tj\|_|_|jdkretjd|jn|jS(Nsdoing a pty.fork()tdumbtTERMttruetPAGERis
pid is: %s(R'R(R)R*tptytforktpidRh(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRs


(RRt__doc__R&RIRlRoRvRyRzR(((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR3s		Y	
				tDistUpgradeViewNonInteractivecBseZdZdddZdZdZdZddZdZ	dZ
dedZd	d
Z
dZddZd
ZRS(s- non-interactive version of the upgrade view cCs\tj|td|_t|_t||_tj	j
j|_|j
t_dS(NR"(RR&RR,Rt_fetchProgressRt_installProgresstapttprogresstbaset
OpProgresst_opProgresst
excepthookRt__excepthook__(RtdatadirR-((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR&s
cCs%tjd||f|jdS(s2 on uncaught exceptions -> print error and reboot sgot exception '%s': %s N(R't	exceptiontconfirmRestart(Rttypetvaluet	traceback((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRscCs|jS(s5 return a OpProgress() subclass for the given graphic(R(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytgetOpCacheProgressscCs|jS(s  return a fetch progress object (R(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytgetFetchProgressscCs|jS(s" return a install progress object (R(Rtcache((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytgetInstallProgressscCsdS(s\ update the current status of the distUpgrade based
            on the current view
        N((Rtmsg((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytupdateStatusscCsdS(s we have 5 steps current for a upgrade:
        1. Analyzing the system
        2. Updating repository information
        3. Performing the upgrade
        4. Post upgrade stuff
        5. Complete
        N((Rtstep((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytsetStepscCstj||||||tjdg|jD]}|j^q/tjdg|jD]}|j^qYtjdg|jD]}|j^qtS(Nstoinstall: '%s'stoupgrade: '%s'storemove: '%s'(	RtconfirmChangesR'R(t	toInstallR^t	toUpgradettoRemoveRU(Rtsummarytchangest	demotionstdownloadSizetactionstremoval_boldtp((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRs
***tNocCstS(s0 ask a Yes/No question and return True on 'Yes' (RU(RRRtdefault((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytaskYesNoQuestionscCs#tjd|jjddtS(s2 generic ask about the restart, can be overridden sconfirmRestart() calledR#t
RealReboot(R'R(R,R/R0(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyR#s
cCstjd|||fdS(s display a error s
%s %s (%s)N(R'RI(RRRtextended_msg((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRI(scCstjddS(Nsview.abort called(R'RI(R((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pytabort+sN(RRRR|R&RRRRRRRURRRRIR(((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyRs					
	t__main__sxserver-xorgspre-installation script failediii(%RR
R'ReRR)RR~RXRJtapt.progresstConfigParserRRRRRRRtDistUpgradeConfigParserRRRRRtviewtfptipRItCacheRtargvRZtmark_installtcommitRftexit(((sM/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyt<module>s8@